I don't know what an "imageConsumer" is, but the values that it is giving you 
are pretty crazy!

For example, the page in the provided document is 860x65220(!!).   So you are 
getting a VERY LONG page.

And then looking at the drawing instructions, they too are VERY strange also 
with coordinates into the 65000.

I assume that this is all incorrect - so I would go back and figure out why you 
have such strange values.

Also, I see NO raster data associated wih this page - only vector drawing 
instructions.

Leonard

-----Original Message-----
From: Jan Mikelson [mailto:[email protected]] 
Sent: Friday, January 20, 2012 7:55 AM
To: [email protected]
Subject: [iText-questions] Acrobat Reader fails to properly display large iText 
pdf

Hi all,

I have a question concerning pdf creation using iText. We use iText in a Java 
project to create pdf files. We observed, that if the created pdf file is large 
(e.g. 4 MB), Adobe Acrobat Reader fails to display it properly. All other pdf 
reader such as Document Viewer on Ubuntu or Preview on Mac work just fine. 
Adobe Acrobat Reader usually displays the pdf only after changing the 
resolution in the picture display properties and even then it cuts off the top 
of the document. This has been observed on ubuntu 11.04 and Windows 7. 
This is the code we use to create the pdf files:


//Code begin
Component component = imageConsumer.getComponent(); Dimension imageSize = 
imageConsumer.getImageSize();

Document document = new Document(new RectangleReadOnly(imageSize.width,
imageSize.height));

//exportFile is the file name as a String PdfWriter writer = 
PdfWriter.getInstance(document, new FileOutputStream(exportFile));

document.open();

PdfContentByte contByte = writer.getDirectContent(); Graphics2D graphics = 
contByte.createGraphics(imageSize.width,
imageSize.height);

//this only scales the image
double sx = 1.0 * imageSize.width / component.getWidth(); double sy = 1.0 * 
imageSize.height / component.getHeight();

graphics.scale(sx, sy);
component.printAll(graphics);
graphics.dispose();

document.close();

//Code end

I attached a sample pdf with the above described behavior. 
I would like to know, whether this is a known problem and is due to the 
implementation of iText, a flawed implementation of our code or a bug or 
problem in the Adobe Acrobat Reader.

Any help is greatly appreciated



  
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

Reply via email to