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!
![]() |
AppendToFile, incremental updates |
Post Reply ![]() |
Author | |
mhnejmles ![]() Beginner ![]() Joined: 10 Feb 17 Status: Offline Points: 3 |
![]() ![]() ![]() ![]() ![]() Posted: 10 Feb 17 at 1:55AM |
So, has anyone been working with incremental updates lately? I've been trying to make it work in the latest 13.11 version but to no avail. Every pdf file I append goes corrupted and is unusable in most PDF viewers. Even such a simple code like: var PDF: TDebenuPDFLibrary; res: Integer; begin PDF:= TDebenuPDFLibrary.Create; PDF.UnlockKey(const_key); res:= PDF.LoadFromFile(input_file, ''); res:= PDF.AppendToFile(input_file); PDF.Free; end; ends up destroying the pdf file. And no changes were made to it. Direct Access functions work fine but you have less functionality in it. So have anyone else encountered this?
|
|
![]() |
|
Ingo ![]() Moderator Group ![]() ![]() Joined: 29 Oct 05 Status: Offline Points: 3529 |
![]() ![]() ![]() ![]() ![]() |
Hi mhnejmles,
you should put your code into a try/finally structure to be more save. What's inside input_file? It should be always the same name. Please read the description regarding AppendToFile (then you'll know while corruption can appear): http://www.debenu.com/docs/pdf_library_reference/AppendToFile.php Here you can read about incremental updates: http://www.debenu.com/kb/incremental-updates/ Cheers and welcome here, Ingo |
|
Cheers,
Ingo |
|
![]() |
|
mhnejmles ![]() Beginner ![]() Joined: 10 Feb 17 Status: Offline Points: 3 |
![]() ![]() ![]() ![]() ![]() |
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 |
|
![]() |
|
Ingo ![]() Moderator Group ![]() ![]() Joined: 29 Oct 05 Status: Offline Points: 3529 |
![]() ![]() ![]() ![]() ![]() |
if you wanna tell about an error this is the wrong place here...
Try the official support pages in this case. |
|
Cheers,
Ingo |
|
![]() |
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