I can't see any reason for it to behave differently in Linux. The big
question here is if the produced pdf reaches the Acrobat plug-in in
working conditions. Try to disable the "Display PDF in browser" option
and try mozzila.

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Michael Bacarella
> Sent: Wednesday, November 24, 2004 7:03 AM
> To: [EMAIL PROTECTED]
> Subject: [iText-questions] Adding Multiple Images
> 
> I am having difficulties adding multiple images to PDFs.
> 
> My development environment is Windows, Apache, Resin 3.
> On this server, I am able to add multiple images to a
> PDF using the iText library (1.1) and view the
> resulting document.
> 
> On my production server (hosted by a third party),
> which is Linux, Apache, Resin 2, a valid PDF document
> fails to be created if I add more than one image.
> 
> In both cases I am using Adobe Reader 6 to open the
> document. The error I am receiving in Adobe is "Adobe
> Reader could no open 'Math-1.pdf' because it is either
> not a supported file type or because the file has been
> corrupted (...)"
> 
> One thing to note is that my production server is running
> in headless mode without any graphics library
> installed. I originally suspected this might be the
> issue, but the fact that a single image can be added to
> the PDF would appear to void this theory.
> 
> Here is an example image:
> http://www.testdesigner.com/include/math/images/1358978531.png
> 
> Both my development and production code reference the same image.  It 
> doesn't matter if I add the same image twice or two different 
> images.  
> In both cases, the document fails to be created properly.  I 
> have also 
> tried different images.  Again, everything works locally, 
> just not on my 
> production server.
> 
> The relevant code is as follows:
> final Phrase phrase = new Phrase();
> final Image equation = Image.getInstance(new URL(url));
> equation.setAlignment(Image.MIDDLE);
> // vertical aligns text with images on a line
> final Chunk ck = new Chunk(equation, 0.0F,
> -equation.height() / 2.0F + 6.0F); // TODO: Determine
> how to calculate 6 (what appears to be half line height)
> // add image chunk
> phrase.add(ck);
> // add extra spacing to compensate for height of image
> phrase.setLeading(equation.scaledHeight() * 1.2F);
> final ListItem li = new ListItem(phrase);
> final com.lowagie.text.List questionList = new
> com.lowagie.text.List(true, false, 20);
> questionList.add(li)
> doc.add(questionList);
> 
> I create a new Phrase and add the next image in a loop.
> 
> Is there anything that happens
> differently with the iText libraries on Linux that
> doesn't happen on Windows that could be causing this
> error. Is there any way to debug this issue without a 
> debugger (since I 
> can't debug on my
> production server)?
> 
> My Servlet looks something like this:
>                    
> baosPDF = TestManager.getPDFBytes(test);
> 
> resp.setHeader("Cache-Control", "max-age=30");
> resp.setContentType("application/pdf");
> 
> final StringBuffer sbContentDispValue = new StringBuffer();
> sbContentDispValue.append("attachment");
> sbContentDispValue.append("; filename=");
> 
> final String fileName = test.getName() + ".pdf";
> sbContentDispValue.append(fileName);
> 
> final String contentDisposition = sbContentDispValue.toString();
> resp.setHeader("Content-disposition", contentDisposition);
> final int size = baosPDF.size();
> resp.setContentLength(size);
> final ServletOutputStream sos = resp.getOutputStream();
> baosPDF.writeTo(sos);
> sos.flush();
> 
> Any suggestions or ideas would be appreciated.
> 
> 
> Thank you,
> Michael
> 
> -- 
> Michael Bacarella
> Web Application Developer
> www.bacman.net
> www.testdesigner.com
> 
> 
> 


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to