<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Create PDF File from some Layouts only in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/create-pdf-file-from-some-layouts-only/m-p/6262638#M36492</link>
    <description>&lt;P&gt;&lt;SPAN&gt;hi&amp;nbsp;BKSpurgeon&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;thx for the advice works great&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;see even debug messages from autocad coming threw&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;but was create another solution&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;was fix it by creating a pagesetup for every ;layout threw the database&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;and that works fine and then i make a publish of all to&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;and now i was try the catch exception and now it runs till the end&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;i gonna try today to break it again like i did before and then debug with the try exception&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;and will report back if i know more&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;but thx for the advice will use this in the future&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 11 Apr 2016 06:37:47 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2016-04-11T06:37:47Z</dc:date>
    <item>
      <title>Create PDF File from some Layouts only</title>
      <link>https://forums.autodesk.com/t5/net-forum/create-pdf-file-from-some-layouts-only/m-p/6245684#M36485</link>
      <description>&lt;P&gt;hello everybody&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;get an fatal error when &amp;nbsp;to try to plot ,mulitiple layouts in multiple files&lt;/P&gt;&lt;P&gt;i detect the format of the drawing and make from there my plot to pdf&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;  &amp;lt;CommandMethod("PUB1")&amp;gt; _
    Public Shared Sub Publish1()
        Dim openfdail As New OpenFileDialog("Select Drawings", Nothing, "dwg; dwf; *", "selfile", OpenFileDialog.OpenFileDialogFlags.AllowMultiple)

        Dim dr1 As System.Windows.Forms.DialogResult = openfdail.ShowDialog()

        If dr1 = System.Windows.Forms.DialogResult.OK Then
            Dim filenames() As String = openfdail.GetFilenames
            Dim file As String
            Dim filename As String = String.Empty
            Dim plotdir As String = "c:\plot\"
            Dim formaat As String = String.Empty
            ' Get the current document and database, and start a transaction
            Dim acDoc As Document = Application.DocumentManager.MdiActiveDocument
            Dim ed As Editor = acDoc.Editor
            Dim oldDb As Database = HostApplicationServices.WorkingDatabase
            For Each file In filenames
                filename = System.IO.Path.GetFileNameWithoutExtension(file)
                'Check if drawing is a reference file if so dont plot
                If UCase(Mid(filename, 8, 1)) &amp;lt;&amp;gt; "R" Then
                    Autodesk.AutoCAD.ApplicationServices.Application.SetSystemVariable("BACKGROUNDPLOT", 0)
                    Using db As New Database(False, True)
                        db.ReadDwgFile(file, FileOpenMode.OpenForReadAndAllShare, False, Nothing)
                        db.CloseInput(True)
                        HostApplicationServices.WorkingDatabase = db
                        Using acTrans As Transaction = db.TransactionManager.StartTransaction()
                            Try
                                Dim ldic As DBDictionary = CType(acTrans.GetObject(db.LayoutDictionaryId, OpenMode.ForWrite), DBDictionary)
                                For Each entr As DictionaryEntry In ldic
                                    Dim lo As Layout = CType(acTrans.GetObject(entr.Value, OpenMode.ForWrite), Layout)
                                    If InStr(UCase(lo.LayoutName), "MODEL") = 0 Then
                                        If getform(acDoc, lo.LayoutName, db, ed) &amp;lt;&amp;gt; "LEEG" Or getform(acDoc, lo.LayoutName, db, ed) &amp;lt;&amp;gt; "ONBEKEND" Then

                                            LayoutManager.Current.CurrentLayout = lo.LayoutName

                                            filename = plotdir &amp;amp; System.IO.Path.GetFileNameWithoutExtension(file) &amp;amp; "." &amp;amp; lo.LayoutName &amp;amp; ".pdf"

                                            MsgBox(filename &amp;amp; " : " &amp;amp; LayoutManager.Current.CurrentLayout)
                                            MsgBox(db.OriginalFileName)
                                            plot(lo, db, acDoc, filename, file, ed)

                                        End If
                                    End If
                                Next
                            Catch ex As System.Exception
                                ed.WriteMessage(ex.ToString())
                            End Try
                        End Using
                    End Using
                End If
                HostApplicationServices.WorkingDatabase = oldDb
            Next
        End If
    End Sub

    Public Shared Sub plot(ByVal lo As Layout, ByVal db As Database, ByVal acdoc As Document, ByVal filename As String, ByVal file As String, ByVal ed As Editor)
        Dim formaat As String = String.Empty
        ' Get the PlotInfo from the layout
        Using acPlInfo As New PlotInfo()
            acPlInfo.Layout = lo.ObjectId

            ' Get a copy of the PlotSettings from the layout
            Using acPlSet As New PlotSettings(lo.ModelType)
                acPlSet.CopyFrom(lo)

                ' Update the PlotSettings object
                Dim acPlSetVdr As PlotSettingsValidator = PlotSettingsValidator.Current

                ' Set the plot type
                acPlSetVdr.SetPlotType(acPlSet, Autodesk.AutoCAD.DatabaseServices.PlotType.Extents)

                ' Set the plot scale
                acPlSetVdr.SetUseStandardScale(acPlSet, True)
                acPlSetVdr.SetStdScaleType(acPlSet, StdScaleType.ScaleToFit)

                ' Center the plot
                acPlSetVdr.SetPlotCentered(acPlSet, True)
                acPlInfo.OverrideSettings = acPlSet

                ' Specify if plot styles should be displayed on the layout
                acPlSet.ShowPlotStyles = True

                acPlSetVdr.RefreshLists(acPlSet)

                ' Set the plot style
                'acPlSetVdr.SetCurrentStyleSheet(acPlSet, "acad.ctb")
                acPlSetVdr.SetCurrentStyleSheet(acPlSet, "Zwart (kleur onderhoek).ctb")

                formaat = getform(acdoc, lo.LayoutName, db, ed)

                ' Set the plot device to use
                acPlSetVdr.SetPlotConfigurationName(acPlSet, "DWG To PDF.pc3", formaat)

                ' Set the plot info as an override since it will
                ' not be saved back to the layout
                acPlInfo.OverrideSettings = acPlSet

                ' Validate the plot info
                Using acPlInfoVdr As New PlotInfoValidator()
                    acPlInfoVdr.MediaMatchingPolicy = MatchingPolicy.MatchEnabled
                    acPlInfoVdr.Validate(acPlInfo)

                    ' Check to see if a plot is already in progress
                    If PlotFactory.ProcessPlotState = ProcessPlotState.NotPlotting Then
                        Using acPlEng As PlotEngine = PlotFactory.CreatePublishEngine()
                            ' Track the plot progress with a Progress dialog
                            Using acPlProgDlg As New PlotProgressDialog(False, 1, True)
                                Using (acPlProgDlg)
                                    ' Define the status messages to display 
                                    ' when plotting starts
                                    acPlProgDlg.PlotMsgString(PlotMessageIndex.DialogTitle) = _
                                                                               "Plot Progress"
                                    acPlProgDlg.PlotMsgString(PlotMessageIndex.CancelJobButtonMessage) = _
                                                                                "Cancel Job"
                                    acPlProgDlg.PlotMsgString(PlotMessageIndex.CancelSheetButtonMessage) = _
                                                              "Cancel Sheet"
                                    acPlProgDlg.PlotMsgString(PlotMessageIndex.SheetSetProgressCaption) = _
                                                              "Sheet Set Progress"
                                    acPlProgDlg.PlotMsgString(PlotMessageIndex.SheetProgressCaption) = _
                                                                               "Sheet Progress"

                                    ' Set the plot progress range
                                    acPlProgDlg.LowerPlotProgressRange = 0
                                    acPlProgDlg.UpperPlotProgressRange = 100
                                    acPlProgDlg.PlotProgressPos = 0

                                    ' Display the Progress dialog
                                    acPlProgDlg.OnBeginPlot()
                                    acPlProgDlg.IsVisible = True

                                    ' Start to plot the layout
                                    acPlEng.BeginPlot(acPlProgDlg, Nothing)

                                    ' Define the plot output
                                    ' Define the plot output
                                    acPlEng.BeginDocument(acPlInfo, _
                                                          acdoc.Name, _
                                                          Nothing, _
                                                          1, _
                                                          True, _
                                                          filename)

                                    ' Display information about the current plot
                                    '' Display information about the current plot
                                    acPlProgDlg.PlotMsgString(PlotMessageIndex.Status) = _
                                                                  "Plotting: " &amp;amp; file &amp;amp; _
                                                                  " - " &amp;amp; lo.LayoutName

                                    ' Set the sheet progress range
                                    acPlProgDlg.OnBeginSheet()
                                    acPlProgDlg.LowerSheetProgressRange = 0
                                    acPlProgDlg.UpperSheetProgressRange = 100
                                    acPlProgDlg.SheetProgressPos = 0

                                    ' Plot the first sheet/layout
                                    Using acPlPageInfo As New PlotPageInfo()
                                        acPlEng.BeginPage(acPlPageInfo, acPlInfo, True, Nothing)
                                    End Using

                                    acPlEng.BeginGenerateGraphics(Nothing)
                                    acPlEng.EndGenerateGraphics(Nothing)

                                    ' Finish plotting the sheet/layout
                                    acPlEng.EndPage(Nothing)
                                    acPlProgDlg.SheetProgressPos = 100
                                    acPlProgDlg.OnEndSheet()

                                    ' Finish plotting the document
                                    acPlEng.EndDocument(Nothing)

                                    ' Finish the plot
                                    acPlProgDlg.PlotProgressPos = 100
                                    acPlProgDlg.OnEndPlot()
                                    acPlEng.EndPlot(Nothing)
                                End Using
                            End Using
                        End Using
                    End If
                End Using
            End Using
        End Using
    End Sub&lt;/PRE&gt;&lt;PRE&gt;    Shared Function getform(ByVal acdoc As Document, ByVal layout As String, ByVal db As Database, ByVal ed As Editor) As String

        Dim formaat As String = String.Empty
        Dim acTypValondnew(17) As TypedValue
        acTypValondnew.SetValue(New TypedValue(DxfCode.Operator, "&amp;lt;And"), 0)
        acTypValondnew.SetValue(New TypedValue(DxfCode.Start, "INSERT"), 1)
        acTypValondnew.SetValue(New TypedValue(DxfCode.Operator, "&amp;lt;or"), 2)
        acTypValondnew.SetValue(New TypedValue(DxfCode.BlockName, "HTCAF0a0"), 3)
        acTypValondnew.SetValue(New TypedValue(DxfCode.BlockName, "HTCAF1a0"), 4)
        acTypValondnew.SetValue(New TypedValue(DxfCode.BlockName, "HTCAF2a0"), 5)
        acTypValondnew.SetValue(New TypedValue(DxfCode.BlockName, "HTCAF0a1"), 6)
        acTypValondnew.SetValue(New TypedValue(DxfCode.BlockName, "HTCAF1a1"), 7)
        acTypValondnew.SetValue(New TypedValue(DxfCode.BlockName, "HTCAF0a2"), 8)
        acTypValondnew.SetValue(New TypedValue(DxfCode.BlockName, "HTCAF0a3"), 9)
        acTypValondnew.SetValue(New TypedValue(DxfCode.BlockName, "HTCAF0a4"), 10)
        acTypValondnew.SetValue(New TypedValue(DxfCode.BlockName, "HTCAF3a4"), 11)
        acTypValondnew.SetValue(New TypedValue(DxfCode.BlockName, "HTCAF4a4"), 12)
        acTypValondnew.SetValue(New TypedValue(DxfCode.BlockName, "HTCAF5a4"), 13)
        acTypValondnew.SetValue(New TypedValue(DxfCode.BlockName, "HTCAF6a4"), 14)
        acTypValondnew.SetValue(New TypedValue(DxfCode.Operator, "or&amp;gt;"), 15)
        acTypValondnew.SetValue(New TypedValue(DxfCode.LayoutName, layout), 16)
        acTypValondnew.SetValue(New TypedValue(DxfCode.Operator, "And&amp;gt;"), 17)

        Dim acSelFtrondnew As SelectionFilter = New SelectionFilter(acTypValondnew)
        Dim acSSPromptondnew As PromptSelectionResult
        acSSPromptondnew = ed.SelectAll(acSelFtrondnew)
        If acSSPromptondnew.Status = PromptStatus.OK Then
            Dim acSSet As SelectionSet = acSSPromptondnew.Value()
            Using actrans As Transaction = db.TransactionManager.StartTransaction()
                For Each acSSObj As SelectedObject In acSSet
                    Dim blkref As BlockReference = actrans.GetObject(acSSObj.ObjectId, OpenMode.ForRead)
                    Select Case blkref.Name
                        Case "HTCAF0a0"
                            formaat = "ISO_full_bleed_A0_(841.00_x_1189.00_MM)"
                        Case "HTCAF1a0"
                            formaat = "ISO_full_bleed_1A0_(841.00_x_1568.00_MM)"
                        Case "HTCAF2a0"
                            formaat = "ISO_full_bleed_2A0_(841.00_x_1758.00_MM)"
                        Case "HTCAF0a1"
                            formaat = "ISO_full_bleed_A1_(841.00_x_594.00_MM)"
                        Case "HTCAF1a1"
                            formaat = "ISO_full_bleed_1A1_(1189.00_x_594.00_MM)"
                        Case "HTCAF0a2"
                            formaat = "ISO_full_bleed_A2_(594.00_x_420.00_MM)"
                        Case "HTCAF0a3"
                            formaat = "ISO_full_bleed_A3_(420.00_x_297.00_MM)"
                        Case "HTCAF0a4"
                            formaat = "ISO_full_bleed_A4_(210.00_x_297.00_MM)"
                        Case "HTCAF3a4"
                            formaat = "ISO_full_bleed_3A4_(594.00_x_297.00_MM)"
                        Case "HTCAF4a4"
                            formaat = "ISO_full_bleed_4A4_(841.00_x_297.00_MM)"
                        Case "HTCAF5a4"
                            formaat = "ISO_full_bleed_5A4_(1050.00_x_297.00_MM)"
                        Case "HTCAF6a4"
                            formaat = "ISO_full_bleed_6A4_(1260.00_x_297.00_MM)"
                        Case Else
                            formaat = "ONBEKEND"
                    End Select
                Next

            End Using
        Else
            formaat = "LEEG"
        End If
        Return formaat
    End Function&lt;/PRE&gt;</description>
      <pubDate>Fri, 01 Apr 2016 08:11:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/create-pdf-file-from-some-layouts-only/m-p/6245684#M36485</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-04-01T08:11:12Z</dc:date>
    </item>
    <item>
      <title>Re: Create PDF File from some Layouts only</title>
      <link>https://forums.autodesk.com/t5/net-forum/create-pdf-file-from-some-layouts-only/m-p/6248551#M36486</link>
      <description>&lt;P&gt;Hi Jorge&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;where is the error breaking?&lt;/LI&gt;&lt;LI&gt;What is the error you are getting?&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It's a lot of code to sift through without much idea of &amp;nbsp;what it could be - make it easy for me to help you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;BK&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 03 Apr 2016 11:18:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/create-pdf-file-from-some-layouts-only/m-p/6248551#M36486</guid>
      <dc:creator>BKSpurgeon</dc:creator>
      <dc:date>2016-04-03T11:18:19Z</dc:date>
    </item>
    <item>
      <title>Re: Create PDF File from some Layouts only</title>
      <link>https://forums.autodesk.com/t5/net-forum/create-pdf-file-from-some-layouts-only/m-p/6249475#M36487</link>
      <description>&lt;P&gt;hi&amp;nbsp;BKSpurgeon&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;just get a fatal error and thats it&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;FATAL ERROR: &amp;nbsp;Unhandled Access Violation Reading 0xffb41988 Exception at dff1efa6h&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i almost think i go wrong when i change file of the database&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;is one of the first experience with working only the database and trying to plot all the layouts&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;maybe i am thinking &amp;nbsp;all wrong&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but thank u for ur reply and sorry i cant be more help&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Apr 2016 08:15:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/create-pdf-file-from-some-layouts-only/m-p/6249475#M36487</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-04-04T08:15:28Z</dc:date>
    </item>
    <item>
      <title>Re: Create PDF File from some Layouts only</title>
      <link>https://forums.autodesk.com/t5/net-forum/create-pdf-file-from-some-layouts-only/m-p/6249536#M36488</link>
      <description>Just my penny: I have no problem plotting multiple drawing, even plotting multiple layouts at once, but I've always loaded them as document, never tried to read just the db...&lt;BR /&gt;I'd try to load them as proper document and see if you still get the fatal error...</description>
      <pubDate>Mon, 04 Apr 2016 09:07:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/create-pdf-file-from-some-layouts-only/m-p/6249536#M36488</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-04-04T09:07:49Z</dc:date>
    </item>
    <item>
      <title>Re: Create PDF File from some Layouts only</title>
      <link>https://forums.autodesk.com/t5/net-forum/create-pdf-file-from-some-layouts-only/m-p/6251359#M36489</link>
      <description>&lt;P&gt;(1) Enclose the code in a try/catch command.&lt;/P&gt;&lt;P&gt;(2) We want the stack trace:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;Try&lt;BR /&gt;{&lt;BR /&gt;                      //// put all your code here&lt;BR /&gt;&lt;BR /&gt;}&lt;BR /&gt;catch&lt;/SPAN&gt; &lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;MyCustomException&lt;/SPAN&gt;&lt;SPAN&gt; ex&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;
&lt;SPAN&gt;{&lt;/SPAN&gt;
    &lt;SPAN&gt;Debug&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;Writeline&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;ex&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;ToString&lt;/SPAN&gt;&lt;SPAN&gt;());&lt;BR /&gt;    // we want to see what is printed out............this will show you the error line where the code breaks.&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;
&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(3) Please try debugging and keep going till it breaks. could be anywhere.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Apr 2016 02:56:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/create-pdf-file-from-some-layouts-only/m-p/6251359#M36489</guid>
      <dc:creator>BKSpurgeon</dc:creator>
      <dc:date>2016-04-05T02:56:14Z</dc:date>
    </item>
    <item>
      <title>Re: Create PDF File from some Layouts only</title>
      <link>https://forums.autodesk.com/t5/net-forum/create-pdf-file-from-some-layouts-only/m-p/6251456#M36490</link>
      <description>&lt;P&gt;hi all thanks for all your advice&lt;/P&gt;&lt;P&gt;will try it in a couple of &amp;nbsp;days and report back to you&lt;/P&gt;</description>
      <pubDate>Tue, 05 Apr 2016 05:35:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/create-pdf-file-from-some-layouts-only/m-p/6251456#M36490</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-04-05T05:35:45Z</dc:date>
    </item>
    <item>
      <title>Re: Create PDF File from some Layouts only</title>
      <link>https://forums.autodesk.com/t5/net-forum/create-pdf-file-from-some-layouts-only/m-p/6253417#M36491</link>
      <description>&lt;P&gt;of course you'll catch "Exception" not myCustomException - i just cut and pasted without reading too closely. and unforutnately i cannot edit my original post.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;BK&lt;/P&gt;</description>
      <pubDate>Tue, 05 Apr 2016 23:03:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/create-pdf-file-from-some-layouts-only/m-p/6253417#M36491</guid>
      <dc:creator>BKSpurgeon</dc:creator>
      <dc:date>2016-04-05T23:03:54Z</dc:date>
    </item>
    <item>
      <title>Re: Create PDF File from some Layouts only</title>
      <link>https://forums.autodesk.com/t5/net-forum/create-pdf-file-from-some-layouts-only/m-p/6262638#M36492</link>
      <description>&lt;P&gt;&lt;SPAN&gt;hi&amp;nbsp;BKSpurgeon&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;thx for the advice works great&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;see even debug messages from autocad coming threw&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;but was create another solution&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;was fix it by creating a pagesetup for every ;layout threw the database&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;and that works fine and then i make a publish of all to&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;and now i was try the catch exception and now it runs till the end&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;i gonna try today to break it again like i did before and then debug with the try exception&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;and will report back if i know more&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;but thx for the advice will use this in the future&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Apr 2016 06:37:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/create-pdf-file-from-some-layouts-only/m-p/6262638#M36492</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-04-11T06:37:47Z</dc:date>
    </item>
    <item>
      <title>Re: Create PDF File from some Layouts only</title>
      <link>https://forums.autodesk.com/t5/net-forum/create-pdf-file-from-some-layouts-only/m-p/6262701#M36493</link>
      <description>&lt;P&gt;ihis is the error&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;first chance exception of type 'System.AccessViolationException' occurred in Unknown Module.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;not a lot of help to me&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Apr 2016 07:21:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/create-pdf-file-from-some-layouts-only/m-p/6262701#M36493</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-04-11T07:21:09Z</dc:date>
    </item>
    <item>
      <title>Re: Create PDF File from some Layouts only</title>
      <link>https://forums.autodesk.com/t5/net-forum/create-pdf-file-from-some-layouts-only/m-p/6263113#M36494</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;@Anonymous wrote:&lt;BR /&gt;&lt;P&gt;ihis is the error&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;first chance exception of type 'System.AccessViolationException' occurred in Unknown Module.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;not a lot of help to me&amp;nbsp;&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;No, indeed not of great help!&amp;nbsp;&lt;img id="smileyvery-happy" class="emoticon emoticon-smileyvery-happy" src="https://forums.autodesk.com/i/smilies/16x16_smiley-very-happy.png" alt="Smiley Very Happy" title="Smiley Very Happy" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But, cannot you debug it step by step and see where actually it throws the exception?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyway, a couple of ideas to follow: is your code still similar to what you posted at the beginning? As I suggested before, I'd load the documents as proper Document objects, without loading just the Database with ReadDWG().&lt;/P&gt;&lt;P&gt;And since you have to switch documents, I'd define the command with the 'CommandFlags.Session' attribute and then locking/unlocking the documents you load.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That way I know for sure it'd work, since it's the architecture I've been using for a while...&lt;/P&gt;</description>
      <pubDate>Mon, 11 Apr 2016 11:54:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/create-pdf-file-from-some-layouts-only/m-p/6263113#M36494</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-04-11T11:54:31Z</dc:date>
    </item>
    <item>
      <title>Re: Create PDF File from some Layouts only</title>
      <link>https://forums.autodesk.com/t5/net-forum/create-pdf-file-from-some-layouts-only/m-p/6264152#M36495</link>
      <description>&lt;P&gt;hi mcicognani&lt;/P&gt;&lt;P&gt;will try that but i know it will work&lt;/P&gt;&lt;P&gt;even i not have tried it&lt;/P&gt;&lt;P&gt;here it is and by all means i am no specialist&lt;/P&gt;&lt;P&gt;and i was suppecting this from the beginning&lt;/P&gt;&lt;P&gt;and i think has something to do with closing and opening of the database&lt;/P&gt;&lt;P&gt;and it tries to allocate memory where it has no permission or something like that&lt;/P&gt;&lt;P&gt;and then i changed the exception in System.AccessViolationException to catch&lt;/P&gt;&lt;P&gt;that is what it said cant&amp;nbsp; write or no permision etc.&lt;/P&gt;&lt;P&gt;because i saw u could filter on exception in the debug menu of visual studio&lt;/P&gt;&lt;P&gt;changed the program omg tried to close the database like it should be&lt;/P&gt;&lt;P&gt;dispose of the plotsettings&lt;/P&gt;&lt;P&gt;dispose transaction&lt;/P&gt;&lt;P&gt;dispose of the layoutmanager&lt;/P&gt;&lt;P&gt;tried a lot&lt;/P&gt;&lt;P&gt;and now my unexperience comes in when i try&amp;nbsp; to debug the script&lt;/P&gt;&lt;P&gt;and i allready got the same result with adding to every layout a pagesetup and&lt;/P&gt;&lt;P&gt;making a publish of the files&lt;/P&gt;&lt;P&gt;but i just want to know why and how and what i did wrong&lt;/P&gt;&lt;P&gt;well get back with code for opening and closing the files and then plotting them&lt;/P&gt;</description>
      <pubDate>Mon, 11 Apr 2016 18:11:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/create-pdf-file-from-some-layouts-only/m-p/6264152#M36495</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-04-11T18:11:46Z</dc:date>
    </item>
    <item>
      <title>Re: Create PDF File from some Layouts only</title>
      <link>https://forums.autodesk.com/t5/net-forum/create-pdf-file-from-some-layouts-only/m-p/6267666#M36496</link>
      <description>&lt;P&gt;like i promised&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the code opening ans closing drawing and switching between the layouts and then printing&amp;nbsp;&lt;/P&gt;&lt;P&gt;works fine&amp;nbsp;&lt;/P&gt;&lt;P&gt;except i cant set my&amp;nbsp;PlotPaperUnit not to milimeters stay on stupid inches grrrrrrrrrrrrrrrrrrrrrrrr&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;here is the code but i dont see what is gonna help me with the databases&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Imports System&lt;BR /&gt;Imports System.Runtime.InteropServices&lt;BR /&gt;Imports Autodesk.AutoCAD.Runtime&lt;BR /&gt;Imports Autodesk.AutoCAD.ApplicationServices&lt;BR /&gt;Imports Autodesk.AutoCAD.DatabaseServices&lt;BR /&gt;Imports Autodesk.AutoCAD.Geometry&lt;BR /&gt;Imports Autodesk.AutoCAD.EditorInput&lt;BR /&gt;Imports Autodesk.AutoCAD.Colors&lt;BR /&gt;Imports Autodesk.AutoCAD.Windows&lt;BR /&gt;Imports Autodesk.AutoCAD.PlottingServices&lt;BR /&gt;&lt;BR /&gt;Public Class dbtest&lt;BR /&gt; &amp;lt;CommandMethod("PUB", CommandFlags.Session)&amp;gt; _&lt;BR /&gt; Public Shared Sub Publish()&lt;BR /&gt; Try&lt;BR /&gt; Dim file As String&lt;BR /&gt; Dim filename As String = String.Empty&lt;BR /&gt; Dim plotdir As String = "c:\plot\"&lt;BR /&gt; Dim formaat As String = String.Empty&lt;BR /&gt; Dim openfdail As New OpenFileDialog("Select Drawings", Nothing, "dwg; dwf; *", "selfile", OpenFileDialog.OpenFileDialogFlags.AllowMultiple)&lt;BR /&gt; Dim dr1 As System.Windows.Forms.DialogResult = openfdail.ShowDialog()&lt;BR /&gt; If dr1 = System.Windows.Forms.DialogResult.OK Then&lt;BR /&gt; 'Dim filenames() As String = openfdail.GetFilenames&lt;BR /&gt; Dim filenames() As String = openfdail.GetFilenames()&lt;BR /&gt; Dim acdocmgr As DocumentCollection = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager&lt;BR /&gt; Dim acDoc As Document = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument&lt;BR /&gt; For Each file In filenames&lt;BR /&gt; acDoc = DocumentCollectionExtension.Open(acdocmgr, file, False)&lt;BR /&gt; Dim db As Database = acDoc.Database&lt;BR /&gt; Dim aced As Editor = acDoc.Editor&lt;BR /&gt; Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument = acDoc&lt;BR /&gt; Using acLckDoc As DocumentLock = acDoc.LockDocument()&lt;BR /&gt; Using actrans As Transaction = db.TransactionManager.StartTransaction()&lt;BR /&gt; Dim ldic As DBDictionary = CType(actrans.GetObject(db.LayoutDictionaryId, OpenMode.ForRead), DBDictionary)&lt;BR /&gt; For Each entr As DictionaryEntry In ldic&lt;BR /&gt; Dim lo As Layout = CType(actrans.GetObject(entr.Value, OpenMode.ForWrite), Layout)&lt;BR /&gt; filename = plotdir &amp;amp; System.IO.Path.GetFileNameWithoutExtension(file) &amp;amp; "." &amp;amp; lo.LayoutName &amp;amp; ".pdf"&lt;BR /&gt; LayoutManager.Current.CurrentLayout = lo.LayoutName&lt;BR /&gt; Try&lt;BR /&gt; formaat = getform(acDoc, lo.LayoutName, db, aced)&lt;BR /&gt; plot(lo, db, filename, file, formaat, aced)&lt;BR /&gt; Catch ex As System.Exception&lt;BR /&gt; aced.WriteMessage(ex.ToString())&lt;BR /&gt; End Try&lt;BR /&gt; Next&lt;BR /&gt; actrans.Dispose()&lt;BR /&gt; End Using&lt;BR /&gt; End Using&lt;BR /&gt; DocumentExtension.CloseAndDiscard(acDoc)&lt;BR /&gt; Next&lt;BR /&gt; End If&lt;BR /&gt; Catch ex As System.Exception&lt;BR /&gt; Debug.Print(ex.ToString())&lt;BR /&gt; End Try&lt;BR /&gt;&lt;BR /&gt; End Sub&lt;BR /&gt; Shared Function getform(ByVal acdoc As Document, ByVal layout As String, ByVal db As Database, ByVal ed As Editor) As String&lt;BR /&gt;&lt;BR /&gt; Dim formaat As String = String.Empty&lt;BR /&gt; Dim acTypValondnew(17) As TypedValue&lt;BR /&gt; acTypValondnew.SetValue(New TypedValue(DxfCode.Operator, "&amp;lt;And"), 0)&lt;BR /&gt; acTypValondnew.SetValue(New TypedValue(DxfCode.Start, "INSERT"), 1)&lt;BR /&gt; acTypValondnew.SetValue(New TypedValue(DxfCode.Operator, "&amp;lt;or"), 2)&lt;BR /&gt; acTypValondnew.SetValue(New TypedValue(DxfCode.BlockName, "HTCAF0a0"), 3)&lt;BR /&gt; acTypValondnew.SetValue(New TypedValue(DxfCode.BlockName, "HTCAF1a0"), 4)&lt;BR /&gt; acTypValondnew.SetValue(New TypedValue(DxfCode.BlockName, "HTCAF2a0"), 5)&lt;BR /&gt; acTypValondnew.SetValue(New TypedValue(DxfCode.BlockName, "HTCAF0a1"), 6)&lt;BR /&gt; acTypValondnew.SetValue(New TypedValue(DxfCode.BlockName, "HTCAF1a1"), 7)&lt;BR /&gt; acTypValondnew.SetValue(New TypedValue(DxfCode.BlockName, "HTCAF0a2"), 8)&lt;BR /&gt; acTypValondnew.SetValue(New TypedValue(DxfCode.BlockName, "HTCAF0a3"), 9)&lt;BR /&gt; acTypValondnew.SetValue(New TypedValue(DxfCode.BlockName, "HTCAF0a4"), 10)&lt;BR /&gt; acTypValondnew.SetValue(New TypedValue(DxfCode.BlockName, "HTCAF3a4"), 11)&lt;BR /&gt; acTypValondnew.SetValue(New TypedValue(DxfCode.BlockName, "HTCAF4a4"), 12)&lt;BR /&gt; acTypValondnew.SetValue(New TypedValue(DxfCode.BlockName, "HTCAF5a4"), 13)&lt;BR /&gt; acTypValondnew.SetValue(New TypedValue(DxfCode.BlockName, "HTCAF6a4"), 14)&lt;BR /&gt; acTypValondnew.SetValue(New TypedValue(DxfCode.Operator, "or&amp;gt;"), 15)&lt;BR /&gt; acTypValondnew.SetValue(New TypedValue(DxfCode.LayoutName, layout), 16)&lt;BR /&gt; acTypValondnew.SetValue(New TypedValue(DxfCode.Operator, "And&amp;gt;"), 17)&lt;BR /&gt;&lt;BR /&gt; Dim acSelFtrondnew As SelectionFilter = New SelectionFilter(acTypValondnew)&lt;BR /&gt; Dim acSSPromptondnew As PromptSelectionResult&lt;BR /&gt; acSSPromptondnew = ed.SelectAll(acSelFtrondnew)&lt;BR /&gt; If acSSPromptondnew.Status = PromptStatus.OK Then&lt;BR /&gt; Dim acSSet As SelectionSet = acSSPromptondnew.Value()&lt;BR /&gt; Using actrans As Transaction = db.TransactionManager.StartTransaction()&lt;BR /&gt; For Each acSSObj As SelectedObject In acSSet&lt;BR /&gt; Dim blkref As BlockReference = actrans.GetObject(acSSObj.ObjectId, OpenMode.ForRead)&lt;BR /&gt; Select Case blkref.Name&lt;BR /&gt; Case "HTCAF0a0"&lt;BR /&gt; formaat = "ISO_full_bleed_A0_(841.00_x_1189.00_MM)"&lt;BR /&gt; Case "HTCAF1a0"&lt;BR /&gt; formaat = "ISO_full_bleed_1A0_(841.00_x_1568.00_MM)"&lt;BR /&gt; Case "HTCAF2a0"&lt;BR /&gt; formaat = "ISO_full_bleed_2A0_(841.00_x_1758.00_MM)"&lt;BR /&gt; Case "HTCAF0a1"&lt;BR /&gt; formaat = "ISO_full_bleed_A1_(841.00_x_594.00_MM)"&lt;BR /&gt; Case "HTCAF1a1"&lt;BR /&gt; formaat = "ISO_full_bleed_1A1_(1189.00_x_594.00_MM)"&lt;BR /&gt; Case "HTCAF0a2"&lt;BR /&gt; formaat = "ISO_full_bleed_A2_(594.00_x_420.00_MM)"&lt;BR /&gt; Case "HTCAF0a3"&lt;BR /&gt; formaat = "ISO_full_bleed_A3_(420.00_x_297.00_MM)"&lt;BR /&gt; Case "HTCAF0a4"&lt;BR /&gt; formaat = "ISO_full_bleed_A4_(210.00_x_297.00_MM)"&lt;BR /&gt; Case "HTCAF3a4"&lt;BR /&gt; formaat = "ISO_full_bleed_3A4_(594.00_x_297.00_MM)"&lt;BR /&gt; Case "HTCAF4a4"&lt;BR /&gt; formaat = "ISO_full_bleed_4A4_(841.00_x_297.00_MM)"&lt;BR /&gt; Case "HTCAF5a4"&lt;BR /&gt; formaat = "ISO_full_bleed_5A4_(1050.00_x_297.00_MM)"&lt;BR /&gt; Case "HTCAF6a4"&lt;BR /&gt; formaat = "ISO_full_bleed_6A4_(1260.00_x_297.00_MM)"&lt;BR /&gt; Case Else&lt;BR /&gt; formaat = "ONBEKEND"&lt;BR /&gt; End Select&lt;BR /&gt; Next&lt;BR /&gt;&lt;BR /&gt; End Using&lt;BR /&gt; Else&lt;BR /&gt; formaat = "LEEG"&lt;BR /&gt; End If&lt;BR /&gt; Return formaat&lt;BR /&gt; End Function&lt;BR /&gt; Public Shared Sub plot(ByRef lo As Layout, ByRef db As Database, ByVal filename As String, ByVal file As String, ByVal formaat As String, ByVal ed As Editor)&lt;BR /&gt; Dim CurVar As Object&lt;BR /&gt; 'Get the BACKGROUNDPLOT SYSTEM VARIABLE&lt;BR /&gt; CurVar = Application.GetSystemVariable("BackGroundPlot")&lt;BR /&gt; 'SET BACKGROUNDPLOT SYSTEM VARIABLE TO ZERO&lt;BR /&gt; Application.SetSystemVariable("BackGroundPlot", 0)&lt;BR /&gt; '' Get the PlotInfo from the layout&lt;BR /&gt; Dim acPlInfo As PlotInfo = New PlotInfo()&lt;BR /&gt; acPlInfo.Layout = lo.ObjectId&lt;BR /&gt;&lt;BR /&gt; '' Set the PlotSettings object&lt;BR /&gt; Dim acPlSetVdr As PlotSettingsValidator = PlotSettingsValidator.Current&lt;BR /&gt;&lt;BR /&gt; '' Get a PlotSettings from the layout&lt;BR /&gt; Dim acPlSet As PlotSettings = New PlotSettings(lo.ModelType)&lt;BR /&gt; acPlSet.CopyFrom(lo)&lt;BR /&gt;&lt;BR /&gt; acPlSetVdr.RefreshLists(acPlSet)&lt;BR /&gt; acPlSetVdr.SetPlotType(acPlSet, Autodesk.AutoCAD.DatabaseServices.PlotType.Extents)&lt;BR /&gt; '' Set the plot scale&lt;BR /&gt; acPlSetVdr.SetPlotPaperUnits(acPlSet, PlotPaperUnit.Millimeters)&lt;BR /&gt; acPlSetVdr.SetUseStandardScale(acPlSet, True)&lt;BR /&gt; acPlSetVdr.SetStdScaleType(acPlSet, StdScaleType.StdScale1To1)&lt;BR /&gt; 'acPlSet.ScaleLineweights = True&lt;BR /&gt; ''set the style&lt;BR /&gt; acPlSetVdr.SetCurrentStyleSheet(acPlSet, "Zwart (kleur onderhoek).ctb")&lt;BR /&gt; '' Center the plot&lt;BR /&gt; acPlSetVdr.SetPlotCentered(acPlSet, True)&lt;BR /&gt; ''set the rotation&lt;BR /&gt; 'acPlSetVdr.SetPlotRotation(acPlSet, Rotation) 'Rotations is passed through the function&lt;BR /&gt; '' Set the plot device to use&lt;BR /&gt; acPlSetVdr.SetPlotConfigurationName(acPlSet, "DWG To PDF.pc3", formaat)&lt;BR /&gt;&lt;BR /&gt; '' Set the plot info as an override&lt;BR /&gt; acPlInfo.OverrideSettings = acPlSet&lt;BR /&gt; acPlSetVdr.RefreshLists(acPlSet)&lt;BR /&gt;&lt;BR /&gt; '' Validate the plot info&lt;BR /&gt; Dim acPlInfoVdr As PlotInfoValidator = New PlotInfoValidator()&lt;BR /&gt; acPlInfoVdr.MediaMatchingPolicy = MatchingPolicy.MatchEnabled&lt;BR /&gt; acPlInfoVdr.Validate(acPlInfo)&lt;BR /&gt; acPlSetVdr.SetZoomToPaperOnUpdate(acPlSet, True)&lt;BR /&gt; lo.CopyFrom(acPlSet)&lt;BR /&gt; '' Check whether a plot job is in progress&lt;BR /&gt; If PlotFactory.ProcessPlotState = Autodesk.AutoCAD.PlottingServices.ProcessPlotState.NotPlotting Then&lt;BR /&gt; Using acPlEng As PlotEngine = PlotFactory.CreatePublishEngine()&lt;BR /&gt;&lt;BR /&gt; '' Track the plot progress with a Progress dialog&lt;BR /&gt; Dim acPlProgDlg As PlotProgressDialog = New PlotProgressDialog(False, 1, True)&lt;BR /&gt;&lt;BR /&gt; Using (acPlProgDlg)&lt;BR /&gt; '' Define the status messages to display when plotting starts&lt;BR /&gt; acPlProgDlg.PlotMsgString(PlotMessageIndex.DialogTitle) = "Plot Progress"&lt;BR /&gt; acPlProgDlg.PlotMsgString(PlotMessageIndex.CancelJobButtonMessage) = "Cancel Job"&lt;BR /&gt; acPlProgDlg.PlotMsgString(PlotMessageIndex.CancelSheetButtonMessage) = "Cancel Sheet"&lt;BR /&gt; acPlProgDlg.PlotMsgString(PlotMessageIndex.SheetSetProgressCaption) = "Sheet Set Progress"&lt;BR /&gt; acPlProgDlg.PlotMsgString(PlotMessageIndex.SheetProgressCaption) = "Sheet Progress"&lt;BR /&gt;&lt;BR /&gt; '' Set the plot progress range&lt;BR /&gt; acPlProgDlg.LowerPlotProgressRange = 0&lt;BR /&gt; acPlProgDlg.UpperPlotProgressRange = 100&lt;BR /&gt; acPlProgDlg.PlotProgressPos = 0&lt;BR /&gt;&lt;BR /&gt; '' Display the Progress dialog&lt;BR /&gt; acPlProgDlg.OnBeginPlot()&lt;BR /&gt; acPlProgDlg.IsVisible = True&lt;BR /&gt;&lt;BR /&gt; '' Start to plot the layout&lt;BR /&gt; acPlEng.BeginPlot(acPlProgDlg, Nothing)&lt;BR /&gt;&lt;BR /&gt; acPlEng.BeginDocument(acPlInfo, _&lt;BR /&gt; file, _&lt;BR /&gt; Nothing, _&lt;BR /&gt; 1, _&lt;BR /&gt; True, _&lt;BR /&gt; filename)&lt;BR /&gt;&lt;BR /&gt; '' Display information about the current plot&lt;BR /&gt; acPlProgDlg.PlotMsgString(PlotMessageIndex.Status) = _&lt;BR /&gt; "Plotting: " &amp;amp; file &amp;amp; _&lt;BR /&gt; " - " &amp;amp; lo.LayoutName&lt;BR /&gt;&lt;BR /&gt; '' Set the sheet progress range&lt;BR /&gt; acPlProgDlg.OnBeginSheet()&lt;BR /&gt; acPlProgDlg.LowerSheetProgressRange = 0&lt;BR /&gt; acPlProgDlg.UpperSheetProgressRange = 100&lt;BR /&gt; acPlProgDlg.SheetProgressPos = 0&lt;BR /&gt;&lt;BR /&gt; '' Plot the first sheet/layout&lt;BR /&gt; Dim acPlPageInfo As PlotPageInfo = New PlotPageInfo()&lt;BR /&gt; acPlEng.BeginPage(acPlPageInfo, _&lt;BR /&gt; acPlInfo, _&lt;BR /&gt; True, _&lt;BR /&gt; Nothing)&lt;BR /&gt;&lt;BR /&gt; acPlEng.BeginGenerateGraphics(Nothing)&lt;BR /&gt; acPlEng.EndGenerateGraphics(Nothing)&lt;BR /&gt;&lt;BR /&gt; '' Finish plotting the sheet/layout&lt;BR /&gt; acPlEng.EndPage(Nothing)&lt;BR /&gt; acPlProgDlg.SheetProgressPos = 100&lt;BR /&gt; acPlProgDlg.OnEndSheet()&lt;BR /&gt;&lt;BR /&gt; '' Finish plotting the document&lt;BR /&gt; acPlEng.EndDocument(Nothing)&lt;BR /&gt;&lt;BR /&gt; '' Finish the plot&lt;BR /&gt; acPlProgDlg.PlotProgressPos = 100&lt;BR /&gt; acPlProgDlg.OnEndPlot()&lt;BR /&gt; acPlEng.EndPlot(Nothing)&lt;BR /&gt;&lt;BR /&gt; End Using&lt;BR /&gt; End Using&lt;BR /&gt; End If&lt;BR /&gt; 'REVERT BACK TO THE ORIGINAL BACKGROUNDPLOT SYSTEM VARIABLE&lt;BR /&gt; Application.SetSystemVariable("BackGroundPlot", CurVar)&lt;BR /&gt; End Sub&lt;BR /&gt;End Class&lt;BR /&gt;&lt;BR /&gt;
&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Apr 2016 07:56:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/create-pdf-file-from-some-layouts-only/m-p/6267666#M36496</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-04-13T07:56:09Z</dc:date>
    </item>
    <item>
      <title>Re: Create PDF File from some Layouts only</title>
      <link>https://forums.autodesk.com/t5/net-forum/create-pdf-file-from-some-layouts-only/m-p/6267719#M36497</link>
      <description>&lt;P&gt;Should be in the PlotSettingsValidator:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;psv.SetPlotPaperUnits(ps, PlotPaperUnit.Millimeters);&lt;/PRE&gt;&lt;P&gt;EDIT:&lt;/P&gt;&lt;P&gt;No, sorry, seen you already did&amp;nbsp;it...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What's the units of the drawings itself? Inches? If so, you just have to take into account and adjust the PlotScale factor...&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;EDIT2:&lt;/P&gt;&lt;P&gt;Look, someone else had the same issue:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/net/plotsettingsvalidator-setplotpaperunits/m-p/6025017/highlight/true#M47451" target="_self"&gt;http://forums.autodesk.com/t5/net/plotsettingsvalidator-setplotpaperunits/m-p/6025017/highlight/true#M47451&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Apr 2016 08:45:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/create-pdf-file-from-some-layouts-only/m-p/6267719#M36497</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-04-13T08:45:31Z</dc:date>
    </item>
    <item>
      <title>Re: Create PDF File from some Layouts only</title>
      <link>https://forums.autodesk.com/t5/net-forum/create-pdf-file-from-some-layouts-only/m-p/6267729#M36498</link>
      <description>&lt;P&gt;i know&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt; acPlSetVdr.SetPlotPaperUnits(acPlSet, PlotPaperUnit.Millimeters)&lt;/PRE&gt;&lt;P&gt;i was put in my code and still keeps inches but will look online if i can find what i am doing wrong&lt;/P&gt;&lt;P&gt;but like i told u works when u open and close the drawing and switch the layouts and plot them&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but for the database version still the same problem&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Apr 2016 08:48:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/create-pdf-file-from-some-layouts-only/m-p/6267729#M36498</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-04-13T08:48:51Z</dc:date>
    </item>
    <item>
      <title>Re: Create PDF File from some Layouts only</title>
      <link>https://forums.autodesk.com/t5/net-forum/create-pdf-file-from-some-layouts-only/m-p/6267810#M36499</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi Jorge.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Forgetting to commit a Transaction?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Apr 2016 09:38:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/create-pdf-file-from-some-layouts-only/m-p/6267810#M36499</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-04-13T09:38:16Z</dc:date>
    </item>
    <item>
      <title>Re: Create PDF File from some Layouts only</title>
      <link>https://forums.autodesk.com/t5/net-forum/create-pdf-file-from-some-layouts-only/m-p/6267858#M36500</link>
      <description>&lt;P&gt;hi mtb task&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;why should i commit if i do a override of the plotsettings&amp;nbsp;&lt;/P&gt;&lt;P&gt;and i want to know what is wrong with plotpaperunits&lt;/P&gt;&lt;P&gt;but we are drifting away from the real problem&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;why i get a fata error when i try to the sme when i only open the database&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i just want to plot and make no futther changes&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Apr 2016 10:04:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/create-pdf-file-from-some-layouts-only/m-p/6267858#M36500</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-04-13T10:04:28Z</dc:date>
    </item>
  </channel>
</rss>

