Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > itextsharp pdf generation, insert image header.

Reply
Thread Tools

itextsharp pdf generation, insert image header.

 
 
guoqi zheng
Guest
Posts: n/a
 
      11-30-2005
dear sir,

I am using itextShap for pdf generation.
I know I can insert image into it, I can add header to it as well. However,
I can not add an image as a header.

Does any one has experience with it and know how to insert an image header
to the pdf file?

This image is our company logo which we would like it to appear on every
page on that pdf file.

regards,

Guoqi Zheng
http://www.ureader.com
 
Reply With Quote
 
 
 
 
Patrick.O.Ige
Guest
Posts: n/a
 
      12-01-2005
You can Guogi trying going though the docs at:-
http://itextsharp.sourceforge.net/
Hope that helps
Patrick

"guoqi zheng" <> wrote in message
news:. ..
> dear sir,
>
> I am using itextShap for pdf generation.
> I know I can insert image into it, I can add header to it as well.

However,
> I can not add an image as a header.
>
> Does any one has experience with it and know how to insert an image header
> to the pdf file?
>
> This image is our company logo which we would like it to appear on every
> page on that pdf file.
>
> regards,
>
> Guoqi Zheng
> http://www.ureader.com



 
Reply With Quote
 
 
 
 
guoqi zheng
Guest
Posts: n/a
 
      12-01-2005
I have read through them, and did not find it..

It is possible to insert text header but not image header.

regards,

Guoqi Zheng
http://www.ureader.com
 
Reply With Quote
 
santhoshkumar.yes santhoshkumar.yes is offline
Junior Member
Join Date: May 2011
Posts: 1
 
      05-11-2011
We cant add image directly to the Pdf Header and Footer.. There is an alternate way to add the Image File... Try the following code and chill..

Document docPDF = new Document(PageSize.A4, 5, 5, 20, 50);

Step 1: Add the Image file
strImgPath is refer the directory Info..

Image imgLogo = Image.GetInstance(strImgPath.ToString()+"\\CompWar e.Jpg");
imgLogo.Alignment = Image.ALIGN_CENTER;
imgLogo.ScalePercent(50f);

Step 2:

Add this ImgLogo to the PdfPTable by use of this
PdfPCell pdfcellImage = new PdfPCell(imgLogo, true);
pdfcellImage.FixedHeight = 40f;
pdfcellImage.HorizontalAlignment = Element.ALIGN_CENTER;
pdfcellImage.VerticalAlignment = Element.ALIGN_CENTER;
pdfcellImage.Border = Rectangle.NO_BORDER;
pdfcellImage.Border = Rectangle.NO_BORDER;
pdftblImage.AddCell(pdfcellImage);

Step 3:

Create Chunck to add Text for address or others
fntBoldComHd is a Base Font Library Object

Chunk chnCompany = new Chunk("Your CompanyName\nAddress", fntBoldComHd);

Step 4:

Create Phrase For add the Chunks and PdfPTables

Phrase phHeader = new Phrase();

phHeader.Add(pdftblImage);
phHeader.Add(chnCompany);

Step 5:

Assign the Phrase to PDF Header
HeaderFooter header = new HeaderFooter(phHeader, false);
header.Border = Rectangle.NO_BORDER;
header.Alignment = Element.ALIGN_CENTER;
docPDF.Header = header;

Bye
Santhosh Kumar Subramaniam
 
Reply With Quote
 
Levitikon Levitikon is offline
Junior Member
Join Date: Oct 2011
Posts: 1
 
      10-13-2011
Santhosh, I would like to say your code is useful, but there is a undeclared variable.

pdftblImage, at the bottom of step 2. How and where is it instantiated?
 

Last edited by Levitikon; 10-13-2011 at 05:50 PM..
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using itextsharp to generate pdf from asp.net =?Utf-8?B?U2Vhbg==?= ASP .Net 5 07-16-2008 01:03 PM
Pdf generation by iTextSharp library Viswagreypad Software 2 10-24-2007 06:55 AM
Problem sending PDF as stream using iTextSharp antonyliu2002@yahoo.com ASP .Net 5 07-11-2007 08:12 PM
Creating PDF in ASP.NET - iTextSharp Neven Klofutar ASP .Net 1 05-10-2007 09:42 PM
Using iTextSharp for PDF Creation... Nique ASP .Net 0 08-17-2004 10:23 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57