On 27/03/2012 17:48, Hanumanth wrote:
Hi,

I have a requirement which generates a PDF report in Java

Requirements
-----------------
Page Size - Same dimensions as for Cut Sheet, plus 1/2 left and right, (overall: 9.5 x 11; detached: 8.5 x 11).

If you want a document with a specific size that is bigger than Letter, you shouldn't create a document with PageSize.LETTER as you're doing:
Document document = new Document(PageSize.LETTER);
This creates a document with pages of size 8.5 by 11 inches. Use a different Rectangle: Document document = new Document(new Rectangle(Utilities.inchesToPoints(9.5), Utilities.inchesToPoints(11)); You may want to adapt your margins, because if you need half an inch to cut off, this won't be sufficient:
document.setMargins(10.8f, 10.8f, 12f, 12f);
Half an inch is 36 user units, so the value of the left and right margin needs to be at least 36f.


10 characters per inch

Which font are you planning to use? Currently you're using Courier with font size 10. It seems as if you're interpreting the font size as the number of characters per inch whereas the font size is an indication of the HEIGHT of the font. I think Courier with font size 12 results in about 10 characters per inch, but I'm not sure. You should check this by doing some math (consult chapters 3 and/or 11 of "iText in Action - Second Edition" to find out how to measure a String).

and 6 lines per inch

The distance between the baseline of two lines of text is called the "leading". An inch is 72 pt, so if you want 6 lines per inch, you need a leading of 12. Note that the result will be rather ugly if you use Courier with font size 12 and leading 12. The lines will be very dense.


how can I meet the above requirements.

Please find attached code which I have tried and it is not working correct, Please check and guide me

All the guidance you need can be found in the book "iText in Action - Second Edition." You'll save plenty of time (yours and ours) if you read it before starting to use iText.

Note that this answer is offered as a courtesy, don't take advantage of our kindness. Our answer doesn't give you any privileges. You're using iText 5+. If you're using this code in a commercial context, please contact sales to inform about pricing.
------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
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