wood burning stoves 2.0*
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 OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP 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: 42371
    
  64
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