<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Using the PDF Translator with Inventor 2016 API in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/using-the-pdf-translator-with-inventor-2016-api/m-p/6562190#M66795</link>
    <description>&lt;P&gt;Thanks for the response!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I replaced the&amp;nbsp;line&amp;nbsp;If oPDFAddIn.HasSaveCopyAsOptions(oDataMedium, oContext, oOptions) with&amp;nbsp;If oPDFAddIn.HasSaveCopyAsOptions(doc, oContext, oOptions), but I still received the same error. I even copy and pasted the code in the above post, and still received the same error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've resorted to using Foxit PDF printer for now, but I would much rather use the Inventor Translator so that Foxit installation is not a prerequisite for using my application.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Rohan Jhunjhunwala&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 14 Sep 2016 16:59:55 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2016-09-14T16:59:55Z</dc:date>
    <item>
      <title>Using the PDF Translator with Inventor 2016 API</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/using-the-pdf-translator-with-inventor-2016-api/m-p/6547673#M66656</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am trying to write a VBA function that saves PDF files automatically. I have been using Document.SaveAs(), however I need to be able to control the sheet range that is exported. My function is as follows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;  Public Sub SaveAsPDF(ByVal doc As Document)
        Dim oPDFAddIn As TranslatorAddIn
        oPDFAddIn = _invApp.ApplicationAddIns.ItemById _
        ("{0AC6FD96-2F4D-42CE-8BE0-8AEA580399E4}")
        Dim oContext As TranslationContext
        oContext = _invApp.TransientObjects.CreateTranslationContext
        oContext.Type = kFileBrowseIOMechanism
        Dim oOptions As NameValueMap
        oOptions = _invApp.TransientObjects.CreateNameValueMap
        Dim oDataMedium As DataMedium
        oDataMedium = _invApp.TransientObjects.CreateDataMedium

        If oPDFAddIn.HasSaveCopyAsOptions(oDataMedium, oContext, oOptions) Then
            oOptions.Value("All_Color_AS_Black") = 1
            oOptions.Value("Remove_Line_Weights") = 1
            oOptions.Value("Vector_Resolution") = 400
            oOptions.Value("Sheet_Range") = Inventor.PrintRangeEnum.kPrintAllSheets

        End If


        'Set the PDF target file name
        oDataMedium.FileName = "C:\test.pdf"
        'Publish document
        oPDFAddIn.SaveCopyAs(doc, oContext, oOptions, oDataMedium)

    End Sub&lt;/PRE&gt;&lt;P&gt;When I run the function, passing it the open document (which is a drawing) I get a message in Inventor that says "Failed to publish DWF file" and when I click cancel I get the following error in my MSVS debugger on the oPDFAddIn.SaveCopyAs(doc, oContext, oOptions, oDataMedium) line:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="error.PNG" style="width: 599px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/270755i76E7915532EF9E4F/image-size/large?v=v2&amp;amp;px=999" role="button" title="error.PNG" alt="error.PNG" /&gt;&lt;/span&gt;﻿&lt;/P&gt;&lt;P&gt;I verified that&amp;nbsp;{0AC6FD96-2F4D-42CE-8BE0-8AEA580399E4} is the PDF translator ID, and even tried&amp;nbsp;{0AC6FD95-2F4D-42CE-8BE0-8AEA580399E4}, which is the DWF translator.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any guidance would be much appreciated!&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Rohan Jhunjhunwala&lt;/P&gt;</description>
      <pubDate>Wed, 07 Sep 2016 17:55:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/using-the-pdf-translator-with-inventor-2016-api/m-p/6547673#M66656</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-09-07T17:55:18Z</dc:date>
    </item>
    <item>
      <title>Re: Using the PDF Translator with Inventor 2016 API</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/using-the-pdf-translator-with-inventor-2016-api/m-p/6560683#M66787</link>
      <description>&lt;P&gt;The first argument to HasSaveCopyAsOptions should be the document, not the DataMedium object.&amp;nbsp; Here's a version of your function that is working for me to print sheet 2 and 3.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Public Sub SaveAsPDF2(ByVal doc As Document)
    ' Get the PDF translator Add-In.
    Dim PDFAddIn As TranslatorAddIn
    Set PDFAddIn = ThisApplication.ApplicationAddIns.ItemById("{0AC6FD96-2F4D-42CE-8BE0-8AEA580399E4}")

    Dim oContext As TranslationContext
    Set oContext = ThisApplication.TransientObjects.CreateTranslationContext
    oContext.Type = kFileBrowseIOMechanism

    ' Create a NameValueMap object
    Dim oOptions As NameValueMap
    Set oOptions = ThisApplication.TransientObjects.CreateNameValueMap

    ' Create a DataMedium object
    Dim oDataMedium As DataMedium
    Set oDataMedium = ThisApplication.TransientObjects.CreateDataMedium

    ' Check whether the translator has 'SaveCopyAs' options
    If PDFAddIn.HasSaveCopyAsOptions(doc, oContext, oOptions) Then
        oOptions.value("All_Color_AS_Black") = 0
        oOptions.value("Remove_Line_Weights") = 0
        oOptions.value("Vector_Resolution") = 400
        oOptions.value("Sheet_Range") = kPrintSheetRange
        oOptions.value("Custom_Begin_Sheet") = 2
        oOptions.value("Custom_End_Sheet") = 3
    End If

    'Set the destination file name
    oDataMedium.filename = "c:\temp\test2.pdf"

    'Publish document.
    Call PDFAddIn.SaveCopyAs(doc, oContext, oOptions, oDataMedium)
End Sub&lt;/PRE&gt;</description>
      <pubDate>Wed, 14 Sep 2016 02:43:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/using-the-pdf-translator-with-inventor-2016-api/m-p/6560683#M66787</guid>
      <dc:creator>ekinsb</dc:creator>
      <dc:date>2016-09-14T02:43:41Z</dc:date>
    </item>
    <item>
      <title>Re: Using the PDF Translator with Inventor 2016 API</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/using-the-pdf-translator-with-inventor-2016-api/m-p/6562190#M66795</link>
      <description>&lt;P&gt;Thanks for the response!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I replaced the&amp;nbsp;line&amp;nbsp;If oPDFAddIn.HasSaveCopyAsOptions(oDataMedium, oContext, oOptions) with&amp;nbsp;If oPDFAddIn.HasSaveCopyAsOptions(doc, oContext, oOptions), but I still received the same error. I even copy and pasted the code in the above post, and still received the same error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've resorted to using Foxit PDF printer for now, but I would much rather use the Inventor Translator so that Foxit installation is not a prerequisite for using my application.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Rohan Jhunjhunwala&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Sep 2016 16:59:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/using-the-pdf-translator-with-inventor-2016-api/m-p/6562190#M66795</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-09-14T16:59:55Z</dc:date>
    </item>
    <item>
      <title>Re: Using the PDF Translator with Inventor 2016 API</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/using-the-pdf-translator-with-inventor-2016-api/m-p/6562193#M66796</link>
      <description>&lt;P&gt;The code that I pasted in works for me. &amp;nbsp;There must be something different on your system that's causing the problem. &amp;nbsp;Unfortunately, I don't have any ideas what that might be. &amp;nbsp;Do you have access to another computer that you could try it on to see if it's somehow machine specific?&lt;/P&gt;</description>
      <pubDate>Wed, 14 Sep 2016 17:02:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/using-the-pdf-translator-with-inventor-2016-api/m-p/6562193#M66796</guid>
      <dc:creator>ekinsb</dc:creator>
      <dc:date>2016-09-14T17:02:24Z</dc:date>
    </item>
  </channel>
</rss>

