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!
![]() |
Merging pdf files produces unexpected results |
Post Reply ![]() |
Author | |
Mel ![]() Beginner ![]() ![]() Joined: 30 Aug 13 Status: Offline Points: 7 |
![]() ![]() ![]() ![]() ![]() Posted: 02 Sep 13 at 9:31AM |
Hi,
we have a VB6 application that merges a series of invoice pdf files with their corresponding delivery notes. Both invoice and delivery note information are stored in sql server tables along with their file names. We recently found out that the content of some pdf files resulting from the merge operation are not related to the supplier the invoice record refers to. It seems like the merge operation has failed to merge the correct files. Here's the pseudo-code we use with the ActiveX v.7.21 of the library: <Open resultset RS> If RS.EOF Then <Exit Function> End If On Error Resume Next Set QuickPDF = CreateObject("QuickPDFAX0721.PDFLibrary") If err.Number <> 0 Then <Error handling> End If On Error GoTo 0 If QuickPDF.UnlockKey("...") = 0 Then <Error handling> End If ... If QuickPDF.AddToFileList(FileListName, <FileName>) = 0 Then <Error handling> End If ... If QuickPDF.AddToFileList(FileListName, <FileName>) = 0 Then <Error handling> End If RS.MoveNext While Not RS.EOF If <Key changes> Then MergedFilesCount = QuickPDF.MergeFileList(FileListName, <FileName>) If MergedFilesCount < QuickPDF.FileListCount(FileListName) Then If MergedFilesCount = 0 And QuickPDF.FileListCount(FileListName) > 1 Then ... Else ... End If <Error handling> End If If QuickPDF.ClearFileList(FileListName) = 0 Then <Error handling> End If If QuickPDF.AddToFileList(FileListName, <FileName>) = 0 Then <Error handling> End If End If If QuickPDF.AddToFileList(FileListName, <FileName>) = 0 Then <Error handling> End If RS.MoveNext Wend MergedFilesCount = QuickPDF.MergeFileList(FileListName, <FileName>) If MergedFilesCount < QuickPDF.FileListCount(FileListName) Then If MergedFilesCount = 0 And QuickPDF.FileListCount(FileListName) > 1 Then ... Else ... End If <Error handling> End If Do you know of any situation where the methods AddToFileList, MergeFileList, ClearFileList do not work properly ? |
|
![]() |
|
AndrewC ![]() Moderator Group ![]() ![]() Joined: 08 Dec 10 Location: Geelong, Aust Status: Offline Points: 841 |
![]() ![]() ![]() ![]() ![]() |
1. Firstly I would suggest downloading the 7.26 version to see if the problem resolves itself. 7.26 is a free upgrade for all 7.xx license key holders.
http://www.quickpdflibrary.com/downloads/binaries/qp/oldversions/0726/quick_pdf_library726.exe 2. I have seen some very corrupt PDF files where even Acrobat displays the wrong page. The PDF has copies of data for 3 pages but only reports 1 page existing in the file. If you still have a problem you would need to manually extract the problem PDF files to disk and create a support ticket by emailing the files and a problem description to support@debenu.com Andrew. |
|
![]() |
|
Mel ![]() Beginner ![]() ![]() Joined: 30 Aug 13 Status: Offline Points: 7 |
![]() ![]() ![]() ![]() ![]() |
Hi Andrew,
we are trying to add some code to our application
to check the pdf files resulting from a merge operation. We are thinking of
attaching a sort of tag to all individual files to be
merged
before the actual merge operation takes place and
looking for these tags in the resulting pdf file. Do you know what kind of tag (information) we can
write in the original pdf files ?
Or do you have a better idea on how to check the
resulting pdf file for the content of the original files ?
We really look forward to your help.
Regards |
|
![]() |
|
Ingo ![]() Moderator Group ![]() ![]() Joined: 29 Oct 05 Status: Offline Points: 3529 |
![]() ![]() ![]() ![]() ![]() |
Hi Mel!
Have a look at the StoreCustomDataFrom...-functions: They're offering personal metadata for you. Cheers, Ingo
|
|
Cheers,
Ingo |
|
![]() |
|
Wheeley ![]() Senior Member ![]() ![]() Joined: 30 Oct 05 Location: United States Status: Offline Points: 146 |
![]() ![]() ![]() ![]() ![]() |
I you looked at MergeFileListFast. It gives back a list which states which files could be merged.
Wheeley |
|
![]() |
|
Mel ![]() Beginner ![]() ![]() Joined: 30 Aug 13 Status: Offline Points: 7 |
![]() ![]() ![]() ![]() ![]() |
Thank you for your suggestions,
but I need to write some information on all files to be merged that I would find in the resulting pdf file. For instance Set Info1 on File1 Set Info2 on File2 MergeFileList File1 & File2 into FileMerge Get Info1 from FileMerge would succeed Get Info2 from FileMerge would succeed Is there any information I can write into File1 & File2 that MergeFileList retains in FileMerge ? I tested the Set/GetCatalogInformation functions and, unfortunately, the resulting file preserves catalog information from the first file only.
|
|
![]() |
|
HNRSoftware ![]() Senior Member ![]() Joined: 13 Feb 11 Location: Washington, USA Status: Offline Points: 88 |
![]() ![]() ![]() ![]() ![]() |
one possible trick is to write a string of identifiable characters in white text on white background and then extract the text of the resulting file and see if it is there. It should not be visible to the person viewing the document, but yet be fetchable.
|
|
![]() |
|
Mel ![]() Beginner ![]() ![]() Joined: 30 Aug 13 Status: Offline Points: 7 |
![]() ![]() ![]() ![]() ![]() |
Thank you for your suggestion,
we have already applied such a technique and are testing it. We wrote some fully transparent tags/text (SetTransparency(100)) on the original files and looked for them in the resulting pdf file. However, we were looking for a solution that would have avoided the physical writing of the original file pages. We haven't found one yet. |
|
![]() |
|
AndrewC ![]() Moderator Group ![]() ![]() Joined: 08 Dec 10 Location: Geelong, Aust Status: Offline Points: 841 |
![]() ![]() ![]() ![]() ![]() |
Mel, int id = NewContentStream(); QP.SelectContentStream(id); SetContentStreamFromString("%% Custom Comment" + " \r"); This will add a PDF comment to a new content stream. You can then extract the content contents using id = QP.GetContentStreamCount(); QP.SelectContentStream(id); QP.GetContentStreamToSting; You can then check the first few characters of the comment string to see if it matches your comment format. I haven't had time to try this but if for some reason the merge process combines the content streams then you would have to put the comment at the very front. QP.MoveContentStream(id, 1); // Move to the first position. Andrew. |
|
![]() |
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