Print Page | Close Window

Scanning

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=636
Printed Date: 18 Sep 25 at 12:44AM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Scanning
Posted By: bb46970
Subject: Scanning
Date Posted: 11 Feb 07 at 5:39PM

Up until now, I just have been using QuickPDF for printing.  Now, I want to scan documents and save them as PDFs.  I am able to scan the documents as bitmaps, without a problem.  To add the image, I have tried  "QP.AddImageFromStream."  I also tried saving the bitmap as a file and then call "QP.AddImageFromFile."  The bitmap file is correct.  To draw the image, I have tried both "QP.DrawScaledImage" and "QP.DrawImage."  I have also varied the parameters, with each of the methods.  The PDF file size indicates that the bitmap is saved to the PDF; however, the only part that is visible a black border at the bottom of the scanned page.  I am able to add text, to the same PDF, with QP.DrawText, without a problem.

Thanks
David



Replies:
Posted By: Ingo
Date Posted: 12 Feb 07 at 1:51AM
Hi!

I've no problems with these functions.
Perhaps you should try SetOrigin and/or SetMeasurementUnits...
Posting a code-snippet here could be helpful to help ;-)

Best regards,
Ingo



Posted By: bb46970
Date Posted: 12 Feb 07 at 2:12AM
I have a lot of commented-out code, because I was trying so many different things.  Basically, I got down to this:
 
Image.SaveToFile('test.bmp');
iID := QP.AddImageFromFile('test.bmp', 0);
if iID <> 0 then
  begin
    QP.SetTransparency(0);
    QP.SelectImage(iID);
    QP.DrawText(100, 500, 'Page 1');
    QP.NewPage();
    QP.DrawScaledImage(0, 0, 1);
    QP.SaveToFile('test.pdf');
  end;
 
After you post, I added:
     QP.SetOrigin(1);
which got the image to draw.
However, the sizing was off.  I added:
     QP.SetMeasurementUnits(2);
and changed DrawScaledImage to:
     QP.DrawImage(0, 0, 8.5, 11);
It seems to work now.
 
Thanks.

 


Posted By: ukobsa
Date Posted: 12 Feb 07 at 3:12AM
Hi,

just a small explanation: default setting for QuickPDF is to have it's origin on bottom-left. DrawImage uses as position the top-left corner of the image. So when you draw an image at position (0,0) it is drawn completely outside the page (exactly: below the page).
SetOrigin(1) now sets QuickPDFs origin to top-left so that now drawing an image at (0,0) starts to draw it in the top-left corner of the page.


HTH,
Ulrich



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