rbeson
01-10-2011, 04:45 AM
Hi Steve et al.,
I want to print quite a few PDFs and am rewriting a vb script from Sanghoon Yoon (http://sac3.blogspot.com/2009/02/rhinoscript-print-layout-pages-as-pdf.html) in Python.
However, I can't seem to set the printerName property - which then throws the following error:
Exception: The PrinterName property must be set before calling the GetSettingsFilePath method.
Would anyone know how to set the printerName property? Full code below:
import System
t = System.Type.GetTypeFromProgID("Bullzip.PdfSettings")
printer = System.Activator.CreateInstance(t)
# Configure the PDF print job
printer.SetValue ("mergefile","t")
printer.SetValue ("mergeposition","bottom")
printer.SetValue ("Output", "test")
printer.SetValue ("ConfirmOverwrite", "no")
printer.SetValue ("ShowSaveAS", "never")
printer.SetValue ("ShowSettings", "never")
printer.SetValue ("ShowPDF", "no")
printer.SetValue ("RememberLastFileName", "no")
printer.SetValue ("RememberLastFolderName", "no")
printer.WriteSettings (True)
rs.Command("-_Print go", False)
Here is the vsScript if it helps:
Function BatchPrint(strFile,strM)
Const PDF_PRINTERNAME = "Bullzip PDF Printer"
Const PRINTER_PROGID = "Bullzip.PDFPrinterSettings"
Dim prtidx, obj
'Configure the PDF print job
Set obj = CreateObject(PRINTER_PROGID)
obj.SetValue "mergefile",strM
obj.SetValue "mergeposition","bottom"
obj.SetValue "Output", strFile
obj.SetValue "ConfirmOverwrite", "no"
obj.SetValue "ShowSaveAS", "never"
obj.SetValue "ShowSettings", "never"
obj.SetValue "ShowPDF", "no"
obj.SetValue "RememberLastFileName", "no"
obj.SetValue "RememberLastFolderName", "no"
obj.WriteSettings True
Rhino.Command "-print go ",False
'Wait for runonce settings file to disappear
Dim runonce, fso
runonce = obj.GetSettingsFileName(True)
Set fso = CreateObject("Scripting.FileSystemObject")
While fso.FileExists(runonce)=True
Sleep 100
Wend
End Function
Also, strangely enough - the vbscript works in V4, but not in V5 - but that's off-topic.
Thanks,
Rob
I want to print quite a few PDFs and am rewriting a vb script from Sanghoon Yoon (http://sac3.blogspot.com/2009/02/rhinoscript-print-layout-pages-as-pdf.html) in Python.
However, I can't seem to set the printerName property - which then throws the following error:
Exception: The PrinterName property must be set before calling the GetSettingsFilePath method.
Would anyone know how to set the printerName property? Full code below:
import System
t = System.Type.GetTypeFromProgID("Bullzip.PdfSettings")
printer = System.Activator.CreateInstance(t)
# Configure the PDF print job
printer.SetValue ("mergefile","t")
printer.SetValue ("mergeposition","bottom")
printer.SetValue ("Output", "test")
printer.SetValue ("ConfirmOverwrite", "no")
printer.SetValue ("ShowSaveAS", "never")
printer.SetValue ("ShowSettings", "never")
printer.SetValue ("ShowPDF", "no")
printer.SetValue ("RememberLastFileName", "no")
printer.SetValue ("RememberLastFolderName", "no")
printer.WriteSettings (True)
rs.Command("-_Print go", False)
Here is the vsScript if it helps:
Function BatchPrint(strFile,strM)
Const PDF_PRINTERNAME = "Bullzip PDF Printer"
Const PRINTER_PROGID = "Bullzip.PDFPrinterSettings"
Dim prtidx, obj
'Configure the PDF print job
Set obj = CreateObject(PRINTER_PROGID)
obj.SetValue "mergefile",strM
obj.SetValue "mergeposition","bottom"
obj.SetValue "Output", strFile
obj.SetValue "ConfirmOverwrite", "no"
obj.SetValue "ShowSaveAS", "never"
obj.SetValue "ShowSettings", "never"
obj.SetValue "ShowPDF", "no"
obj.SetValue "RememberLastFileName", "no"
obj.SetValue "RememberLastFolderName", "no"
obj.WriteSettings True
Rhino.Command "-print go ",False
'Wait for runonce settings file to disappear
Dim runonce, fso
runonce = obj.GetSettingsFileName(True)
Set fso = CreateObject("Scripting.FileSystemObject")
While fso.FileExists(runonce)=True
Sleep 100
Wend
End Function
Also, strangely enough - the vbscript works in V4, but not in V5 - but that's off-topic.
Thanks,
Rob