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 - How do I use QuickPDF in Lazarus?
  FAQ FAQ  Forum Search   Register Register  Login Login

How do I use QuickPDF in Lazarus?

 Post Reply Post Reply
Author
Message
RedOctober2018 View Drop Down
Team Player
Team Player
Avatar

Joined: 22 Jun 18
Location: West
Status: Offline
Points: 25
Post Options Post Options   Thanks (0) Thanks(0)   Quote RedOctober2018 Quote  Post ReplyReply Direct Link To This Post Topic: How do I use QuickPDF in Lazarus?
    Posted: 13 May 19 at 3:11AM
I remember reading about how to do this in one of the QuickPDF manuals but cannot find it now.  It was just a short one page instruction that showed what to include in the USES clause, and how to create the QuickPDF object, and unlock it, ready for use.  That is what I need now.

Task:
Convert old Delphi X3 application to Lazarus 1.8.4  The old app uses QuickPDF v10.13 extensively.


Current Progress:
I was able to successfully register both the 32 bit and 64 bit DLLs using the following .bat file:

<pre>
c:
cd\
cd "C:\Program Files (x86)\Debenu\PDF Library\ActiveX"
echo.
regsvr32 DebenuPDFLibraryAX1013.dll
echo.
cd\
cd "C:\Windows\SysWOW64"
regsvr32 "C:\Program Files (x86)\Debenu\PDF Library\ActiveX\DebenuPDFLibrary64AX1013.dll"
echo.
</pre>


OS Platform:
Windows Server 2016

QuickPDF is a great product and I want to use it in the newly converted app, so as to give our customer the same .pdf viewing experience and minimize the conversion pain on me and my dev team.

Thanks in advance to anyone who can provide some help.






Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3524
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 13 May 19 at 8:02AM
Hi,


here's a link to a piece of Lazarus-code to have a look on:
http://www.quickpdf.org/forum/freepascal-lazarus-and-quickpdf_topic1825.html

If you're using the dll-version of QuickPDF there shouldn't raise problems as well.

Cheers,
Ingo

Back to Top
RedOctober2018 View Drop Down
Team Player
Team Player
Avatar

Joined: 22 Jun 18
Location: West
Status: Offline
Points: 25
Post Options Post Options   Thanks (0) Thanks(0)   Quote RedOctober2018 Quote  Post ReplyReply Direct Link To This Post Posted: 13 May 19 at 2:56PM
Hi, Thanks Ingo.  I saw that thread during my most recent search for an answer to my question.  However, I do remember there was a different code snippet in an official QuickPDF manual that was more recent than that 2011 thread.  I recall it did not use a variant.  It used an ActiveX instead.  It's the usage of QuickPDF under ActiveX I guess I shd be looking for.
Back to Top
RedOctober2018 View Drop Down
Team Player
Team Player
Avatar

Joined: 22 Jun 18
Location: West
Status: Offline
Points: 25
Post Options Post Options   Thanks (0) Thanks(0)   Quote RedOctober2018 Quote  Post ReplyReply Direct Link To This Post Posted: 13 May 19 at 3:49PM
I followed the instructions here and got the ActiveX component to install into the tool bar.

http://wiki.lazarus.freepascal.org/LazActiveX
Back to Top
RedOctober2018 View Drop Down
Team Player
Team Player
Avatar

Joined: 22 Jun 18
Location: West
Status: Offline
Points: 25
Post Options Post Options   Thanks (0) Thanks(0)   Quote RedOctober2018 Quote  Post ReplyReply Direct Link To This Post Posted: 13 May 19 at 9:54PM
Still having a problem.  I was able to install the ActiveX wrapper to create a component for QuickPDF, but I'm unable to get it to render to a TImage.  The component loads the file (I proved it by saving to a file with a different name), but it refuses to render to my TImage so I can see it.  My Image component is always blank.



Here is my code:

function TfrmMain.TempRenderPDFPage(const qwkpdf_axl: TAxcPDFLibrary; const fnm: String; const img: TImage; const sbx: TScrollBox; const pg: Integer; const zm: Integer; var err_msg: String): Boolean;
var
  vch: Variant;  // Variant containing the Canvas Handle
  bmp: TBitmap;
  dpi: Integer;
begin
  Result := True;
  err_msg := '';

  if not UnlockedOK(qwkpdf_axl) then  // Unlock always works
    begin
      Result := False;
      err_msg := 'Unable to unlock QuickPDF ActiveX';
      Exit;
    end;

  ReleasePdfImg(img);  // This just sets the image picture.bitmap to null

  dpi := 92;

  if Assigned(qwkpdf_axl) then
    begin
      bmp := nil;
      try
        bmp := TBitmap.Create;
        img.Picture.Assign(bmp);
        vch := bmp.Canvas.Handle;

        Result := (qwkpdf_axl.OleServer.LoadFromFile(fnm, '') = 1);
        if not Result then
          begin
            err_msg := 'Unable to load PDF Viewer from file: ' + fnm;
            Exit;
          end;

        Result := (qwkpdf_axl.OleServer.RenderPageToDC(dpi, pg, vch) = 1);
        img.Canvas.Draw(0, 0, bmp);  // Not sure if this is correct.  The example just says "Canvas.Draw" as if it's referring to the main form, but that didn't work, so I'm trying img.Canvas, but that doesn't work either.
        if not Result then
          begin
            err_msg := 'Unable to render image from QuickPDF ActiveX';
            Exit;
          end;
      finally
        bmp.Free;
      end;
    end;
end;

Back to Top
RedOctober2018 View Drop Down
Team Player
Team Player
Avatar

Joined: 22 Jun 18
Location: West
Status: Offline
Points: 25
Post Options Post Options   Thanks (0) Thanks(0)   Quote RedOctober2018 Quote  Post ReplyReply Direct Link To This Post Posted: 14 May 19 at 12:41AM
I found that the problem is that the bmp must be given a width and height or else it's zero for both and nothing will be drawn.  

http://wiki.freepascal.org/Developing_with_Graphics#Working_with_TBitmap_and_other_TGraphic_descendents

Now working on trying to get the TBitmap height and width to accept the width and height of the page in the .Pdf file.  (one is long, the other is a double)
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