Shell command with PdfCreator

I installed PDFCreator because it allows command line to turn into a pdf file doc.
I tried the Prompt Window:
C:\Program Files\PDFCreator\PDFCreator.exe/PrintFile='C:\Temp\MioFile.doc
without quotes and works perfectly

I tried then to Xojo with the command shell:
Dim sh As New Shell
sh.Execute(“C:\Program Files\PDFCreator\PDFCreator.exe/PrintFile=‘C:\Temp\MioFile.doc’”)
not work
sh.Execute(“C:\Program Files\PDFCreator\PDFCreator.exe/PrintFile=C:\Temp\MioFile.doc”)
not work

sh.Execute(“C:\Program Files\PDFCreator\PDFCreator.exe”)
open PdfCreator

I do not understand why I do not accept the next command /PrintFile=C:\Temp\MioFile.doc
while from Prompt window works

[quote=167384:@Massimo Lista]Dim sh As New Shell
sh.Execute(“C:\Program Files\PDFCreator\PDFCreator.exe/PrintFile=‘C:\Temp\MioFile.doc’”)
not work
sh.Execute(“C:\Program Files\PDFCreator\PDFCreator.exe/PrintFile=C:\Temp\MioFile.doc”)
not work

[/quote]

You should hit the code (the <>) icon to make it more legible on the forum. Like this :

sh.Execute("C:\\Program Files\\PDFCreator\\PDFCreator.exe /PrintFile='C:\\Temp\\MioFile.doc'")

I believe you forgot to put a space between PDFCreator.exe and /PrintFile.

I tried but not work:
sh.Execute(“C:\Program Files\PDFCreator\PDFCreator.exe /PrintFile=‘C:\Temp\MioFile.doc’”)

This worked for me:

sh.Execute("""C:\\Program Files (x86)\\PDFCreator\\PDFCreator.exe"" /PF""C:\\Temp\\MioFile.doc""")

I tried but not work
sh.Execute(""“C:\Program Files (x86)\PDFCreator\PDFCreator.exe”" /PF"“C:\Temp\MioFile.doc”"")

I tried also
sh.Execute(""“C:\Program Files\PDFCreator\PDFCreator.exe”" /PF"“C:\Temp\MioFile.doc”"")
becouse PDFCreator.exe is in C:\Program Files but open only PFDfCreator

Are you sure that MioFile.doc is in the right place? Also make sure the extension is right. And do you have Word installed? PDFCreator just changes your default printer to PDFCreator then tells Word to print the document.

You may also want to ad the /NOSTART parameter to automatically close PDFCreator when it is done.

You should also put a line like msgbox(sh.results) right after the execute line to see if any errors occurred.

The exact syntax is:

sh.Execute(""“C:\Program Files\PDFCreator\PDFCreator.exe”"/PrintFile="“C:\Temp\MioFile.doc”"")

Thanks Bob

another route.

if you are doing this on windows and have Office installed, you could use OLE Objects to open the word document and I believe in Word 2007+, you can save naively to PDF.

[quote=167425:@Massimo Lista]The exact syntax is:

sh.Execute(""“C:\Program Files\PDFCreator\PDFCreator.exe”"/PrintFile="“C:\Temp\MioFile.doc”"")
[/quote]

If you look at s.result you will see that the problem is the space in “Program Files”. Do this instead :

dim s as shell dim f as folderitem = GetFolderItem("C:\\Program Files\\PDFCreator\\PDFCreator.exe") s.execute(f.shellpath+"/PrintFile=C:\\Temp\\MioFile.doc")

Once again, when you post code, please post it as code with the icon that looks like a document with <> in front, on top of the editor.

Code icon :

[quote=168790:@Massimo Lista]With the command
Dim sh As New Shell
sh.Execute(""“C:\Program Files\PDFCreator\PDFCreator.exe”" /PrintFile="“C:\Temp\MioFile.doc”"")
I open doc file and turned it into pdf
I can not find the command line to save the file in a specific directory
I use the latest version of PdfCreator[/quote]

See http://www.pdfforge.org/pdfcreator/manual/autosave-mode