.NET: How can I control the "Only Objects on page exporting" by PDF-Export?

I want to write a small AddIn to automate our PDF Creation. I can set all the properties of the PDF. But I need control the "Only Objects on page "-Option on the PDF-Export Dialog. How can I do it?

            With corelApp.ActiveDocument.PDFSettings
                .PublishRange = 2 ' CdrPDFVBA.pdfSelection
                .PageRange = "1"
                .Author = PDF_Author
                .Subject = corelApp.ActiveDocument.FullFileName
                .Keywords = corelApp.ActiveDocument.FullFileName

...

           End With

           corelApp.ActiveDocument.PublishToPDF(PDF_FileName)

Parents
No Data
Reply
  • Hi,

    I found this difficult when building my own PDF automation script, as often have large objects off the page (that I don't want to include) AND multiple pages, which means not being able to use pdfCurrentPage or pdfSelection.

    Therefore, I use:

    'Delete all Objects not on the page
    Dim sr As ShapeRange, Deleted As Long
    Dim i As Integer
    ActiveDocument.SelectableShapes.All.AddToSelection 'Adds all shapes to selection
    For i = 1 To ActivePage.Layers.count
    ActivePage.Layers(i).Shapes.All.RemoveFromSelection 'Loops through the layers on the current page and remove shapes from selection
    Next i
    Set sr = ActiveSelectionRange
    Deleted = sr.count 'assign count so we can check whether we need to undo the delete later
    If Deleted > 0 Then
        sr.Delete
    End If

    I take a count to determine whether I need to delete any objects and also use this later in the code to determine whether to run an undo to bring the deleted objects back.

Children
No Data