Print Page | Close Window

Insert and draw Image in New PDF

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=1365
Printed Date: 05 Aug 25 at 1:26PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Insert and draw Image in New PDF
Posted By: Tim Hayes
Subject: Insert and draw Image in New PDF
Date 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.



Replies:
Posted By: Ingo
Date 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



Posted By: DELBEKE
Date Posted: 10 Mar 10 at 4:59PM
Before drawing, set origin at the top left corner
Qp.SetOrigin(1);


Posted By: Tim Hayes
Date Posted: 10 Mar 10 at 6:14PM
Both:
 
Needed Ingo's solution + Delbeke's SetOrigin(1).
 
Many thanks indeed for saving lots of hours.
 
 



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk