iTextSharp renders image with poor quality in PDF

Posted by Sebastian on Stack Overflow See other posts from Stack Overflow or by Sebastian
Published on 2010-03-26T15:11:48Z Indexed on 2010/03/26 15:13 UTC
Read the original article Hit count: 1009

Filed under:
|
|

Hello,

I'm using iTextSharp to print a PDF document. Everything goes ok until I have to print the company logo in it.

First I noticed that the logo had poor quality, but after testing with several images, I realize that was the iTextSharp rendering it poorly. The test I did to say this was to print the PDF using my code and then edit the document with Acrobat 8.0 and I drew an image. Then printed the two documents and saw the noticeable difference. My question is that if anyone know if this can be due to a scaling problem where I'm failing to tell iTextSharp how it must render the image or is an iTextSharp limitation.

The code to render the image is the following:

            Dim para As Paragraph = New Paragraph
            para.Alignment = Image.RIGHT_ALIGN
            para.Add(text)

            Dim imageFile As String = String.Format("{0}{1}", GetAppSetting("UploadDirectory"), myCompany.LogoUrl)

            Dim thisImage As Image = Image.GetInstance(imageFile)
            thisImage.Alignment = Image.LEFT_ALIGN

            para.Add(thisImage)

The printed images are the following: alt text

Image printed directly with iTextSharp

alt text

Image edited and printed with Acrobat 8

Please let me know if I need to provide more info. Thanks

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about vb.net