Page 1 of 1

Help with multiple pdf or merge

Posted: Fri Mar 02, 2012 12:50 pm
by patapatty
Hi.
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)

obj.Init
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)
Wend

Call rslistFile.movenext
Loop

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.