- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I'm using the PDF Translator AddIn via the API to export drawings to PDF. But when I opened the PDF the views appear blurred.
I thought the reason could be that the drawing is exported before being updated. However I tried it, but it still didn't work. I also tried with "DrawingDocument.MakeAllViewsPrecise, but nothing has changed.
Any suggestion?
Set oAsmDrawDoc = ThisApplication.ActiveDocument
'Update drawing before exporting to PDF
oAsmDrawDoc.Update2 (True)
'Make all the views precise
oAsmDrawDoc.MakeAllViewsPrecise
If oAsmDrawDoc.Update2(True) = True Then
'Call Sub Export PDF (save drawings as PDF)
ExportPDF
'Save the updated document
oAsmDrawDoc.Save2 (True)
'Close AsmDrawDoc and active oAsm again
oAsmDrawDoc.Close
End If
Thanks in advance
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
' 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
' Check if the Document Type is a drawing. If it isn't, display a message & exit the Sub.
If (oDocument.DocumentType <> kDrawingDocumentObject) Then
MsgBox "Drawing document not available for Plotting, switch to Drawing Document", , "Drawing not found"
Set oDocument = Nothing
Exit Sub
End If
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("All_Color_AS_Black") = 0
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Dim oAsmDoc As DrawingDocument
Set oAsmDoc = ThisApplication.ActiveDocument
oAsmDoc.Update2 (True)
oAsmDoc.Save2 (True)
End Sub
Dim oAsmDoc As DrawingDocument
Set oAsmDoc = ThisApplication.ActiveDocument
oAsmDoc.Update2 (True)
If oAsmDoc.Update2(True) = True Then
oAsmDoc.Save2 (True)
End If
'Call Sub Export PDF through API
ExportPDF
End Sub
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I used to have that problem when the option "enable background updates" for drawings is enabled. inventor just starts those background processes (something like invviewcompute.exe or so) but the macro continues to run, doesn't wait for those processes to complete. In my case, I disable this option in my macro before updating the views, then re-enable it after the pdf is exported.