Incorrect Paper Size while Publishing PDF

Incorrect Paper Size while Publishing PDF

Anonymous
Not applicable
720 Views
0 Replies
Message 1 of 1

Incorrect Paper Size while Publishing PDF

Anonymous
Not applicable

When I publish the drawing "WSC53109-012.dwg" to share then the sheet size changes from “A0” to “A2” on PDF file.
I am using the following code to publish the drawing in PDF:
Using dsdDwgFiles As New DsdEntryCollection

' Add first drawing file
Using dsdDwgFile1 As New DsdEntry

' Set the file name and layout
dsdDwgFile1.DwgName = dwg.FullName
dsdDwgFile1.Layout = dwg.ActiveLayout.Name
dsdDwgFile1.Title = filename

' Set the page setup override
dsdDwgFile1.Nps = ""
dsdDwgFile1.NpsSourceDwg = ""

dsdDwgFiles.Add(dsdDwgFile1)
End Using

' Set the properties for the DSD file and then write it out
Using dsdFileData As New DsdData

' Set the target information for publishing
dsdFileData.DestinationName = docData.MainFileName
dsdFileData.ProjectPath = localPubFolder
dsdFileData.SheetType = SheetType.SinglePdf

' Set the drawings that should be added to the publication
dsdFileData.SetDsdEntryCollection(dsdDwgFiles)

' Set the general publishing properties
dsdFileData.LogFilePath = localPubFolder & "myBatch.txt"

' Create the DSD file
dsdFileData.WriteDsd(localPubFolder &
"batchdrawings2.dsd")

Try
' Publish the specified drawing files in the DSD file, and
' honor the behavior of the BACKGROUNDPLOT system variable
Using dsdDataFile As New DsdData
dsdDataFile.ReadDsd(localPubFolder &
"batchdrawings2.dsd")

' Get the AutoCAD PDF (High Quality Print).pc3 and use it as a
' device override for all the layouts
Dim acPlCfg As PlotConfig = PlotConfigManager.SetCurrentConfig("AutoCAD PDF (High Quality Print).pc3")
dwg.SetVariable("BACKGROUNDPLOT", 0)

Autodesk.AutoCAD.ApplicationServices.Application.Publisher.PublishExecute(dsdDataFile, acPlCfg)
End Using

Catch es As Autodesk.AutoCAD.Runtime.Exception
MsgBox(es.Message)
Finally
If System.IO.File.Exists(localPubFolder & "batchdrawings2.dsd") Then
File.Delete(localPubFolder & "batchdrawings2.dsd")
End If
End Try

End Using
End Using

Then I tried to set the paper size using PlotSettingsValidator.SetCanonicalMediaName method. But I am the getting "Inavlid Input Error" on setting the page size to ISO_A0_(1189.00_x_841.00_MM).

How can I set the page size to ISO_A0_(1189.00_x_841.00_MM) while publishing on PDF?
I am using AutoCAD 2018 and VB.Net to implement it.
Please provide some sample code if possible

0 Likes
721 Views
0 Replies
Replies (0)