Hello,

I'm creating a pdf using com.itextpdf.text.PageSize.A4. 

Document document = new Document(PageSize.A4);

When i open the output file in Adobe Acrobat X v10.1.9 The output file has
the size:

595.0 X 842,0 pts (CORRECT)

                BUT

8.26 X 11.69 in (INCORRECT! 8.3 X 11.7 in)

The page size is validated in inches not in points. Because of that all the
documents generated are being reproved.

document generation code
--------
Document document = new Document(PageSize.A4);
PdfWriter writer = PdfWriter.getInstance(document, outputStream);
document.newPage();
document.close();
writer.close();
outputStream.flush();
outputStream.close();
------
end of code

document validation code
----------------------
//reader is a pdfReader instance and pageNumber is the page in the loop
Rectangle pageSize = reader.getPageSize(pageNumber);
float heightSize = round2(Utilities.pointsToInches(pageSize.getHeight()));
float widthSize = round2(Utilities.pointsToInches(pageSize.getWidth()));
                
//check page is A4
if(heightSize == 11.7f && widthSize == 8.3f){
  isA4Sized = true;
} else {
  isA4Sized = false;
}
return isA4Sized;
-----------------
end of the code

using Itext v5.5.0 and Oracle jdk 1.7u51 32Bits.





--
View this message in context: 
http://itext-general.2136553.n4.nabble.com/java-A4-page-size-is-wrong-in-PageSize-A4-tp4659791.html
Sent from the iText - General mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Flow-based real-time traffic analytics software. Cisco certified tool.
Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
Customize your own dashboards, set traffic alerts and generate reports.
Network behavioral analysis & security monitoring. All-in-one tool.
http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
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