Search code examples
vb.netautocadautodesk-designautomation

How to edit an AutoCAD PC3 file programmatically


I want to be able to add more default/custom paper sizes to a user's "DWG to PDF" PC3 file in AutoCAD, (or at least be able to read it) but the only way seems to be using the interface that AutoCAD provides. I know where the PC3 files are located, yet when I open one using something like Notepad, it seems to be compressed. I would like to be able to add to them using Visual Studio/VB.NET. There has to be a way to do this programmatically.

The file's header says: PIAFILEVERSION_2.0,PC3VER1,compress


Solution

  • It seems that it is not possible, so I looked into other options for "printing" to a PDF file. Microsoft has an option in the Printer selection dropdown called Microsoft Print to PDF that can also be used to accomplish custom paper sizes without the need to modify a PC3 file. Custom paper sizes can be added to the underlying files programmatically, but it's a bit complex, involving reading the registry, and reading/writing to a system spool folder, with one of the files (XML file) needing to be saved in UTF8 No BOM format.

    I do not wish to plagiarize someone else's work, nor do I want to recreate such a complex answer/solution, so instead I will provide this link to a Microsoft answers forum in case another person is interested in the solution:

    Microsoft Print to PDF - Custom Paper Sizes