Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
rjay75
in reply to: Anonymous

If you're just trying to save a pdf file honoring the papersizes and the PDFCreator printer isn't adding anything special to the pdfs you can use the builtin pdf exporter in Inventor. 

 

Here's code to export a drawing document as a pdf excluding non printing sheets.

 

ThisDoc.Document can be replaced by oDrawDoc2 in your code.

 

SyntaxEditor Code Snippet

Dim ctx As TranslationContext = ThisApplication.TransientObjects.CreateTranslationContext()
ctx.Type = IOMechanismEnum.kFileBrowseIOMechanism
Dim nvp As NameValueMap = ThisApplication.TransientObjects.CreateNameValueMap()
Dim dm As DataMedium = ThisApplication.TransientObjects.CreateDataMedium()
Dim _pdfAddin As TranslatorAddIn = ThisApplication.ApplicationAddIns.ItemById("{0AC6FD96-2F4D-42CE-8BE0-8AEA580399E4}")

If _pdfAddin.HasSaveCopyAsOptions(dwgDoc, ctx, nvp) Then
    nvp.Value("Launch_Viewer") = 0
    nvp.Value("All_Color_AS_Black") =  1
    nvp.Value("Remove_Line_Weights") =  0
    nvp.Value("Vector_Resolution") = 600
    nvp.Value("Publish_3D_Models") = 0
    nvp.Value("Override_Sheet_Color") = 1
    nvp.Value("Sheet_Color") = &HFFFFFF

    nvp.Value("Publish_All_Sheets") = 0
    nvp.Value("Publish_Mode") = DWFPublishModeEnum.kCustomDWFPublish
    nvp.Value("Sheet_Range") = PrintRangeEnum.kPrintSheetRange
    Dim sheets As NameValueMap = ThisApplication.TransientObjects.CreateNameValueMap()
    Dim sheetInfo As NameValueMap = Nothing
    Dim cSheet As Integer = 1
    For Each sheet As Sheet In ThisDoc.Document.Sheets
        'Include If Not excluded Or include no Print Is checked.
        If Not sheet.ExcludeFromPrinting
            sheetInfo = ThisApplication.TransientObjects.CreateNameValueMap()
            sheetInfo.Value("Name") = sheet.Name
            cSheet = cSheet + 1
            sheets.Value("Sheet" & cSheet) = sheetInfo
        End If
    Next
    nvp.Value("Sheets") = sheets
End If
Dim fileName = ThisDoc.Document.FullFileName
dm.FileName = String.Format("{0}\\{1}.pdf", System.IO.Path.GetDirectoryName(fileName), System.IO.Path.GetFileNameWithoutExtension(fileName))
_pdfAddin.SaveCopyAs(ThisDoc.Document, ctx, nvp, dm)