Help with multiple pdf or merge

About the programming interface for the virtual PDF printer driver.

Moderator: jr

Help with multiple pdf or merge

Postby patapatty » Fri Mar 02, 2012 12:50 pm

I've have to convert and merge different file (.doc, .jpg, .txt, .pdf ...) in to a single pdf file using VB6.

This is the code I use
Dim p As New ComPdfUtil

Set obj = CreateObject("BullZip.PDFPrinterSettings")
PrinterName = obj.GetPrinterName
runonce = obj.GetSettingsFileName(True)

Do While Not rslistFile.EOF
inputFile = rs.fields("PathFileName").Value
outputFile = "C:\FileOutput.pdf"
Set f = fso.GetFile(pathFile)

Call obj.SetValue("Output", outputFile)
Call obj.SetValue("ConfirmOverwrite", "No")
Call obj.SetValue("ShowSaveAS", "Never")
Call obj.SetValue("ShowSettings", "Never")
Call obj.SetValue("ShowPDF", "No")
Call obj.SetValue("OpenFolder", "No")
Call obj.SetValue("ShowProgress", "No")
Call obj.SetValue("ShowProgressFinished", "No")
Call obj.SetValue("DisableOptionDialog", "Yes")
Call obj.SetValue("SuppressErrors", "Yes")
Call obj.SetValue("Format", "PDF")
Call obj.SetValue("AppendIfExists", "Yes")
obj.WriteSettings True
p.PrintFile inputFile, PrinterName
While fso.FileExists(runonce)
Rem -- Wait for some milliseconds before testing again
'Wscript.sleep 100
Sleep (100)

Call rslistFile.movenext

This works fine, but if the file to merge is a pdf file, there is a problem.
The file is printed and attacched to the outputfile.pdf, but a new session of acrobat reader will start with no file opened.
For other file, such as doc, I see that Word start to print the file but then it will close.
For the pdf, I see Acrobat reader start to print the file, it closes, but then another windows starts with no file.
How can I do?

Please help me.
Posts: 3
Joined: Tue Nov 15, 2011 11:19 am

Return to Programming

Who is online

Users browsing this forum: No registered users and 3 guests