Kyle wrote:
The problem is that it loads through the
files, but it only displays a blank white screen...obviously I'm missing
something with the outputstream part.
You pass a Response object to this method.
In the method, you create a ByteArrayOutputStream,
but the method doesn't return anything,
nor do I see you writing the baosPDF to the Response.
public void getPDFResult(HttpServletRequest request, HttpServletResponse
response)
throws javax.servlet.ServletException, java.io.IOException {
Document doc = new Document(PageSize.A4.rotate(),10,10,10,10);
ByteArrayOutputStream baosPDF = new ByteArrayOutputStream();
PdfWriter docWriter = null;
try {
PDFShapes pdfShape = new PDFShapes();
docWriter = PdfWriter.getInstance(doc, baosPDF);
doc.setPageSize(PageSize.A1);
doc.open();
PdfContentByte cb = docWriter.getDirectContent();
// pdfShape.rectangle calls a method in the next class that will output
// the result
pdfShape.rectangle(5,6,10,8,cb);
}
In other words: the PDF is mad in memory (baosPDF),
but it's not a valid PDF because doc.close() is missing.
Once out of scope, the garbage collector will clean up baosPDF
and all the PDF written to memory so far will be lost.
br,
Bruno
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions