Do you own a Quick PDF Library 7 or iSEDQuickPDF license? Upgrade to Quick PDF Library 8 today!

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
Online Status: Offline
Posts: 7
Post Options Post Options   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
Online Status: Offline
Posts: 1684
Post Options Post Options   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
Quick PDF Library Expert
Quick PDF Library Expert
Avatar

Joined: 31 Oct 05
Location: France
Online Status: Offline
Posts: 151
Post Options Post Options   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
Online Status: Offline
Posts: 7
Post Options Post Options   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

Forum Jump Forum Permissions View Drop Down

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