This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Other Open Source Projects and the fly likes itext 5 trying to add image and text to header in every page 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 "itext 5 trying to add image and text to header in every page" Watch "itext 5 trying to add image and text to header in every page" New topic
Author

itext 5 trying to add image and text to header in every page

rakesh nadiminti
Greenhorn

Joined: Dec 25, 2012
Posts: 2
Hi everyone,

i am trying to add an image and text to the header of each and every page.

for adding simple text in to header. earlier i tried creating with below lines of code:

String final_header = "hello"+" "+writer.getPageNumber();

ColumnText.showTextAligned(writer.getDirectContent(), Element.ALIGN_RIGHT, new Phrase(String.format("%s", final_header),FooterFont), (document.right() - document.left()) / 2 + document.leftMargin(), document.top() + 10, 0);


and the output is like " hello 1" on the first page. it works fine.

but now i am trying to add an image and page number to the header.

it would be really greatful if any one share experience on the same.

thanks
rakesh
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41052
    
  43
See https://www.coderanch.com/how-to/java/ItextExample for how to create headers and footers. By the way, you're aware that itext 5 requires you obtain a paid license for just about any commercial use, yes? (Unless you want to distribute the source code of your app widely.)


Ping & DNS - my free Android networking tools app
rakesh nadiminti
Greenhorn

Joined: Dec 25, 2012
Posts: 2
thanks for your reply..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: itext 5 trying to add image and text to header in every page
 
Similar Threads
PDFBox not printing images
How to print Image on Each page
how to add background image, Header image, three label and three text box in JFrame
Center text on an image
iText