Poor PDF quality using PDF Translator AddIn

Poor PDF quality using PDF Translator AddIn

IQUADRATAG
Contributor Contributor
1,863 Views
7 Replies
Message 1 of 8

Poor PDF quality using PDF Translator AddIn

IQUADRATAG
Contributor
Contributor

Hello,

 

I'm using the PDF Translator AddIn via the API to export drawings to PDF. Unfortunately, some of the exported PDFs have a very poor quality. Exporting the same drawing via Inventor produces a much better result. Settings are the same for both ways (resolution 400, color, remove line weights).

 

Does anyone know about this issue?

 

Thank you in advance.

 

Regards,

Christian

 

Edit: Inventor 2015 Professional

0 Likes
Accepted solutions (1)
1,864 Views
7 Replies
Replies (7)
Message 2 of 8

frederic.vandenplas
Collaborator
Collaborator

Does Raster View Only has something to do with?

Make sure the views are all "precise" before export.

 

https://knowledge.autodesk.com/support/inventor-products/troubleshooting/caas/sfdcarticles/sfdcartic...

 

 

If you think this answer fullfilled your needs, improved your knowledge or leads to a solution,
please feel free to "kudos"
0 Likes
Message 3 of 8

IQUADRATAG
Contributor
Contributor

Hi Frederic,

 

thank you for your answer. I have checked that, all sheets are on precise.

 

Regards,

Christian

0 Likes
Message 4 of 8

frederic.vandenplas
Collaborator
Collaborator

Hi,

 

I suggest to attach the drawing and the code you are using to see if it is the same result on my machine.

Is it for this drawing only or all drawings?

If you think this answer fullfilled your needs, improved your knowledge or leads to a solution,
please feel free to "kudos"
0 Likes
Message 5 of 8

IQUADRATAG
Contributor
Contributor

Thanks again for your support.

 

Please find attached the idw (IV2015) and the pdf output. Only a few drawings behave like this.

 

This is the vb.net code I'm using:

 

Dim oPDFTrans As TranslatorAddIn
oPDFTrans = m_inventorApp.ApplicationAddIns.ItemById( _
                        "{0AC6FD96-2F4D-42CE-8BE0-8AEA580399E4}")
If oPDFTrans Is Nothing Then
    MsgBox("Could not access PDF translator.")
    Exit Function
End If

Dim oContext As TranslationContext
oContext = m_inventorApp.TransientObjects.CreateTranslationContext
Dim oOptions As NameValueMap
oOptions = m_inventorApp.TransientObjects.CreateNameValueMap
If oPDFTrans.HasSaveCopyAsOptions(m_inventorApp.ActiveDocument, _
                        oContext, oOptions) Then
    ' Set to print all sheets.  This can also have the value 
    ' kPrintCurrentSheet or kPrintSheetRange. If kPrintSheetRange 
    ' is used then you must also use the CustomBeginSheet and 
    ' Custom_End_Sheet to define the sheet range. 
    oOptions.Value("Sheet_Range") = PrintRangeEnum.kPrintAllSheets
    oOptions.Value("All_Color_AS_Black") = 0
    oOptions.Value("Remove_Line_Weights") = 1

    ' Define various settings and input to provide the translator. 
    oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism
    Dim oData As DataMedium
    oData = m_inventorApp.TransientObjects.CreateDataMedium
    oData.FileName = targetFilename

    ' Call the translator. 
    Call oPDFTrans.SaveCopyAs(m_inventorApp.ActiveDocument, _
                                      oContext, oOptions, oData)
End If

Regards,

Christian

Message 6 of 8

frederic.vandenplas
Collaborator
Collaborator
Accepted solution

Hi,

 

I've tried it with the code from the sample program in Inventor and the pdf is perfect (vba)

I can't help more then that 😞

 

