wood burning stoves 2.0*
The moose likes Other Open Source Projects and the fly likes how i can add header to each PDF page using iText 2.7.1 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "how i can add header to each PDF page using iText 2.7.1" Watch "how i can add header to each PDF page using iText 2.7.1" New topic
Author

how i can add header to each PDF page using iText 2.7.1

manushree deepak
Greenhorn

Joined: Feb 12, 2009
Posts: 9
Hi ,

how i can add header/footer to each PDF page using iText 2.7.1.

I am capturing header and footer as a html tag from UI.I want to add header and footer to each PDf page.
Please help me.


Thank you.
Karthik Jayachandran
Ranch Hand

Joined: Feb 18, 2009
Posts: 88

There is never been a 2.7.1 version of iText. Did you mean 2.1.7?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41052
    
  43
See https://www.coderanch.com/how-to/java/ItextExample for a full example.


Ping & DNS - my free Android networking tools app
manushree deepak
Greenhorn

Joined: Feb 12, 2009
Posts: 9
@Karthik Jayachandran : sorry itext version is 2.1.7 .

@Ulf Dittmer : I gone through the example provided.I have a header info which is stored in db like,

ex : <div style="text-align: center;"><b><font size="2" color="#ff0000">Header</font></b></div>

I want to render this in PDF as header .Please help me.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41052
    
  43
iText is a Java API. What does HTML have to do with it?
Karthik Jayachandran
Ranch Hand

Joined: Feb 18, 2009
Posts: 88



Ref.

Note: Not sure whether html style would render to pdf too.
manushree deepak
Greenhorn

Joined: Feb 12, 2009
Posts: 9
instead of giving user a static header style we allow user defined style.Please let me know whether its possible in itext or is there any other tool?
Karthik Jayachandran
Ranch Hand

Joined: Feb 18, 2009
Posts: 88

Yes it is possible in iText. Create the earlier mentioned Phrase as separate objects and then add the required styles (Fonts, size, color, etc) to the phrase objects.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41052
    
  43
Can you be more specific what a "user defined style" is? How and when is that determined and applied?
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: how i can add header to each PDF page using iText 2.7.1
 
Similar Threads
How to add image in the footer of PDF
How insert page footer in pdf when copy the pdf
JasperReport with iReport Issue. Please help.
Adding Header and Footer to an existing PDF
Itext pdf jar 5.0.6 help