× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hi:

We have been working with iText and have been successful in creating a PDF 
from a spool file. However, our end result is to be able to access iSeries 
data in a PF via a web application and create a PDF dynamically using this 
data. I feel I have done my research and am only able to find 
documentation on creating a PDF from a SPLF. I have tried tweaking the 
servlet example on the lowagie site but am just getting back garbage.

Here is a part of my servlet:

                Document document = new Document();
                ByteArrayOutputStream baos = new ByteArrayOutputStream();

                Class.forName("com.ibm.as400.access.AS400JDBCDriver");
                DriverManager.registerDriver(new 
com.ibm.as400.access.AS400JDBCDriver());
                conn = DriverManager.getConnection("jdbc:as400://mybox", 
"myid", "mypassword");

                PreparedStatement stmt = 
conn.prepareStatement(sqlString2);
                ResultSet rs = stmt.executeQuery();

                PdfWriter.getInstance(document, baos);
                document.open();

                while (rs.next()) {

                        //rs.next();

                        document.add(new 
Paragraph(rs.getString("M152DETAIL").t));
                conn.close();

                document.close();

                // setting some response headers
                response.setHeader("Expires", "0");
                response.setHeader("Cache-Control", "must-revalidate, 
post-check=0, pre-check=0");
                response.setHeader("Pragma", "public");
                // setting the content type
                response.setContentType("application/pdf");
                // the contentlength is needed for MSIE!!!
                response.setContentLength(baos.size());
                // write ByteArrayOutputStream to the ServletOutputStream
                ServletOutputStream out = response.getOutputStream();
                baos.writeTo(out);
                out.flush();

Any ideas?

TIA

Mike Burdette

Comporium Data Services
Web Development

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.