Public Sub PublishPDF()
    ' Get the PDF translator Add-In.
    Dim PDFAddIn As TranslatorAddIn
    Set PDFAddIn = ThisApplication.ApplicationAddIns.ItemById("{0AC6FD96-2F4D-42CE-8BE0-8AEA580399E4}")

    'Set a reference to the active document (the document to be published).
    Dim oDocument As Document
    Set oDocument = ThisApplication.ActiveDocument

    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(oDocument, oContext, oOptions) Then

        ' Options for drawings...
    oOptions.Value("Sheet_Range") = PrintRangeEnum.kPrintAllSheets
    oOptions.Value("All_Color_AS_Black") = 0
    oOptions.Value("Remove_Line_Weights") = 1
       
        'oOptions.Value("Remove_Line_Weights") = 0
        'oOptions.Value("Vector_Resolution") = 400
        'oOptions.Value("Sheet_Range") = kPrintAllSheets
        'oOptions.Value("Custom_Begin_Sheet") = 2
        'oOptions.Value("Custom_End_Sheet") = 4
    End If

    'Set the destination file name
    oDataMedium.FileName = "c:\temp\test.pdf"

    'Publish document.
    Call PDFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium)
End Sub
If you think this answer fullfilled your needs, improved your knowledge or leads to a solution,
please feel free to "kudos"
Message 7 of 8

IQUADRATAG
Contributor
Contributor

Hi Frederic,

 

I tested it again on different machines and I got different results. So I think it has nothing to do with my code and also not with the idw file, but with the Inventor installation or the inventor settings.

 

Thank you very much for your support.

 

Regards,

Christian

0 Likes
Message 8 of 8

J_Dumont
Advocate
Advocate

Hello,

 

I am having the same issue.

I am using the code as described in the Inventor API documentation.

 

I originally wrote the code in VB.Net as a plug-in and the PDF files look great. However, I have recently created an Add-in to be more seamless with Inventor but the PDF files are terrible. I tested the Add-in on several computers and all had the same result.

 

Here is the code from my add-in:

 

Public Sub PublishPDF(ByRef DrawingFName As String)

'MsgBox("drawing name: " + DrawingFName.Replace("*.idw", ""))

Dim DrawingDocument As Inventor.Document = g_inventorApplication.Documents.Open(DrawingFName, False)

Dim PDFAddIn As Inventor.TranslatorAddIn
PDFAddIn = g_inventorApplication.ApplicationAddIns.ItemById("{0AC6FD96-2F4D-42CE-8BE0-8AEA580399E4}")
Dim oContext As Inventor.TranslationContext
oContext = g_inventorApplication.TransientObjects.CreateTranslationContext
oContext.Type = Inventor.IOMechanismEnum.kFileBrowseIOMechanism
Dim oOptions As Inventor.NameValueMap
oOptions = g_inventorApplication.TransientObjects.CreateNameValueMap
Dim oDataMedium As Inventor.DataMedium
oDataMedium = g_inventorApplication.TransientObjects.CreateDataMedium

If PDFAddIn.HasSaveCopyAsOptions(DrawingDocument, oContext, oOptions) Then
oOptions.Value("All_Color_AS_Black") = My.Settings.PDFAllColorsAsBlack
oOptions.Value("Remove_Line_Weights") = My.Settings.PDFLineweight
oOptions.Value("Vector_Resolution") = My.Settings.PDFVectorResolution
oOptions.Value("Sheet_Range") = Inventor.PrintRangeEnum.kPrintAllSheets
End If

'These two lines check to see if the assembly drawing is published
'Add an "_" as the file prefix for sorting so the assembly file is first to be merged.
Dim assName As String = g_inventorApplication.ActiveDocument.DisplayName.Replace(".iam", "")
Dim drwName As String = System.IO.Path.GetFileNameWithoutExtension(DrawingFName)

'MsgBox("drawing name: " + DrawingFName)
Dim oDrawName As String ' Use to store drawing filename. Remove path, extension and replace with PDFFoldername and pdf extension
If assName = drwName Then
oDrawName = PDFFolderName + "\" + "_" + System.IO.Path.GetFileNameWithoutExtension(DrawingFName) + ".pdf"
'MsgBox("yes, assy file")
Else
oDrawName = PDFFolderName + "\" + System.IO.Path.GetFileNameWithoutExtension(DrawingFName) + ".pdf"
End If

oDataMedium.FileName = oDrawName

Try
Call PDFAddIn.SaveCopyAs(DrawingDocument, oContext, oOptions, oDataMedium)
DrawingDocument.Close()
Catch
End Try


End Sub

 

0 Likes