Message 1 of 6
ilogic export in pdf all black but company logo in color, is possible?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I would like to export all black drawing to PDF but with the company logo layers is it possible?
Can anyone help me?
‘esporta PDF in bianco e nero ma logo acolori
path_and_name = ThisDoc.PathAndFileName(False)
pdfAddIn = ThisApplication.ApplicationAddIns.ItemById("{0AC6FD95-2F4D-42CE-8BE0-8AEA580399E4}")
oDocument = ThisApplication.ActiveDocument
oContext = ThisApplication.TransientObjects.CreateTranslationContext
oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism
oOptions = ThisApplication.TransientObjects.CreateNameValueMap
oDataMedium = ThisApplication.TransientObjects.CreateDataMedium
i = MessageBox.Show("Launch the viewer now?", "Title",MessageBoxButtons.YesNo)
If i = vbYes Then : launchviewer = 1 : Else : launchviewer = 0 : End If
If pdfAddIn.HasSaveCopyAsOptions(oDataMedium, oContext, oOptions) Then
'oOptions.Value("All_Color_AS_Black") = 1
oOptions.Value("Launch_Viewer") = launchviewer
oOptions.Value("Publish_All_Component_Props") = 1
oOptions.Value("Publish_All_Physical_Props") = 1
oOptions.Value("Password") = 0
Dim oDrawDoc As DrawingDocument
oDrawDoc = ThisApplication.ActiveDocument
' Set a reference to the active sheet.
Dim oActiveSheet As Sheet
oActiveSheet = oDrawDoc.ActiveSheet
' Create a Drawing View Object
''Dim layers As LayersEnumerator
''Dim oLayer As Layer
''Dim colorLayer As Layer
'' ''Set colorLayer = layers.Item(color.Name)
'' colorLayer = layers.Item(0, 0, 0)
''For Each oLayer In oDrawDoc.StylesManager.Layers
'' 'layers = drawDoc.StylesManager.Layers
'' 'ThisDrawing.Document.StylesManager.Layers.Item.Color
'' ThisApplication.TransientObjects.CreateColor(0, 0, 0) ' black
'' Next
Dim LayerCollection As LayersEnumerator = ThisDoc.Document.StylesManager.Layers
Dim Layer As Layer
'loop through LayerCollection
For Each Layer In LayerCollection
'assumption If DWG is in the name then alway the first 3 letters!
'Dim layerName As String = Layer.Name
'Dim first3Letters As String = Strings.Left(layerName, 3)
'If first3Letters = "DWG" Then
'change color
'Color Black
Dim oColor As Color = Layer.Color
oColor.Red = 0
oColor.Green = 0
oColor.Blue = 0
Layer.Color = oColor
'End If
Next
ThisDrawing.Document.StylesManager.Layers(“company logo1").Color =
ThisApplication.TransientObjects.CreateColor(0, 0, 255) ' blue <-- inserisci colore
ThisDrawing.Document.StylesManager.Layers("company logo2").Color =
ThisApplication.TransientObjects.CreateColor(255, 127, 0) ' orange ' by Leocata Luca '<-- inserisci colore
If TypeOf oDocument Is DrawingDocument Then
'oOptions.Value("Publish_Mode") = pdfPublishModeEnum.kCustompdfPublish
oOptions.Value("Publish_All_Sheets") = 1
End If
End If
oDataMedium.FileName = path_and_name & "_2D.pdf"
Call pdfAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium)
If launchviewer = 1 Then ThisDoc.Launch(path_and_name & "_2D.pdf")
'''--xx—restor original color --- ripristina colori