You need to look into the PdfPageEventHelper of iTextSharp. It provides a method called OnEndPage that allows such things. Basically, treat the image as being in the header or footer of the document, and use absolute positioning to put it where you want,
instead of just in the flow of the page content.
Mark all posts that give the desired result the answer. If you only mark the last that gave you clarification because you misread an earlier post others will be confused. Some of us are here to help others and our point to post ratio matters.
Do you get any specific error? And this is definitely a typo:
(@"C:\\intepub\\wwwroot\\img\\Logo.jpg")
Should be inetpub. And you should access files like this:
Server.MapPath("~/img/logo.jpg")
Mark all posts that give the desired result the answer. If you only mark the last that gave you clarification because you misread an earlier post others will be confused. Some of us are here to help others and our point to post ratio matters.
Member
389 Points
965 Posts
Add logo image for each page on pdf file created by iTextSharp in c#
Aug 11, 2016 12:06 PM|cms9651|LINK
Hi there, hope in your help.
I have been trying to add an image to all pages using iTextSharp Library.
The below code correctly it inserted all information from asp Panel "on Print" but only inserts an image in the first page.
Is there any way to insert the image in the same way in all pages?
Can you help me ?
Thank you in advance.
Cheers,
Chevy Mark Sunderland
Contributor
7048 Points
2189 Posts
Re: Add logo image for each page on pdf file created by iTextSharp in c#
Aug 11, 2016 01:17 PM|ryanbesko|LINK
You need to look into the PdfPageEventHelper of iTextSharp. It provides a method called OnEndPage that allows such things. Basically, treat the image as being in the header or footer of the document, and use absolute positioning to put it where you want, instead of just in the flow of the page content.
http://stackoverflow.com/questions/2321526/pdfptable-as-a-header-in-itextsharp/2326193#2326193
Member
389 Points
965 Posts
Re: Add logo image for each page on pdf file created by iTextSharp in c#
Aug 11, 2016 01:35 PM|cms9651|LINK
Thank you for help, but in my case don't worked : the file pdf can't opened.
My new code :
Cheers,
Chevy Mark Sunderland
Contributor
7048 Points
2189 Posts
Re: Add logo image for each page on pdf file created by iTextSharp in c#
Aug 11, 2016 02:10 PM|ryanbesko|LINK
Do you get any specific error? And this is definitely a typo:
(@"C:\\intepub\\wwwroot\\img\\Logo.jpg")
Should be inetpub. And you should access files like this:
Server.MapPath("~/img/logo.jpg")
Member
389 Points
965 Posts
Re: Add logo image for each page on pdf file created by iTextSharp in c#
Aug 12, 2016 06:59 AM|cms9651|LINK
Hi, I don't have error only pdf file can't opened because file not supported.
I have tried modified code without success because the output not change : only inserts an image in the first page:
Cheers,
Chevy Mark Sunderland