i have a rule who create my pdf file but i want to know if is possible to create with a password or with all layers in one and in a rule?
Thanks for your help!
Password isn't part of the SDK example for pdf output. Doesn't mean it couldn't be a hidden option though. It's also not part of the dialog fo saving a drawing to pdf from the main icon either.
My guess is that you'd need an pdf writer that can add a password that has that ability exposed in visual studio in order to do something like this.
If it is a hidden option in the Inventor PDF out options, it'd be nice to know 🙂
I give it a shot in the dark... Try the "Password" option.
You can get a translator Save Options using the code below (replace the ClsId with relevant translator AddIn):
Public Sub GetTranslatorSaveAsOptions() Dim clsId As String clsId = "{0AC6FD96-2F4D-42CE-8BE0-8AEA580399E4}" Dim oTranslator As TranslatorAddIn Set oTranslator = ThisApplication.ApplicationAddIns.ItemById(clsId) Dim Context As TranslationContext Set Context = ThisApplication.TransientObjects.CreateTranslationContext Context.Type = kFileBrowseIOMechanism Dim options As NameValueMap Set options = ThisApplication.TransientObjects.CreateNameValueMap Dim sourceObject As Object Set sourceObject = ThisApplication.ActiveDocument Dim index As Integer If oTranslator.HasSaveCopyAsOptions(sourceObject, Context, options) Then For index = 1 To options.count Debug.Print options.Name(index) & " = " & options.value(options.Name(index)) Next End If End Sub
Philippe.
Thanks for your reply Philippe 🙂
i dont know if i understand all, french Canadian guy here sorry 😉
your code with my Addin look same to that?
Dim oPDFAddIn As String oPDFAddIn = "{0AC6FD96-2F4D-42CE-8BE0-8AEA580399E4}" Dim oTranslator As TranslatorAddIn oTranslator = ThisApplication.ApplicationAddIns.ItemById(oPDFAddIn) Dim oContext As TranslationContext oContext = ThisApplication.TransientObjects.CreateTranslationContext oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism Dim options As NameValueMap oOptions = ThisApplication.TransientObjects.CreateNameValueMap Dim sourceObject As Object sourceObject = ThisApplication.ActiveDocument Dim index As Integer If oTranslator.HasSaveCopyAsOptions(sourceObject, Context, options) Then For index = 1 To options.count Debug.Print (options.Name(index) & " = " & options.Value(options.Name(index))) Next End If
This is what I was suggesting, but it doesn't seem to work... You will need to rely on a 3rd-party PDF SDK most likely, sorry for the bad news:
Public Sub PublishPDF() Dim PDFTranslator As TranslatorAddIn Set PDFTranslator = ThisApplication.ApplicationAddIns.ItemById( _ "{0AC6FD96-2F4D-42CE-8BE0-8AEA580399E4}") Dim doc As DrawingDocument Set doc = ThisApplication.ActiveDocument Dim ctx As TranslationContext Set ctx = ThisApplication.TransientObjects.CreateTranslationContext ctx.Type = kFileBrowseIOMechanism Dim options As NameValueMap Set options = ThisApplication.TransientObjects.CreateNameValueMap Dim medium As dataMedium Set medium = ThisApplication.TransientObjects.CreateDataMedium If PDFTranslator.HasSaveCopyAsOptions(doc, ctx, options) Then 'All available options options.value("All_Color_AS_Black") = 1 'options.Value("Animations") = 0 'options.Value("BOM_Parts_Only") = 1 'options.Value("BOM_Structured") = 1 'options.Value("Custom_Begin_Sheet") = 1 'options.Value("Custom_End_Sheet") = 1 'options.Value("Enable_Large_Assembly_Mode") = 0 'options.Value("Enable_Markup_Edits") = 1 'options.Value("Enable_Markups") = 1 'options.Value("Enable_Measure") = 1 'options.Value("Enable_Printing") = 1 'options.Value("Facet_Quality") = 69379 'options.Value("iAssembly_3D_Models") = 0 'options.Value("iAssembly_All_Members") = 0 'options.Value("Include_Empty_Properties") = 0 'options.Value("Include_Sheet_Tables") = 1 'options.Value("Instructions") = 0 'options.Value("iPart_3D_Models") = 0 'options.Value("iPart_All_Members") = 0 'options.Value("Launch_Viewer") = 0 'options.Value("Output_Path") = "c:\Temp\dwgout.pdf" 'options.Value("Override_Sheet_Color") = 0 options.value("Password") = "My Password" 'options.Value("Publish_3D_Models") = 0 'options.Value("Publish_All_Sheets") = 0 'options.Value("Publish_Component_Props") = 1 'options.Value("Publish_Mass_Props'") = 1 'options.Value("Publish_Mode") = 62721 'options.Value("Publish_Screenshot") = 0 'options.Value("Screenshot_DPI") = 96 'options.Value("Sheet_Color") = 14085613 'options.Value("Sheet_Metal_Flat_Pattern") = 0 'options.Value("Sheet_Metal_Part") = 1 'options.Value("Sheet_Metal_Style_Information") = 0 'options.Value("Sheet_Range") = 14081 'options.Value("Vector_Resolution") = 400 'options.Value("Weldment_Preparation") = 0 'options.Value("Weldment_Symbol") = 0 End If 'Set the destination file name medium.filename = "c:\Temp\dwgout.pdf" 'Publish document. Call PDFTranslator.saveCopyAs(doc, ctx, options, medium) End Sub
Philippe.
thanks for you help Philippe 🙂
Dont work for me, all layers is apparantes in my pdf 😞
and if i create manualy my pdf with a password option all layers is in one and locked
dont lock the pdf (
DOSSIER = ThisDoc.Path POSITION1 = InStrRev(DOSSIER, "\") POSITION2 = Right(DOSSIER, Len(DOSSIER) - POSITION1) oFileName = ThisDoc.FileName(False) 'without extension oFolder = "I:\DOCUMENTS\ARTICLES\" & POSITION2 & "\" myFile1 = oFolder & oFileName & ".PDF"
PDFTranslator = ThisApplication.ApplicationAddIns.ItemById( _ "{0AC6FD96-2F4D-42CE-8BE0-8AEA580399E4}")
Dim doc As DrawingDocument doc = ThisApplication.ActiveDocument
Dim oContext As TranslationContext oContext = ThisApplication.TransientObjects.CreateTranslationContext oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism
Dim oOptions As NameValueMap oOptions = ThisApplication.TransientObjects.CreateNameValueMap
Dim oDataMedium As dataMedium oDataMedium = ThisApplication.TransientObjects.CreateDataMedium
If PDFTranslator.HasSaveCopyAsOptions(doc, oContext, options) Then
'All available options oOptions.Value("All_Color_AS_Black") = 1 'options.Value("Animations") = 0 'options.Value("BOM_Parts_Only") = 1 'options.Value("BOM_Structured") = 1 'options.Value("Custom_Begin_Sheet") = 1 'options.Value("Custom_End_Sheet") = 1 'options.Value("Enable_Large_Assembly_Mode") = 0 'oOptions.Value("Enable_Markup_Edits") = 1 'oOptions.Value("Enable_Markups") = 1 'oOptions.Value("Enable_Measure") = 1 'options.Value("Enable_Printing") = 1 'options.Value("Facet_Quality") = 69379 'options.Value("iAssembly_3D_Models") = 0 'options.Value("iAssembly_All_Members") = 0 'options.Value("Include_Empty_Properties") = 0 'options.Value("Include_Sheet_Tables") = 1 'options.Value("Instructions") = 0 'options.Value("iPart_3D_Models") = 0 'options.Value("iPart_All_Members") = 0 'options.Value("Launch_Viewer") = 0 'options.Value("Output_Path") = "c:\Temp\dwgout.pdf" 'options.Value("Override_Sheet_Color") = 0 oOptions.Value("Password") = "1234" 'options.Value("Publish_3D_Models") = 0 'options.Value("Publish_All_Sheets") = 0 'options.Value("Publish_Component_Props") = 1 'options.Value("Publish_Mass_Props'") = 1 'options.Value("Publish_Mode") = 62721 'options.Value("Publish_Screenshot") = 0 'options.Value("Screenshot_DPI") = 96 'options.Value("Sheet_Color") = 14085613 'options.Value("Sheet_Metal_Flat_Pattern") = 0 'options.Value("Sheet_Metal_Part") = 1 'options.Value("Sheet_Metal_Style_Information") = 0 'options.Value("Sheet_Range") = 14081 'options.Value("Vector_Resolution") = 400 'options.Value("Weldment_Preparation") = 0 'options.Value("Weldment_Symbol") = 0 End If
'Set the destination file name NOM = oFolder & oFileName & ".PDF" oDataMedium.FileName = NOM
'Publish document. Call PDFTranslator.saveCopyAs(doc, oContext, oOptions, oDataMedium)
When you talk about creating the PDF manually: How exactly are you doing that? Could you please list the exact steps? Are you using a 3rd party PDF printer?
Hi,
The dialog that pops up when you click "Properties" inside the "Print Drawing" dialog is provided by the printer driver program. It's outside the realms of Inventor and I don't think the Inventor API will be of help here.
Maybe Adobe provides some ActiveX automation API to play with its printer's settings.
Someone was asking about similar PDF settings customisation here with no luck: https://forums.adobe.com/thread/1079735?start=0&tstart=0
Maybe you could modify those settings through changing some registry variables: http://www.adobe.com/devnet-docs/acrobatetk/tools/Wizard/pdfprinter.html
Cheers,
ok not with the printer 😞
It's possible to put all lines, all dimensions, all layers in one and not with many layers in pdf file???
Or any other mode?
Thanks for your help Adam 🙂
The product itself does not seem to support that option either.
Maybe you could do some post processing with a 3rd party tool (search for "merge pdf layers")
In theory you could move everything onto the same layer inside an Inventor drawing before publishing it to PDF and then revert everything back, but it could be quite cumbersome, because all objects are in different collections in the API: TextBoxes, SketchEntities, TitleBlock definition would need to be modified, etc.
You could log this feature request on the Inventor IdeaStation: https://forums.autodesk.com/t5/Inventor-IdeaStation/idb-p/v1232