- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I previously had a rule that would export PDF copies of prints without issue:
SyntaxEditor Code Snippet
modelname=IO.Path.GetFileName(ThisDrawing.ModelDocument.FullFileName) ofilename=ThisDoc.FileName(False) opath="O:\CAD\Released Sales Cads\2017\"+iProperties.Value(modelname,"Custom","PRODUCT_LINE") opdfaddin=ThisApplication.ApplicationAddins.ItembyID("{0AC6FD96-2F4D-42CE-8BE0-8AEA580399E4}") oDocument=ThisApplication.ActiveDocument oContext=ThisApplication.TransientObjects.CreateTranslationContext oContext.Type=IOMechanismEnum.kFileBrowseIOMechanism oOptions=ThisApplication.TransientObjects.CreateNameValueMap oDataMedium=ThisApplication.TransientObjects.CreateDataMedium oOptions.Value("All_Color_AS_Black")=0 oOptions.Value("Remove_Line_Weights")=0 oOptions.Value("Vector_Resolution")=4800 oOptions.Value("Sheet_Range")=Inventor.PrintRangeEnum.kPrintAllSheets odatamedium.FileName=opath & "\" & ofilename & ".pdf" oPDFAddin.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium)
But the exported PDFs would have a layer visibility section when opened in Adobe Reader, since it's not optional to turn this option off during export, I have to resort to using the "Microsoft Print to PDF" during printing. Here's the code as I have it now:
SyntaxEditor Code Snippet
oPrintMgr=ThisApplication.ActiveDocument.PrintManager oPrintMgr.Printer="Microsoft Print to PDF" oPrintMgr.ColorMode=kPrintDefaultColorMode oPrintMgr.Orientation=kLandscapeOrientation oPrintMgr.Scale=kPrintBestFitScale oPrintMgr.PaperSize=kPaperSizeC oPrintMgr.SubmitPrint '[ This area needs completion! pdfname=ThisDoc.FileName(False) modelname=IO.Path.GetFileName(ThisDoc.ModelDocument.FullFileName) filepath="O:\CAD\Released Sales Cads\2017\"+iProperties.Value(modelname,"Custom","PRODUCT_LINE") 'Create file dialog operation to automatically select correct folder via "filepath" and correct file name via "pdfname" ']
The print options code is working fine, but after that's finished I'm presented with a file dialog box for me to navigate to the folder I want and type in the correct file name.
What is the code to automatically save this pdf print using "pdfname" as the filename and "filepath" as the directory to save the file?
Thanks for your time.
Solved! Go to Solution.