Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!

Debenu Quick PDF Library - PDF SDK Community Forum Homepage
Forum Home Forum Home > For Users of the Library > I need help - I can help
  New Posts New Posts RSS Feed - Add 300dpi image to PDF
  FAQ FAQ  Forum Search   Register Register  Login Login

Add 300dpi image to PDF

 Post Reply Post Reply
Author
Message Reverse Sort Order
byron View Drop Down
Beginner
Beginner


Joined: 15 Jun 12
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote byron Quote  Post ReplyReply Direct Link To This Post Topic: Add 300dpi image to PDF
    Posted: 14 Mar 13 at 7:37AM
Thanks for your answer.  Here is the procedure I use:

- An example of image is a jpg: 1013x1500 px with 300 dpi and 24 bits color.
- If I print this image directly from windows, it's about 85mm x 125mm.
- I have a PDF with only one A4 page. 
- I want to add this image to the page, but I must fit the real dimension when printed, that is, 85x123mm.

I use the next Delphi code:

PDFLibrary.LoadFromFile('c:\tmp\mypdf.pdf','');
idx:=PDFLibrary.AddImageFromFile('c:\tmp\myimage.jpg',0);
PDFLibrary.SelectImage(idx);
PDFLibrary.SetImageResolution(300,300,2);
hr:=((jpg.width*2.54)/10);
vr:=((jpg.Height*2.54)/10);
PDFLibrary.FitImage(0, PDFLibrary.PageHeight, hr, vr, 1, 1, 0);
PDFLibrary.SaveToFile(filename);

I'll try with PDFLibrary.DrawImage(0, PDFLibrary.PageHeight, hr, vr); too.
The image is added and render good and I open pdf and see its size is correctly on A4 page.
But the problem is If I print the image with full quality and see difference from printing the jpg image directly to printer. 
I think the problem is FitImage or Draw image reduce dpi resolution when draw.
Or pheraps I have a mistake.
Any help?

Back to Top
AndrewC View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 08 Dec 10
Location: Geelong, Aust
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote AndrewC Quote  Post ReplyReply Direct Link To This Post Posted: 13 Mar 13 at 11:01PM
Some sample code would be helpful.

Here is a link that shows the correct way to add an image to a PDF and size it correctly based on the imageWidth/Height and DPI.

http://www.quickpdf.org/forum/creating-a-multi-page-pdf-from-a-multipage-tiff_topic2125.html

The trick is to call

 int dpix = QP.ImageHorizontalResolution();  and   int dpiy = QP.ImageVerticalResolution();

as QP.ImageWidth and QP.ImageHeight return values in pixels whereas QP.DrawImage requires values in points by default (72 points = 1 inch)

Andrew.


Back to Top
byron View Drop Down
Beginner
Beginner


Joined: 15 Jun 12
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote byron Quote  Post ReplyReply Direct Link To This Post Posted: 13 Mar 13 at 1:04PM
Hello.
I want to add a jpg image to a PDF with AddImageFromFile. This image is about 1400x1200 px but with 300dpi. When I print this image is about 10x10 cm long, but If I add this image to pdf it takes all the page. 
The problem is how I say the resolution of image when adding it to pdf.
I try with FitImage and SetImageResolution, but I cann't do it.
Some help?
thanks.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.

Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. AboutContactBlogSupportOnline Store