Search code examples
javapdfitextletter

Generate PDF using 'letter paper'


I've come across the expression "Letter paper" (or letter-paper) lately, but I have never heard it before and I am not sure what it is, I am beginning to think this is not a standard expression. Anyway I tried to find out something about it, but it looks like it is not very commonly used at least with this wording as far as Java PDF generation goes. A letter page should be some kind of a template I assume, but then I do not know why isn't it called that. It should be used for common logos in the corners for example or for common footers. I could not find any tutorial or explanation on what is actually is or how to apply it to my PDF generating procedure.

Can anyone please explain to me what it is, (why is it called this) and maybe how to apply it to my PDF generation? I am using iText.


Solution

  • It is referred to normal A4 size papers size of 8.5" width x 11" height.

    For PDF generation you can specify the size when creating the pdf object.

    i have used the following with my iText pdf export

    document = new Document(PageSize.A4, 16, 16, 64, 34);
    

    if you want help to specific to particular pdf library, if you give the pdf library name i will try to find out

    Update: For your comment

    the customer mentioned that the "letter-paper" should contain a logo and some footer, and the actual (additional) data should printed on this template (I assume).

    may be customer needs to have header and footer in each page of generated PDF. In iText you can specify Header and Footer using java code and these will be inserted in all pages in resulting PDF.

    you can get the samples for using header and footer here

    https://itextpdf.com/examples/iia.php?id=86

    https://itextpdf.com/examples/iia.php?id=87