The issue I am having is I cannot get past SaveAs pdf window that pops up, I can change the default location of file but I still have to hit enter everytime.
I have looked into using ctypes to simulate keystrokes but have not had much success.
Could something in System.Windows.Forms maybe be used for to press the [Enter] key at the end of the script?
def BatchPrint():
fileNames= rs.OpenFileNames("Pick Files To Print","RhinoFile(*.3dm)|*.3dm||")
for a in fileNames:
Rhino.RhinoDoc.OpenFile(a)
LayoutNames=scriptcontext.doc.Views.GetPageViews()
LayName = LayoutNames[0]
rs.CurrentView(LayName.PageName)
rs.Command("_-Print G")
The way I do it is print one page with correct page setups settings/pdf driver. Then Rhino will remember those for all the other prints it makes. Also I only 1 layout in made files so the scirpt is set up to switch to the only layout in the file. If you have more than one you may need to tweek it.
Thanks for the replies. Unfortunately, I don’t think either of these address my current issue. When I attempt to batch print to PDF I am always prompted with a popup window asking for the file location I to save the PDF at. I can change where what appears as the default path by passing it in as newpath in your script, but even including " _Enter"+" _Enter" I still have to press the [Enter] key to get through the pdf SaveAs dialog box.
Attached is an image of the dialog box I cannot seem to suppress.
If the only way I can accomplish batch printing of PDFs is to press [Enter] for each one that is fine. However, it is not super convenient if I have to press [Enter] 50 or so times for a batch pdf export. If anyone has a solution for this it would be great.
Thanks,
5chmidt
import System
VK_RETURN="0x0D"
System.Windows.Forms.SendKeys.SendWait(VK_RETURN)
To the end of my code in an attempt to simulate pressing [Enter] to get through the SaveAs Dialog window. However, I have not had any success with it as of yet. Is there a better option for exporting a pdf within Rhino python?
This may not be the solution you are looking for but with the PDF995 (paid for version) printer, there is a setting to bypass the dialog which allows the file name to be manipulated in your script. Maybe Acrobat has a similar setting.
I was trying to do the same thing but I cannot get through the whole windows setting files changes. Could you explain to me step by step where and how to change the adobe pdf print settings as to suppress the dialogue box? It would be of great help!
I can tell you how to do it for Windows, its probably different if you are running a Mac.
1 - Click Start Menu
2 - Devices and Printers
3 - Right Click Adobe PDF Printer
4 - Click Printing Preferences
**I no longer have Adobe so I’m going from memory for the last bit here
5 - Change “Prompt for Adobe PDF Filename” to the folder you want Adobe to dump your PDFs by default.
It will now place every pdf you create into your specified dump folder.
You can move them around to your desired final location using:
import os
os.rename("C:\current_location.pdf","C:\desired_destination.pdf")