I’ve written a simple vb.net program that makes a PDF from any given (printable) file. This is working great on my development PC. But not on an end user PC. Tried a couple of PC, one with XP Pro (like my dev PC) and the other Windows 7
I’ve been able to troubleshoot to an extent by adding a delay to wait for user input. At that stage (immediately after calling cPrinterStop=True) I can open the PDFcreator monitor and the file is in the queue. When I close the PDFcreator monitor the process completes successfully and the PDF is saved.
But without the artificial delay and opening PDFcreator monitor I get no PDF
Any ideas?
For anyone that is interested. I fixed this by “UseShellExecute” instead of relying on PDFcreator to send the file to the (PDF) printer
Code:
Dim NewProcess As New Process
NewProcess.StartInfo.UseShellExecute = True
NewProcess.StartInfo.FileName = strFileName 'give filename to process
NewProcess.StartInfo.Verb = “PrintTo”
NewProcess.StartInfo.Arguments = “PDFcreator” 'give printer name to process
NewProcess.StartInfo.CreateNoWindow = True
NewProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
NewProcess.Start()
NewProcess.CloseMainWindow()
NewProcess.Close()
NewProcess = Nothing
Also has advantage of not needing to change the default printer.