Announcements

Announcement: We’re aware of an issue affecting starting a new topic from category pages and creating new blog posts. New topics can still be started directly from the relevant board. Learn more here.

Specify Paper Size (Canonical Media Name) When Publishing in C#

Specify Paper Size (Canonical Media Name) When Publishing in C#

mcoH3VZV
Advocate Advocate
680 Views
1 Reply
Message 1 of 2

Specify Paper Size (Canonical Media Name) When Publishing in C#

mcoH3VZV
Advocate
Advocate

 

Hi, in the below code, I am publishing a list of drawings using the standard DWG to PDF pc3. I am wondering if you can specify per drawing or per set, the CanonicalMediaName? maybe as a setting similar to this?

newFile.Append("PaperSize=ANSI expand B (11.00 x 17.00 Inches)\r\n");

 

I've even tried changing the default in the DWG to PDF.pc3 on my C drive, and it doesn't seem to take. Either way, I'd prefer to do this with code.

Thanks,

 

 

                using (DsdData dsdDataFile = new DsdData())
                {
                    dsdDataFile.ReadDsd(FileName);
                    PlotConfig acPlCfg = PlotConfigManager.SetCurrentConfig("DWG to PDF.PC3");
                    Autodesk.AutoCAD.ApplicationServices.Application.Publisher.PublishExecute(dsdDataFile, acPlCfg);
                }

 

 

0 Likes
681 Views
1 Reply
Reply (1)
Message 2 of 2

Norman_Yuan
Mentor
Mentor

The Publish API is only meant to publish EXISTING layouts, that is, the the Layouts have had their plotsettings configured.

 

Dsd file to the Publish API is like a plotting script, which does not provide ways for Publish API to go into an existing Layout to manipulate its PlotSetting details.

 

If you want to set up the PlotSettings dynamically, you can go through the process of configuring PlotSettings and then use PlotEngine to to the plot (thus, do not need to use Publish API), or you have to update the layout's PlotSettings and save the change, then use Publish API to publish

Norman Yuan

Drive CAD With Code

EESignature

0 Likes