Print through RhinoApp.RunScript() in C#?

rhino
rhinocommon

#1

hello to all

Please, can someone helps me to resolve this issue?
I need to print through code, but the command _-SavePrintWindowAs its not recognized by rhino. What should I use instead?
I’m doing this:

    string loc = "C:\\Users\\cricri\\Desktop\\hey.pdf";
    RhinoApp.RunScript("_-Print Go _-SavePrintWindowAs \n\"" + loc + "\"\n _-Enter", true);

any clue will be very helpful
thanks in advance
Carlos


#2

it might be because the command doesn’t exist in rhino?


(Luis Fraguada) #3

What about using a library? iText# and PDFSharp seem to be popular. I’ll keep digging into the RhinoApp.Runscript version to see if there is any way to pass a filename.


(Steve Baer) #4

If you run the scripted version of the print command, you should be able to get to this through something like

-_Print Setup View ViewportArea Window -10,-10 Enter 20,20 Enter Enter Enter

(Luis Fraguada) #5

Can a filename be inserted in that to automate the printing? The iterations I’ve tried seem to not be able to bypass the file explorer window appearing. That being said, I’m no macro wizard.


#6

Thanks,
a lot, I have the same question,
where should I place the file name?

regards
C.


Print Settings control from GH
(Steve Baer) #7

There isn’t really a good way to do this in Rhino 5. Rhino 5 doesn’t have a built in PDF printer so it doesn’t know that printing in general is being sent to a file. There is progress being made on this in the Rhino 6 WIP that should be showing up in the next week or two.


#8

thanks a lot Steve.
I will do it through a library then

regards
C.


#9

nm. reread post.