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!
Image to PDF |
Post Reply |
Author | |
skwirelboy
Team Player Joined: 27 Feb 06 Status: Offline Points: 45 |
Post Options
Thanks(0)
Posted: 27 Feb 06 at 1:13PM |
I want to add convert a tiff to a pdf (ok I guess I'm not converting but just embedding). I'm using Delphi and here's what I have so far: QP := TiSEDQuickPDF.Create; qp.SaveToFile('c:\pdf.pdf'); This is as far as I've got. I have a saved file which is roughly the size of the image I'm inserting, but when you open it it is blank. I've tried setting selectPage to 1 as well as 0, but to no avail. If anyone can give me any pointers I'd be much obliged.
Thanks,
Mark
|
|
chicks
Debenu Quick PDF Library Expert Joined: 29 Oct 05 Location: United States Status: Offline Points: 251 |
Post Options
Thanks(0)
|
RTFM
AddImageFromFile() returns an image ID, you then need to use SelectImage() with that ID, finally DrawScaledImage() Also, the second argument to AddImageFromFile() is normally 0, unless dealing with multi-page TIFFs. Your example also shows reading image data from a non-initialized stream. |
|
skwirelboy
Team Player Joined: 27 Feb 06 Status: Offline Points: 45 |
Post Options
Thanks(0)
|
Thanks for reply. I'm actually loading from stream, but thought it easier from my example if I showed it as being loaded from file. I've tried selectimage, but still don't seem to be getting anywhere (ie blank pdf, yet roughly same size as the tiff file). My code now is: QP := TiSEDQuickPDF.Create; Stream.Position:=0; QP.SelectImage(QP.AddImageFromStream(stream, 0)); QP.SaveToFile('c:\pdf.pdf'); The stream is initialised although the example doesn't show the code and the stream contains a valid tif (tested at end of process by saving to a file). I'm not sure to what SelectPage should be set (ie whether 0 based index), but I;ve tried both as 0 and 1 and same result. Any ideas why the above doesn't work? Thanks in advance. Mark |
|
chicks
Debenu Quick PDF Library Expert Joined: 29 Oct 05 Location: United States Status: Offline Points: 251 |
Post Options
Thanks(0)
|
Try checking ALL return codes from QP functions, might be something as simple as a mis-typed key, etc.
Also, QP has problems with some images, though it's mostly a rendering issue, not embedding, in my experience. Added: Just noticed that you're positioning the image at top,left=1,1. Note that the origin is the bottom left corner unless you specify otherwise, so your image is probably being embedded, but its top is just at the bottom of the screen. See the SetOrigin() function. Edited by chicks |
|
skwirelboy
Team Player Joined: 27 Feb 06 Status: Offline Points: 45 |
Post Options
Thanks(0)
|
Thanks again. I've added setOrigin. Drawing a scaled image was also failing for me, although I have no idea why. I've changed to DrawImage, but I'm setting the dimensions of the page first so that they match the image dimensions and this seems to do the trick perfectly. Many thanks for your help. Don't think I would have got there without it. Cheers, Mark |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |
Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. About — Contact — Blog — Support — Online Store