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!
![]() |
access violations merging PDFs |
Post Reply ![]() |
Author | |
pdsdev ![]() Beginner ![]() Joined: 11 May 16 Location: FL Status: Offline Points: 10 |
![]() ![]() ![]() ![]() ![]() Posted: 11 May 16 at 8:42PM |
seems i can use MergeList or MergeListFast for 2 files but when i add a third file i get an access violation.
it also fails the second time i call the procedure even with 2 files. basically, i get 1 call - for 2 files only. 3 files on the first call or a 2nd call fails. and it only AVs on the actual Merge call... any ideas would be appreciated... btw - i get the same errors trying to use the activeX component - merge 2 files ok, 2nd merge fails. here's my code... procedure TMainForm.Merge1Click(Sender: TObject); var done : boolean; fn1, fn2, ftmp, savename, listname :string; zz, i, ures : Integer; dqpl : TDebenuPDFLibrary1212; begin savedlg.Title := 'Enter Your Save File Name'; savedlg.Execute; savename := savedlg.FileName; if savename = '' then exit; if pos('.PDF',Uppercase(savename)) = 0 then savename := savename +'.PDF'; // open file - get first file opendlg.Title := 'Select your initial PDF file to merge '; opendlg.execute; fn1 := opendlg.FileName; if fn1='' then exit; listname:= 'mergeList'; dqpl := TDebenuPDFLibrary1212.Create(); ures:= dqpl.UnlockKey('key here'); if ures = 1 then begin DQPL.ClearFileList(listname); DQPL.AddToFileList(listname,fn1); done := false; // loop opendlg.Title := 'Select the PDF file to append '; while not done do begin // open file get next opendlg.FileName :=''; opendlg.Execute; opendlg.Title := 'Select the PDF next file to append '; fn2:= opendlg.FileName; DQPL.AddToFileList(listname,fn2); // continue/done if MessageDlg( 'Done?' ,mtconfirmation,[mbYes,mbNo],0) = mrYes then Done := true; end; DQPL.MergeFileListFast(listname,savename); dqpl.free; end; end; |
|
![]() |
|
Ingo ![]() Moderator Group ![]() ![]() Joined: 29 Oct 05 Status: Offline Points: 3529 |
![]() ![]() ![]() ![]() ![]() |
Hi,
it's not easy to read your code... If you don't select an initial file you'll leave the routine without a free on dqpl. Access violation means that your code has still access to objects when you start it a second time. You should use a try...finally...end. In finally you should post your free. |
|
Cheers,
Ingo |
|
![]() |
|
pdsdev ![]() Beginner ![]() Joined: 11 May 16 Location: FL Status: Offline Points: 10 |
![]() ![]() ![]() ![]() ![]() |
that was a wasted post - i told you it fails the first time with more than 2 files in the list. before i ever get to the free. i just added that it also fails the second time through hoping that mightgive you more info. i step through it and each part executes til the merge - then access viol. when i test the 2 passes - it does do the free. doesn't matter. is there some kind of clear or release that i need to do?? is there any kind of restriction on the file list - they are all fully qualified file names (including the directories). sal |
|
![]() |
|
Ingo ![]() Moderator Group ![]() ![]() Joined: 29 Oct 05 Status: Offline Points: 3529 |
![]() ![]() ![]() ![]() ![]() |
Hi,
first i've thought i shouldn't waste my free time here but ... Here's a sample from Wilbur: http://www.quickpdf.org/forum/problem-with-mergefilelistfast-in-delphi_topic3309_post13174.html?KW=MergeFileListFast#13174 Here's another sample: http://www.quickpdf.org/forum/how-to-use-this-function_topic2087.html Something relevant from the kb: http://www.debenu.com/kb/merge-pdf-files-together-programmatically/ On page 28/29 of the developer guide you'll find a working sample, too. But first you should clean and restructure your code ;-) The functionality is an old one - so you can be sure that the prob isn't the lib. To find the prob you should always look what's the content of your variables. After each call you should check if the call was okay or not. Additionally there's the function LastErrorCode. ... A lot you can do ... |
|
Cheers,
Ingo |
|
![]() |
|
pdsdev ![]() Beginner ![]() Joined: 11 May 16 Location: FL Status: Offline Points: 10 |
![]() ![]() ![]() ![]() ![]() |
it appears the code works fine - ugly as it might be...
i can merge as many PDFs as i like of %PDF-1.4 or %PDF-1.5 but no more than 2 of %PDF-1.3 - which appears to corrupt the instance and cause access violations. they display fine and i can add annotations and post text to them but not merge them. guess we can't be too sure the problem isn't in the lib. any suggestions? |
|
![]() |
|
pdsdev ![]() Beginner ![]() Joined: 11 May 16 Location: FL Status: Offline Points: 10 |
![]() ![]() ![]() ![]() ![]() |
here's a bit more info -
as long as the first document isn't a 1.3 - it appears that i can include as many 1.3s that i want - |
|
![]() |
|
Ingo ![]() Moderator Group ![]() ![]() Joined: 29 Oct 05 Status: Offline Points: 3529 |
![]() ![]() ![]() ![]() ![]() |
Here were some problems in the fast regarding MergeFileList but that the pdf-specs-version shall be the reason???
Anyway i'm asking me what can be the sense of different encryptions if it's all merged together? So before merging a pdf you should reset the encryption: If ( QP.EncryptionStatus > 0 ) Then QP.Decrypt; |
|
Cheers,
Ingo |
|
![]() |
|
pdsdev ![]() Beginner ![]() Joined: 11 May 16 Location: FL Status: Offline Points: 10 |
![]() ![]() ![]() ![]() ![]() |
thanks, i'll try that and see if it makes a difference.
sal
|
|
![]() |
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