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!
![]() |
How do I use QuickPDF in Lazarus? |
Post Reply ![]() |
Author | |
RedOctober2018 ![]() Team Player ![]() ![]() Joined: 22 Jun 18 Location: West Status: Offline Points: 25 |
![]() ![]() ![]() ![]() ![]() 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. |
|
![]() |
|
Ingo ![]() Moderator Group ![]() ![]() Joined: 29 Oct 05 Status: Offline Points: 3529 |
![]() ![]() ![]() ![]() ![]() |
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 |
|
![]() |
|
RedOctober2018 ![]() Team Player ![]() ![]() Joined: 22 Jun 18 Location: West Status: Offline Points: 25 |
![]() ![]() ![]() ![]() ![]() |
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.
|
|
![]() |
|
RedOctober2018 ![]() Team Player ![]() ![]() Joined: 22 Jun 18 Location: West Status: Offline Points: 25 |
![]() ![]() ![]() ![]() ![]() |
I followed the instructions here and got the ActiveX component to install into the tool bar.
http://wiki.lazarus.freepascal.org/LazActiveX |
|
![]() |
|
RedOctober2018 ![]() Team Player ![]() ![]() Joined: 22 Jun 18 Location: West Status: Offline Points: 25 |
![]() ![]() ![]() ![]() ![]() |
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; |
|
![]() |
|
RedOctober2018 ![]() Team Player ![]() ![]() Joined: 22 Jun 18 Location: West Status: Offline Points: 25 |
![]() ![]() ![]() ![]() ![]() |
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) |
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |
Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. About — Contact — Blog — Support — Online Store