Export PDF in Revit 2022 - Quick Example

I wanted to share this quick graph that enables you to export PDF’s in Revit 2022. I can’t believe just how easy it is now.

#Sean Page, 2021
import clr

clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *

clr.AddReference('System')
from System.Collections.Generic import List

clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.Elements)

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager

doc = DocumentManager.Instance.CurrentDBDocument

Sheets = UnwrapElement(IN[0])
Names = IN[1]
Folder = IN[2]
result = []
sheets = List[ElementId]()

opts = PDFExportOptions()
#This will uses the Sheet Size for Paper size, or default to Letter
opts.PaperFormat = ExportPaperFormat.Default
for sheet,name in zip(Sheets,Names):
	opts.FileName = name
	Sheet = List[ElementId]()
	Sheet.Add(sheet.Id)
	result.append(doc.Export(Folder,Sheet,opts))

OUT = result

Export PDF Revit 2022.dyn (11.9 KB)

17 Likes

Hi Sean,
That looks really easy!
How come there is no print setting needed?

There are several setting you can set with the opts like Unreferenced Views, Blue Callouts etc, you just got to set them, but this basic example just uses the current project settings.

Hi Sean thanks for your response, I should have said paper sizes…

How are sheets exported as pdf without determining what paper size to use in the printer? :slight_smile:

I edited the Python above to include the option for PaperFormat which you can set for Default and it will use the TitleBlock size for sheet size, or defaults to Letter if one isn’t available. You can also use sheet names like ARCH_E1 or ISO_A2 etc.

Awesome!! very nice :slight_smile:

1 Like

Here is a better list of the majority of options available.

opts.ColorDepth = ColorDepthType.Color
opts.Combine = False
opts.ExportQuality = PDFExportQualityType.DPI600
opts.HideCropBoundaries = True
#This will use the TitleBlock size to create the sheet size
opts.PaperFormat = ExportPaperFormat.Default
#This will use a specific size for every view exported
opts.PaperFormat = ExportPaperFormat.ARCH_E1
opts.HideReferencePlane = True
opts.HideScopeBoxes = True
opts.HideUnreferencedViewTags = True
opts.MaskCoincidentLines = True
#Don't think of this as a "continue" but rather as a silent mode
opts.StopOnError = True
#Make sure to not use these settings as they don't work if 'Default' size is used above
opts.PaperPlacement = PaperPlacementType.LowerLeft
#Make sure to not use these settings as they don't work if 'Default' size is used above
opts.ZoomType = ZoomType.Zoom
#Make sure to not use these settings as they don't work if 'Default' size is used above
opts.ZoomPercentage = 100
opts.ViewLinksInBlue = False
3 Likes

There is also the option to use this set of nodes, revealed in the Orchid package…

3 Likes

And update to this is that with Hotfix 2022.0.1 now allows you to set some of these options while using Default for PaperFormat without breaking the method.

2022.0.1 Hotfix | Revit Products 2022 | Autodesk Knowledge Network