I’m excited to let you know about a new feature that just showed up in the latest V6 WIP (Jan. 25th build).
Rhino 6 writes PDF files without the need of a printer driver.
This feature is currently only available in File->Save As… I will be integrating this into the Print command in the future. Here are some of the key new features.
No printer driver required
As I already mentioned, this feature is independent of any 3rd party printer driver. You shouldn’t have to try and figure out which printer driver is best for Rhino since you shouldn’t have to use a printer driver.
Improved Curve Output
Rhino’s printing system traditionally breaks down curves to polylines which fit the original curves to a certain dot tolerance. This resulted in PDF files with very dense polylines. For printing to paper this is fine, but if you planned to later open and edit the PDF file downstream in something like Illustrator you ended up with geometry that wasn’t extremely useful. The new PDF exporter converts curves to paths that are composed of either line segments or cubic beziers fit to a dot tolerance when possible. This results in much cleaner and easier to use geometry.
Improved Hatch Output
Rhino’s printing system traditionally prints solid hatches as a series of filled triangles. Again, fine for printing to paper but useless if you are attempting to edit the resulting PDF. The new PDF exporter generates paths with appropriate winding rules to generate true filled regions that are easy to work with for editing.
SDK Access
Previously, the only way to automate generation of PDFs was through scripting of the Print command which could be considered painful at best. The new PDF exporter focuses on putting the SDK first by being a simple plug-in which directly uses a couple classes in RhinoCommon to do the work. Developers should be able to use these classes to generate custom PDFs; be it a single PDF with 1000 pages or 1000 single page PDFs. The following python script is a sample of this new functionality.
import Rhino
import scriptcontext as sc
import System.Drawing
import rhinoscriptsyntax as rs
# create a new PDF document
pdf = Rhino.FileIO.FilePdf.Create()
dpi = 300
size = System.Drawing.Size(8.5*dpi,11*dpi)
settings = Rhino.Display.ViewCaptureSettings(sc.doc.Views.ActiveView, size, dpi)
# add 1 or more pages based on ViewCaptureSettings
pdf.AddPage(settings)
#write the pdf file to disk
filename = rs.SaveFileName()
pdf.Write(filename)
What Next?
Please try out this new feature and let me know what you think could be improved upon and what appear broken. I still need to integrate this with the Rhino print dialog and improve on the SDK access, but there are probably plenty of areas where this functionality could be improved. As much feedback as possible is appreciated. Thanks!