Background
Our company places multiple blocks per layout (and even Model Space). These blocks represent drawing formats. It is not uncommon to have 50 sheets per layout.
8 years ago (AutoCAD 2006), I created a utility using .Net that leveraged the plotting engine to create the appropriate PostScript and used GhostScript to obtain a multi-sheet .pdf file. Note that the multi-sheet pdf file contains sheets of different sizes.
It has worked great for 6 years. The pdf files were not "Feature Rich". User complaints related to search functionality and imbedded layer information were present.
We are upgrading to AutoCAD 2013. I have spent the past 4 days upgrading that solution. Here is what I have done.
I have a solution that creates a Page Setup for each page. After these page setups are created, I am able to manually use them to create individual pdf files. I am also able to programically create individual PDF's via the PlottingServices.PlotEngine.
I have created DSD files using two methods (compiling via DsdEntryCollection, etc,and via direct text tile).
When using Application.Publisher.PublishDsd(..) method, I get an error via the publishing log
Job: - Error(s) Did Not Plot
Job ID: 1
Sheet set name: SheetSetName Set for DWG No 2219679 : 4 Sheets - Publish via ACAD pdf
Date and time started: 8/13/2013 3:05:58 PM
Date and time completed: 8/13/2013 3:05:59 PM
UserID: csludtke
Profile ID: <<ACADMPP>>
Total sheets: 0
Sheets plotted: 0
Number of errors: 0
Number of warnings: 0
ERROR: Error
Subsequently, (using the same DSD) I manually (publish on the command line) load the dsd file:
I select 'Replace all sheets in the list"
I then click on "Publish" and I obtain the output that I want.
Here is a segment of the "PublishDSD" code.
Sheet: Size E Sheet 1 - Plotted
File: C:\temp\test3.dwg
Category name:
Page setup: BATC FS PDF SH 01
Device name: DWG To PDF.pc3 - plotted to file
Plot file path: C:\temp\test3.pdf
Paper size: ANSI E (44.0 x 34.00 Inches)
Image may be NSFW.
Clik here to view.Sheet: Size E Sheet 2 - Plotted
File: C:\temp\test3.dwg
Category name:
Page setup: BATC FS PDF SH 02
Device name: DWG To PDF.pc3 - plotted to file
Plot file path: C:\temp\test3.pdf
Paper size: ANSI E (44.0 x 34.00 Inches)
Image may be NSFW.
Clik here to view.Sheet: Size E Sheet 3 - Plotted
File: C:\temp\test3.dwg
Category name:
Page setup: BATC FS PDF SH 03
Device name: DWG To PDF.pc3 - plotted to file
Plot file path: C:\temp\test3.pdf
Paper size: ANSI E (44.0 x 34.00 Inches)
Image may be NSFW.
Clik here to view.Sheet: Size E Sheet 4 - Plotted
File: C:\temp\test3.dwg
Category name:
Page setup: BATC FS PDF SH 04
Device name: DWG To PDF.pc3 - plotted to file
Plot file path: C:\temp\test3.pdf
Paper size: ANSI E (44.0 x 34.00 Inches)
Does anyone have a vb example using PublishDSD?
Try WriteDSD() Dim CurrAcadDoc As Document = Application.DocumentManager.MdiActiveDocument Dim CurrAcadDB As Database = CurrAcadDoc.Database Using DSDDataFile As New DsdData Using PPD As PlotProgressDialog = New PlotProgressDialog(False, my_PresentFormats.BaseCollection.Count, True) PPD.PlotMsgString(PlotMessageIndex.DialogTitle) = "PDF Creation Progress" PPD.PlotMsgString(PlotMessageIndex.CancelJobButtonMessage) = "Cancel PDF Creation" PPD.PlotMsgString(PlotMessageIndex.CancelSheetButtonMessage) = "Cancel Sheet PDF Creation" PPD.PlotMsgString(PlotMessageIndex.SheetSetProgressCaption) = "Multi-sheet PDF Create job Progress" PPD.PlotMsgString(PlotMessageIndex.SheetProgressCaption) = "PDF Sheet Creation Progress" Dim oPublisher As Autodesk.AutoCAD.Publishing.Publisher = Autodesk.AutoCAD.ApplicationServices.Application.Publisher DSDDataFile.ReadDsd(DSDFileName) Dim strDWGName As String = CurrAcadDoc.Name Dim obj As Object = Application.GetSystemVariable("DWGTITLED") If System.Convert.ToInt16(obj) = 0 Then strDWGName = "C:\CAD Data\Drawing" & CStr(CInt(Rnd() * 1000)) & ".dwg" End If Dim PDFPlotConfig As PlotConfig = PlotConfigManager.SetCurrentConfig("DWG To PDF.pc3") CurrAcadDoc.Database.SaveAs(strDWGName, True, DwgVersion.Current, CurrAcadDoc.Database.SecurityParameters) Autodesk.AutoCAD.ApplicationServices.Application.Publisher.PublishDsd(DSDFileName, PPD) End Using 'Application.Publisher.PublishExecute(DSDDataFile, PDFPlotConfig) End Using Catch ex As System.Exception End Try
Clik here to view.
Clik here to view.
Clik here to view.
Clik here to view.
Clik here to view.
Clik here to view.