Hi, thanks for the reply
Sorry, was working really late last night and I didn't have the strength to write everything down here. I am working with the 13.11 Delphi version of QuickPDFLibrary in Delphi Berlin 10.1.
I did go through the description and sample code based on the knowledge base topic about incremental updates to PDFs already.
I will elaborate more on the details....
So I basically copied the code structure from the sample. I was also trying to do some more with it but I came to the conclusion there might be a bug. So let's say I have a pdf file with a filepath. It's a simple pdf file I generated from a Word through Adobe PDF printer with some text in it. I wanna try to append some changes to the file. So I create a new form and a simple code:
unit Unit1; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, DebenuPDFLibrary, Vcl.StdCtrls; Const QPDFLicKey='licensekey'; type TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); private public { Public declarations } end; function QuickPDFLib_AppendToPDF(filepath: String): Boolean; var Form1: TForm1; implementation {$R *.dfm} function QuickPDFLib_AppendToPDF(filepath: String): Boolean; var PDF: TDebenuPDFLibrary; begin result:= false; PDF:= TDebenuPDFLibrary.Create; PDF.UnlockKey(QPDFLicKey); if PDF.LoadFromFile(filepath ,'') > 0 then begin if PDF.AppendToFile(filepath) > 0 then result:= true; end; end; procedure TForm1.Button1Click(Sender: TObject); var res: boolean; begin res:= QuickPDFLib_AppendToPDF('C:\pdf_work\test_pdf.pdf'); if res then ShowMessage('Success!!') else ShowMessage('Fail!!'); end; end.
And when I use the button, 'Success' message appears. But when I open the pdf file:
- in adobe reader, it gives me error 14, that the file is corrupted - in google chrome, the file won't load - tried MS Edge, the file did load there surprisingly
the code is just basic load and append nothing more when I do the same thing using Direct Access(DA) there is no problém, the pdf file saves fine. Problem is that DA doesnt have a lot of the usual functionality. At first I tried to do some more stuff with it, like add an embedded file, merge 2 documents together and the result file came out alright when I use SaveToFile function. But whenever I use AppendToFile, the result file gets corrupted. Note: the filepath always stays the same, so I am appending to the same file I open. If you don't give it the same file then the library throws an exception. I can upload the files somewhere if deemed neccessary. But I was kinda curious whether anyone else has encountered this.
Hope it is somewhat understandable, mhnejmles
|