aspose file tools*
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 Java 8 in Action this week in the Java 8 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: 39578
    
  27
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 - updated with new look and Ping home screen widget
rakesh nadiminti
Greenhorn

Joined: Dec 25, 2012
Posts: 2
thanks for your reply..
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: itext 5 trying to add image and text to header in every page
 
Similar Threads
how to add background image, Header image, three label and three text box in JFrame
iText
Center text on an image
How to print Image on Each page
PDFBox not printing images