image problem in pdf using itextsharp

Discussion in 'Third-party applications' started by priyankafanse, May 16, 2011.

  1. Hello everyone,

    I am developing desktop application in in that i am creating pdf using third party dll itextsharp.its working i inserted image in that after scaling.but my image quality is is getting blurred.after scaling it is stored in one folder and from that i am inserting into pdf.i search many sites for this problem of getting blur.i could not found any answer.the code snippet is as follows:

    public void PrintFormDataPreview(int width, int Height, string HeaderLoc,int flag)
    float height;
    printGen.NewPageStart(cb, 1);
    height = cb.PdfDocument.PageSize.Height;
    iTextSharp.text.Image img = iTextSharp.text.Image.GetInstance(printGen.headerLogoPreview);
    float h = img.Height;
    float w = img.Width;


    img.SetDpi(72, 72);


    catch (Exception err)
    XGlobals.WriteToLogFile("PrintFormDataPreview()_PrintMarksheet :" + err.Message + "::" + err.StackTrace);
    if u find any answer to this.please reply me its urgent.i have send pdf namely complete marksheet for your reference.the image on the top of it is getting blurred.
    Thanks in advance.....:)
  2. Ray


    I'm a little confused. Let me see if I understand you correctly. You have a desktop application. When you embed the the image to a .pdf file it gets blurred. Am I understanding you correctly? If that is the case why even embed the file to a pdf. PDF really does not do well rendering images in the first place.
  3. Thanks Ray for replying me.

    You have correctly understood my problem, image is getting blurred after being inserted in to pdf.I have tried to set dpi for it but there is no change in the quality of the image. In fact no effects at all.Suggest me the solution.
  4. A 72dpi image is prone to fuzziness when you put it into print media like a pdf. Try a test with a higher resolution image (like 300dpi) and see if you get better results.

Share This Page