Merging PDFs with VBA
Printed From: www.exp-systems.com
Category: PDF reDirect
Forum Name: Programming
Forum Discription: VBA and Batch Tools to control PDF reDirect Pro
URL: http://www.exp-systems.com/Forum_exp/forum_posts.asp?TID=194
Printed Date: 22 Nov 24 at 2:12AM
Topic: Merging PDFs with VBA
Posted By: oddball508
Subject: Merging PDFs with VBA
Date Posted: 29 Mar 06 at 6:46PM
I have a database of records where each record is for a page of a document. Each page has been scanned to a single page PDF file (let not go into why here :) )
What I would like to do is combine groups of these files into a multi page PDF using code. The front end to reDirect does an excellent job of this but processing 1,003,000 files into 10,000 new files would not be fun.
In short - does and one know how I could use the merge function in code?
|
Replies:
Posted By: Michel_K17
Date Posted: 30 Mar 06 at 12:57AM
Ugh! Glad I'm not in your shoes.
Yes, I think I can help you out. This will require to use some of the "inner library functions" of PDF reDirect. I will write some sample code for you, and send it to you via e-mail.
Cheers!
Michel
|
Posted By: oddball508
Date Posted: 30 Mar 06 at 5:41PM
Cool - that would be great.
|
Posted By: Michel_K17
Date Posted: 31 Mar 06 at 4:38PM
Hopefully you have received my e-mail with the sample code. Let me know if you have any questions.
Cheers!
Michel
|
Posted By: oddball508
Date Posted: 02 Apr 06 at 8:26PM
No email recieved If you sent a zip file it won't get though (needs to be a rar file to keep you firewall happy).
Thanks
John
|
Posted By: Michel_K17
Date Posted: 02 Apr 06 at 9:09PM
OK. I just re-sent the e-mail with the RAR attachment.
|
Posted By: noctifer
Date Posted: 26 Jul 06 at 9:51AM
Could you send me this sample too?
I would need this functionality too for a report generator which has to generate one pdf out of several documents.
Thx in Advance
Steve
|
Posted By: Michel_K17
Date Posted: 26 Jul 06 at 3:48PM
Sure! Please wait until next week (Tue or Wed) as I am currently in Northern Canada visiting my parents, and I currently only have Internet access through my cell phone.
Cheers!
Michel.
|
Posted By: Commcycle
Date Posted: 15 Aug 06 at 3:11PM
I have a need to append to the end of a .pdf file from MS Access VBA. We are using Access to generate a report that has several sections, each one is a separate report. All go into one .pdf file. Can you send me the Code of "Inner library fuctions".
------------- CommCycler
|
Posted By: Commcycle
Date Posted: 16 Aug 06 at 11:03AM
I got the email and followed the instructions. I had to make a few mods in declarations and variable assignment but it works great. This is a huge time saver for me Thanks
------------- CommCycler
|
Posted By: sonic
Date Posted: 29 Aug 06 at 5:31AM
Hi Michel,
Id love to get that code as well! It'll save me half a day of work.
Thanks!!
|
Posted By: Michel_K17
Date Posted: 29 Aug 06 at 8:26PM
Hi Sonic,
I sent it. Cheers!
------------- Michel Korwin-Szymanowski
EXP Systems LLC
|
Posted By: bhadsock
Date Posted: 16 Nov 06 at 11:35AM
I would also like to receive the sample code or have it posted here.
Thanks.
|
Posted By: Michel_K17
Date Posted: 16 Nov 06 at 11:39PM
I have sent you an e-mail with the sample code!
------------- Michel Korwin-Szymanowski
EXP Systems LLC
|
Posted By: danii
Date Posted: 16 Dec 06 at 5:13AM
Hi Michel,
Could you also send me this sample code? It would be very helpful because I also need this functionality to merge several pdfs.
Thx in advance!
Danii
|
Posted By: RobertBleasdale
Date Posted: 06 Feb 07 at 6:12PM
Hi Michel,
I am trying to do the same thing, can I get a copy of the code.
Thanks!!
|
Posted By: Michel_K17
Date Posted: 08 Feb 07 at 12:43AM
I sent it. Cheers!
------------- Michel Korwin-Szymanowski
EXP Systems LLC
|
Posted By: mikegettings
Date Posted: 15 Feb 07 at 10:21AM
Hi, I am attempting to merge pdfs using visual basic code and pdf
redirect and I think It would be a tremendous help if you could forward
the examples along to me.
Thanks in advance.
|
Posted By: Michel_K17
Date Posted: 16 Feb 07 at 12:32AM
Done!
------------- Michel Korwin-Szymanowski
EXP Systems LLC
|
Posted By: donkur2
Date Posted: 01 Mar 07 at 1:13PM
Michel, would you be able to send me, or create a link to the code as well? I need this functionality in order to get the merged files to duplex.
Thanks! :)
|
Posted By: Michel_K17
Date Posted: 01 Mar 07 at 9:29PM
Done!
------------- Michel Korwin-Szymanowski
EXP Systems LLC
|
Posted By: donkur2
Date Posted: 06 Mar 07 at 2:16PM
Thanks Michel, things are going well, but a wrench just got thrown into the project. This is what I need to do:
I have a 25 page Access report. On each page is a different item number. The existing pdf diagram that corresponds to that item number exists as a single page file. What I am doing, is I have made a pdf of the entire report, now I need to merge/COLLATE the existing single-page pdf into the appropriate position, ie between pages 1 and 2 of the 25 page report, then between 3 and 4, etc., so that I can print them out duplexed, that is, print the diagram on the back of the page with the item number of it. Is that possible with this software, or do I have to make 25 pdfs from the single report? I guess we could split the file, collate, then merge it back together? Thank-you for any input you may have. :)
|
Posted By: Michel_K17
Date Posted: 06 Mar 07 at 10:02PM
Hi,
OK. I see that what you are asking for is a bit more complicated than the standard merging.
What you probably want then is access to a full PDF management library that will allow you to open a PDF, allow you to manage the pages, and then save the changes. I use a library called "QuickPDF" which is normally available here [ http://www.isedquickpdf.com - www.isedquickpdf.com ]. The cost is reasonable: $95. However their site has been down for a week or so, and they have not been supporting their library for over a year now. Their web site implies that the owners may be recreating their web site and re-opening soon.
Nonetheless, the library is great: it is both fast and powerful. I have setup a "Fan Club" web site which contains a great bunch of users that help each other out. We are located here: [ http://www.quickpdf.org - www.quickpdf.org ]. Also, we have continued development of the library, fixed bugs, and added a few new features. There is a free 30 day trial period and I can provide you with a trial key if you need it. Just ask. I can probably let you know how to purchase a license even if their site is down, so let me know if that is what you want/need to do.
Another alternative is the DynaPDF library which I sell on my web site. It is $399 and that library is fully supported. See my home web site here:[ http://www.exp-systems.com - www.exp-systems.com ]
Apart from that, what you suggested should work: you could print each page individually, and then merge them all at the end in the right order. It might be a touch slower, but it should get you there at the lowest cost.
Cheers!
------------- Michel Korwin-Szymanowski
EXP Systems LLC
|
Posted By: crclee
Date Posted: 06 May 07 at 8:10PM
Hi
I would also like a copy of the code to merge PDFs using VBA, or perhaps just a one or two-line code snippet here.
The new activex seems to have this functionality, but I couldn't find any documentation. I just need to know what arguments to send when calling Utility_Merge_PDF_Files.
Thanks
C
|
Posted By: Michel_K17
Date Posted: 12 May 07 at 10:13AM
Hi,
Sorry for the late reply: I had not realized that you posted in the forum.
Here is the sample code that you requested to use that function:
Private Sub Merge()
Dim oPDF As New PDF_reDirect_Pro_Tool
Dim Files_to_Merge(1) As String
Dim TempBool As Boolean
' Files to Upload
Files_to_Merge(0) = "C:\Temp\Delme.pdf"
Files_to_Merge(1) = "C:\Temp\Buddy Time sign 3001.pdf"
With oPDF
TempBool = .Utility_Merge_PDF_Files("C:\MergeTest.pdf", Files_to_Merge)
If Not TempBool Then
' NOTES ON ERROR CODES for oPDF.ErrorLastDLL
' 401 - One of the Input File could not be opened
' 410 - One of the Input File could not be decrypted
MsgBox "An Error Occured: " & .LastErrorDescription & vbCrLf & _
"Error Number =" & Str$(.LastErrorNumber) & vbCrLf & _
"DLL Error Number =" & Str$(.ErrorLastDLL), _
vbExclamation
Else
MsgBox "Merge Successful.", vbInformation
End If
End With
Set oPDF = Nothing
End Sub
Cheers!
------------- Michel Korwin-Szymanowski
EXP Systems LLC
|
Posted By: Rick
Date Posted: 12 Jun 07 at 1:35PM
Hi,
Tried to merge PDF's using the code posted 12 may. However it keeps generating error 0 (dll error 999) even after changing file names or creating new PDF's.
Any options?
Rick
|
Posted By: Michel_K17
Date Posted: 14 Jun 07 at 12:58AM
Hi,
I rechecked the code, and I did not see anything obvious. I am assuming that you have PDF reDirect Pro also installed (some of the libraries that are part of PDF reDirect Pro are needed for the code to run).
The sample code that you are running: are you using Word, or Excel?
Which version of Windows are you running.
Cheers!
Michel
------------- Michel Korwin-Szymanowski
EXP Systems LLC
|
Posted By: rctjoe24
Date Posted: 14 Jun 07 at 2:55PM
Michel
I am in also need of the code to join PDFs. My problem is I have multiple access reports that I need to save as pdf files in a directory and then join them as one file. I would do it all in one report but the problem is orientation. One report is portrait and the next landscape and the next portrait and the last back to landscape. This would help a great deal.
Thank you very much
|
Posted By: Rick
Date Posted: 14 Jun 07 at 2:59PM
Hi,
Yes, i have PDF reDirect Pro installed and the proper libraries are installed.
I'm running the sample code using word(versions word2000 and wordXPnl).
I'm running winXP and win2000server. The errors are generated on both computers.
Rick
|
Posted By: Michel_K17
Date Posted: 15 Jun 07 at 1:44AM
Hi to rctjoe24,
The code (about 3 posts above) is the latest merging code, but it will be necessary that you download the ActiveX component from [ http://www.exp-systems.com/Forum_exp/forum_posts.asp?TID=254&FID=3&PR=3 - here ] so that you get the ActiveX installed and registered.
Please note that you can merge more than two PDF files at once. The code shows two files, but you can declare the array to have more than two files, and all of them will be merged together.
-----
And also, for you and for Rick too - I think I found the problem with the Error 999 reported by Rick. Please upgrade your ActiveX component with the one you can download from [ http://www.exp-systems.com/PDFreDirect/Download/ActiveX_PDF_Pro_v22001.zip - here ]. That should fix the problem. Unzip the DLL to your C:\Program Files\PDF reDirect folder to replace the existing file that is there. You should not have to re-register the component. Simply replacing the DLL should do the trick.
Let me know if that does not work.
------------- Michel Korwin-Szymanowski
EXP Systems LLC
|
Posted By: Rick
Date Posted: 18 Jun 07 at 8:13AM
Hi Michel,
Replaced the DLL and it now works on both platforms.
Thanks!
Rick
|
Posted By: carpking
Date Posted: 08 Jul 10 at 4:34AM
Hi Michel,
I have a project that requires splitting a multipage pdf into single page pdfs and then organising them and merging them into multiple pdfs. The organisation process will run according to account numbers which will be saved into the filenames (according to a management sheet in excel) during the splitting process ... eg pages 1-5 filenames: acc1 pg1, acc1 pg2, acc1 pg3, acc1 pg4, acc1 pg5 ... pages 6-8 filenames acc2 pg1, acc2 pg2 ... etc I have a moderate knowledge level of vba in excel and I was hoping based on the comments above you would be able to help me with this project.
Many thanks in advance
|
Posted By: Michel_K17
Date Posted: 08 Jul 10 at 10:34PM
Hi there,
I think you can get there with PDF reDirect, but honestly, you will be better served by using the same PDF library that I use in PDF reDirect. It is called QuickPDF Library, and you can find out more about it [ http://www.quickpdf.com - here ].
In regards to "helping" with your project: unfortunately I do not offer this service for free. In addition, I am currently fully booked. However, you might be able to get some help by asking for some help from a professional programmer at http://www.vworker.com - www.vworker.com . You can post what you need as a small project. I think you will find the rates quite reasonable.
I hope that helps.
Cheers!
------------- Michel Korwin-Szymanowski
EXP Systems LLC
|
Posted By: arasu
Date Posted: 25 Aug 10 at 3:23PM
hi michel,
when i am trying to run this code it showing the error as "Active x component can not find the object". the error is coming when i am running this line "TempBool = .Utility_Merge_PDF_Files("C:\MergeTest.pdf", Files_to_Merge). Please let me know what i have to define in the Files_to_merge... and please help me to solve this issue...
regards,
arasu
|
Posted By: Michel_K17
Date Posted: 26 Aug 10 at 12:22AM
Hi Arasu, You are right: it looks like I deleted the sample code for merging PDF files together. Sorry about that. Here it is:
Dim oPDF As New PDF_reDirect_v25001.Batch_RC_AXD Dim Files_to_Merge(1) As String Dim TempBool As Boolean ' Files to Upload Files_to_Merge(0) = "C:\Temp\FirstFile.pdf" Files_to_Merge(1) = "C:\Temp\SecondFile.pdf" With oPDF TempBool = .Utility_Merge_PDF_Files("C:\MergeTest.pdf", Files_to_Merge) If Not TempBool Then ' NOTES ON ERROR CODES for oPDF.ErrorLastDLL ' 401 - One of the Input File could not be opened ' 410 - One of the Input File could not be decrypted MsgBox "An Error Occured: " & .LastErrorDescription & vbCrLf & _ "Error Number =" & Str$(.LastErrorNumber) & vbCrLf & _ "DLL Error Number =" & Str$(.ErrorLastDLL), _ vbExclamation Else MsgBox "Merge Successful.", vbInformation End If End With Set oPDF = Nothing
Also note that you can make teh array larger so taht you can merge 3, 4, or more files together.
Cheers!
------------- Michel Korwin-Szymanowski
EXP Systems LLC
|
Posted By: arasu
Date Posted: 26 Aug 10 at 4:29PM
Hi Michel,
Thanks for your quick response...
The same code only i copied and used to merge my pdf.But still i am getting error as "Active X component cant create object" when i am running this particular line
TempBool = .Utility_Merge_PDF_Files("E:\Learnings\mergetest.pdf", Files_to_Merge)
Please help me to solve this problem...
Private Sub Merge()
Dim oPDF As New PDF_reDirect_Pro_Tool
Dim Files_to_Merge(1) As String
Dim TempBool As Boolean
' Files to Upload
Files_to_Merge(0) = "E:\Learnings\1.pdf"
Files_to_Merge(1) = "E:\Learnings\2.pdf"
With oPDF
TempBool = .Utility_Merge_PDF_Files("E:\Learnings\mergetest.pdf", Files_to_Merge)
If Not TempBool Then
' NOTES ON ERROR CODES for oPDF.ErrorLastDLL
' 401 - One of the Input File could not be opened
' 410 - One of the Input File could not be decrypted
MsgBox "An Error Occured: " & .LastErrorDescription & vbCrLf & _
"Error Number =" & Str$(.LastErrorNumber) & vbCrLf & _
"DLL Error Number =" & Str$(.ErrorLastDLL), _
vbExclamation
Else
MsgBox "Merge Successful.", vbInformation
End If
End With
Set oPDF = Nothing
End Sub
|
Posted By: Michel_K17
Date Posted: 26 Aug 10 at 10:29PM
Hi,
Thanks for the update. I found a bug in my code (my bad). I will post an updated version of the component later tonight. It will be v2.5.2.
Hopefully this will get you going.
Cheers!
Michel
------------- Michel Korwin-Szymanowski
EXP Systems LLC
|
Posted By: Michel_K17
Date Posted: 27 Aug 10 at 12:39AM
Hi,
I just posted v2.5.2 with the fix [ http://www.exp-systems.com/forum_exp/forum_posts.asp?TID=629 - here ].
Cheers!
Michel
------------- Michel Korwin-Szymanowski
EXP Systems LLC
|
Posted By: Michel_K17
Date Posted: 27 Aug 10 at 12:43AM
For the sake of completeness, your reference to the ActiveX component changes as follows:
WAS: Dim oPDF As New PDF_reDirect_Pro_Tool
NEW: Dim oPDF As New PDF_reDirect_v25002.Batch_RC_AXD
Your code had the old reference - which is why you were getting the error message in the first place. But you also need the bug fix for v2.5.2
Cheers!
Michel
------------- Michel Korwin-Szymanowski
EXP Systems LLC
|
Posted By: arasu
Date Posted: 27 Aug 10 at 3:32PM
Hi Michel,
Now the code is working fine.. Thanks for your help...
I have a small doubt in the product, here we have two product one is PDF-redirect free version... and another one is PDF- redirect Professional version.
These are my doubts.
1. The PDF-redirect free version is free only for 90 days after that i ll get a pop up message...or some word will come background of my pdf... Am I correct???
2. This VBA code will work only for PDF-redirect Professional only not for Free version ...is this correct??Because the dll which i downloaded is for Professional only pls correct me!!!
3. The DLL Active X component which i downloaded is for the Professional not for the free version.. correct??
Thanks in advance
Regards,
Arasu
|
Posted By: Michel_K17
Date Posted: 27 Aug 10 at 7:07PM
Hi,
Here are the answers to your questions:
1. PDF reDirect Freeware is free, forever. No popups, no warnings. Just free.
2. PDF reDirect Pro is free for 90 days, then continues to work, but the PDF files have a watermark added to all the pages that says "www.exp-systems.com".
3. You are correct: the VBA samples and the ActiveX DLL require the Pro version.
One final point: PDF reDirect Pro is $19.99, but the price is reduced to $14.99 for August only, and will go back to $19.99 on September 1st at 1AM Eastern Standard Time.
Cheers!
Michel
------------- Michel Korwin-Szymanowski
EXP Systems LLC
|
Posted By: jmckelvey
Date Posted: 15 Mar 11 at 2:20PM
First off... fabulous product!
licensed Pro 2.5.2 with ActiveX file ver 2.5.0.2
Our only issue is when merging 3 pdf documents into 1 using VBA in Access, only the first 2 are processed (3rd is ignored). Sample code was modified to:
Dim Files_to_Merge(2) as string {was 1}
Files_to_Merge(2) = "Page_3.pdf" {newly inserted line}
Process completes, "Merge Successful", but never processes the 3rd PDF
Any thoughts?
I know I could merge 1 and 2 and then the result with 3 but...
Thanks!
|
Posted By: Michel_K17
Date Posted: 15 Mar 11 at 9:40PM
Hi,
It sounds like it should work. Make sure that Page_3.pdf is not encrypted, or try changing the order, place "Page_3.pdf" first to see if the problem is with that file.
Also, "Page3_.pdf" should actually contain the full path like this:
Files_to_Merge(2) = "C:\Temp\Page_3.pdf"
It should work (I have sample code that works that does more than two documents), so I would check the obvious things first.
let me know if the problem continues.
Cheers!
------------- Michel Korwin-Szymanowski
EXP Systems LLC
|
Posted By: jmckelvey
Date Posted: 16 Mar 11 at 12:21PM
Thanks for the reply!
I was working multiple angles at the time... discovered I had missed the PDFcreated() delay/check on page3. Merge was completing before page 3 had been written and released; albeit, no error from the merge function.
It's not really a bad thing when things run too fast!
GREAT PRODUCT!
Thanks again!
|
Posted By: Michel_K17
Date Posted: 17 Mar 11 at 12:50AM
Awesome! Thanks for the update, and for your kind words.
Cheers!
------------- Michel Korwin-Szymanowski
EXP Systems LLC
|
Posted By: alaska-guy
Date Posted: 20 Jul 11 at 4:03PM
Michel - I am using your merge code in an Access 2007 database front end SQL server backend (ODBC) I have installed the proper libraries and modifed the first line of code so I no longer recive the error "Active x component can not find the object". Now no matter what I do I keep getting the error 410 - One of the Input File could not be decrypted -Any ideas that you can give me on avoiding this error would be greatly appreciatedThanks -AKG
|
Posted By: Michel_K17
Date Posted: 22 Jul 11 at 6:52AM
Hi,
What is th 1st line that was giving the error? Was it "Option Explicit"? If so, that line really needs to be there.
What this tells me is that for some reason, the ActiveX component is
not registered properly on your system. I would look at manually
registering the component by using the regsvr32 command line command.
I hope that helps.
Cheers!
------------- Michel Korwin-Szymanowski
EXP Systems LLC
|
Posted By: alaska-guy
Date Posted: 22 Jul 11 at 5:18PM
Hi Michel, Am I missing something? This is the code I am using: Dim oPDF As New PDF_reDirect_v25002.Batch_RC_AXD Dim Files_to_Merge(1) As String Dim TempBool As Boolean ' Files to Upload Files_to_Merge(0) = "T:\SystemDocuments\1143.pdf" 'Files_to_Merge(1) = "C:\MergeeTest.pdf" With oPDF TempBool = .Utility_Merge_PDF_Files("T:\1144.pdf", Files_to_Merge) If Not TempBool Then ' NOTES ON ERROR CODES for oPDF.ErrorLastDLL ' 401 - One of the Input File could not be opened ' 410 - One of the Input File could not be decrypted MsgBox "An Error Occured: " & .LastErrorDescription & vbCrLf & _ "Error Number =" & Str$(.LastErrorNumber) & vbCrLf & _ "DLL Error Number =" & Str$(.ErrorLastDLL), _ vbExclamation Else MsgBox "Merge Successful.", vbInformation End If End With Set oPDF = Nothing My Acesss module is set to option explicit but there is no option explicit in the code that I saw on the forum - Am I missing some code? Anyway I sucessfully manually registered the activeX dll ActiveX_PDF_Pro_v25002.dll and I still receive the following error only from the line: TempBool = .Utility_Merge_PDF_Files("T:\1144.pdf", Files_to_Merge)
An Error Occured: One of the Input File could not be opened or decrrypted Error Number = 0 DLL Error Number = 401 This merge process will be a life saver for my e-document app so I really want it to work - The manual merge works fine in the pdf Redirect application so my pdf files should be OK Here is hoping that you can give me more enlightenment - I don't see what I can change based on the code that I am using
|
Posted By: alaska-guy
Date Posted: 22 Jul 11 at 5:58PM
Michel, Trying to be more specific - I am not actually receiving a classic error from my code - I am only returning a value from the call to the merge utility that branches into a message box with the error content in the If Not TempBool Then statement. I added error handlers and did not trap any errors
|
Posted By: Michel_K17
Date Posted: 25 Jul 11 at 8:22AM
Hi,
Here is the explanation. You have this:
Dim Files_to_Merge(1) As String
So you will have two dimensions: Files_to_Merge(0) and Files_to_Merge(1)
But later in your code, you have this:
' Files to Upload Files_to_Merge(0) = "T:\SystemDocuments\1143.pdf" 'Files_to_Merge(1) = "C:\MergeeTest.pdf"
You have commented out the 2nd line for Files_to_Merge(1) which means it will be empty - which is causing the error.
Cheers!
------------- Michel Korwin-Szymanowski
EXP Systems LLC
|
Posted By: alaska-guy
Date Posted: 28 Jul 11 at 1:48PM
Yes - You do need two files in order to merge! - Did the commenting when I had the first problem and forgot to remove - Sorry should have caught that myselfWorks perfectly now - Thanks
|
Posted By: Michel_K17
Date Posted: 29 Jul 11 at 1:32AM
No worries.
Cheers!
------------- Michel Korwin-Szymanowski
EXP Systems LLC
|
Posted By: mytfein
Date Posted: 14 Feb 12 at 4:11PM
Hi Michel,
Would it be possible for you send me the code, as well.
I need to consolidate pdf files using vba....
tx for your consideration, sandra
|
Posted By: AnthonyPrince
Date Posted: 09 Mar 12 at 9:49AM
The final window, titled, 'Choose a file size and conversion setting'
allows you to control the size of your merged PDF document. Consider the
purpose of your new document. - http://communityblogonline.com/instant-tax-solutions/ - Instant Tax Solutions Scam
|
Posted By: dan cecil
Date Posted: 26 Nov 12 at 5:15AM
Hello,
new to the forum here.... I am trying to merge all files in a folder (all are pdf)... using vba in access... I keep getting error 401 files cannot be opened... any ideas?
thanks
Private Sub Command0_Click()
'fso = CreateObject("Scripting.FileSystemObject")
Dim x As Integer
Dim fs As Object
Dim fl As Object
Dim fld As Object
Set fs = CreateObject("Scripting.FileSystemObject")
Dim count As Integer
Dim oPDF As New PDF_reDirect_v25002.Batch_RC_AXD
dim TempBool As Boolean
Dim strFileNameShort As String
Dim Files_to_Merge() As String
set fld = fs.GetFolder("\\Pomsserver1\pomsserver\dropbox\MSA\Registration_and_Charges")
x = 0
For Each fl In fld.Files
x = x + 1
Next fl
ReDim Files_to_Merge(x - 1)
x = 0
For Each fl In fld.Files
Files_to_Merge(x) = fl.Name
x = x + 1
Next fl
With oPDF
TempBool = .Utility_Merge_PDF_Files("\\Pomsserver1\pomsserver\dropbox\MSA\Registration_and_Charges\MergeTest.pdf", Files_to_Merge)
If Not TempBool Then
' NOTES ON ERROR CODES for oPDF.ErrorLastDLL
' 401 - One of the Input File could not be opened
' 410 - One of the Input File could not be decrypted
MsgBox "An Error Occured: " & .LastErrorDescription & vbCrLf & _
"Error Number =" & Str$(.LastErrorNumber) & vbCrLf & _
"DLL Error Number =" & Str$(.ErrorLastDLL), _
vbExclamation
Else
MsgBox "Merge Successful.", vbInformation
End If
End With
Set oPDF = Nothing
End Sub
|
Posted By: Michel_K17
Date Posted: 26 Nov 12 at 7:33PM
Hi,
I am sorry to hear of the problem. I would check the following:
- Make sure that PDF reDirect is in the "Professional" mode. Specifically, make sure that the printer is called "PDF reDirect Pro v2". Alternatively, go into the Preferences, and make sure that the General >> Startup Mode is set to PDF reDirect Professional.
- Make sure that you are a registered user, or that you still have some days remaining in the evaluation.
- Make sure that none of the files you are trying to merge are locked or encrypted. If you do not have too many files, open them one by one in Adobe's PDF Reader, and check their security.
I hope that helps.
Cheers!
------------- Michel Korwin-Szymanowski
EXP Systems LLC
|
Posted By: dan cecil
Date Posted: 26 Nov 12 at 8:39PM
Michel, thanks so much for your quick reply. I did check those items and everything looked good.. I also tried using a local path instead of a network path incase there was any network security issues present... any other ideas?... does the code look ok?... would you have any samples that might have done a similar thing?... merging all files in a folder?... thanks again
Dan
|
Posted By: Michel_K17
Date Posted: 26 Nov 12 at 10:59PM
Hi Dan,
One more thing I noticed in your code: you add all of the files in the "Registration_and_Charges" folder, but you do not check to make sure that they are PDF files before adding them. Is there any chance that other (non-PDF) files are added? Or maybe a hidden file?
Cheers!
------------- Michel Korwin-Szymanowski
EXP Systems LLC
|
|