How to export a multi sheet Inventor drawing into separate PDF

Multi sheet Inventor drawings should be exported into multiple single page PDF

Inventor doesn't provide a setting to export into multiple PDF so it is necessary to write some code. In order to generate multiple PDF an one export has to be executed per sheet. The way described in this article will setup the export to print the currently active sheet only and iterates through all sheets.

The article will describe the necessary steps to generate multiple PDF. It will not describe a full job or what to do with those PDF.

Take a look at the Sample.CreateDXFfromDrawing job to see how to handle multiple files

When doing this it is best to have a dedicated job for Inventor only, as mixing this with an AutoCAD export will be harder to maintain.

Loop through all sheets

First a loop is required that iterates through all sheets. We also define a sheet counter that will be used when generating the PDF name. The index is incremented immediately to match the actual index of the sheet, as Inventor starts with 1. This is better than incrementing it at the end as it ensures the index is incremented properly even if a continue statement is added to the loop in the future

loop

Activate the sheet to be exported

As we will change the export to only print the currently active file we need to activate each sheet. This is done with the Activate() method on the sheet object.

activate

Generate file name for current sheet

Because multiple pages might be generated they need to have unique names, otherwise the first PDF would be overridden by the second PDF. The most simple solution is to just add underscore and the index number to the name.

name_gen

Setting the sheet range for the export

The last thing to do is to tell the Export-Document cmdlet to only print the currently active sheet. This is done by setting the Sheet_range to 14081 as described in the documentation

set_sheetrangeThis could also be done in the config file. In this case the -OnExport parameter could be left out.

sheet_range_in_config