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 - Insert and draw Image in New PDF
  FAQ FAQ  Forum Search   Register Register  Login Login

Insert and draw Image in New PDF

 Post Reply Post Reply
Author
Message
Tim Hayes View Drop Down
Beginner
Beginner


Joined: 16 Feb 07
Status: Offline
Points: 7
Post Options Post Options   Thanks (0) Thanks(0)   Quote Tim Hayes Quote  Post ReplyReply Direct Link To This Post Topic: Insert and draw Image in New PDF
    Posted: 10 Mar 10 at 4:01PM
Sorry this is a basic question...
 
I want to be able to draw an image (jpg) in a new PDF document.
 
    OPDF := TiSEDQuickPDF.create;
    OPDF.UnlockKey('...');
    OPDF.Unencrypt;
    OPDF.UseUnsafeLayers(1);
    OPDF.SelectDocument(OPDF.NewDocument);
    OPDF.AddJPEGImageFromFile('aaa.jpg');
    OPDF.DrawImage(0,0,OPDF.ImageWidth,OPDF.ImageHeight);
    OPDF.SaveToFile('NewPDF.pdf');
The resultant PDF file contains just a blank page.
 
Could anyone please help??
 
Thanks.
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3530
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 10 Mar 10 at 4:48PM
Hi Tim!

Try this one:
// . . .
   QP := TQuickPDF.Create;
   try
       QP.UnlockKey('...');
       image := QP.AddImageFromFile(fstring, 0);
       QP.SetOrigin(1); //   :-))
       QP.SelectImage(image);
       QP.SetPageDimensions(QP.ImageWidth,QP.ImageHeight);
       QP.DrawImage(0,0,QP.ImageWidth,QP.ImageHeight);
       QP.SaveToFile('c:\temp\test.pdf');
   finally
       QP.Free;
   end;
// . . .

Cheers, Ingo



Edited by Ingo - 10 Mar 10 at 5:08PM
Back to Top
DELBEKE View Drop Down
Debenu Quick PDF Library Expert
Debenu Quick PDF Library Expert
Avatar

Joined: 31 Oct 05
Location: France
Status: Offline
Points: 151
Post Options Post Options   Thanks (0) Thanks(0)   Quote DELBEKE Quote  Post ReplyReply Direct Link To This Post Posted: 10 Mar 10 at 4:59PM
Before drawing, set origin at the top left corner
Qp.SetOrigin(1);
Back to Top
Tim Hayes View Drop Down
Beginner
Beginner


Joined: 16 Feb 07
Status: Offline
Points: 7
Post Options Post Options   Thanks (0) Thanks(0)   Quote Tim Hayes Quote  Post ReplyReply Direct Link To This Post Posted: 10 Mar 10 at 6:14PM
Both:
 
Needed Ingo's solution + Delbeke's SetOrigin(1).
 
Many thanks indeed for saving lots of hours.
 
 
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