VintaSoft Imaging .NET SDK v8.6
Vintasoft.Imaging.Pdf.Tree Namespace / PdfPage Class / RemoveVectorGraphics Method
The array of rectangles, in PDF page space (user units).
Example



In This Topic
    RemoveVectorGraphics Method (PdfPage)
    In This Topic
    Removes vector graphics that intersect with specified rectangles on PDF page.
    Syntax
    'Declaration
     
    Public Sub RemoveVectorGraphics( _
       ByVal ParamArray rects() As RectangleF _
    ) 
    public void RemoveVectorGraphics( 
       params RectangleF[] rects
    )
    public: void RemoveVectorGraphics( 
       params RectangleF[]* rects
    ) 
    public:
    void RemoveVectorGraphics( 
       ... array<RectangleF>^ rects
    ) 

    Parameters

    rects
    The array of rectangles, in PDF page space (user units).
    Remarks
    Important! - PDF document must be packed (Vintasoft.Imaging.Pdf.PdfDocument.Pack) after content removal otherwise the removed content can be restored.
    Example
    This example shows how to remove the vector graphics in specified rectangle of PDF page.
    Public Shared Sub TestRemoveVectorGraphicsOnAllPages(inputPdfFilename As String, outputPdfFilename As String)
        ' open document
        Using document As New Vintasoft.Imaging.Pdf.PdfDocument(inputPdfFilename)
            ' for all pages
            For Each page As Vintasoft.Imaging.Pdf.Tree.PdfPage In document.Pages
                Dim rect As System.Drawing.RectangleF = page.MediaBox
                rect.Inflate(New System.Drawing.SizeF(-rect.Width / 4, -rect.Height / 4))
                ' remove vector graphics that intersect with specified rectangle on PDF page
                page.RemoveVectorGraphics(rect)
            Next
            ' pack document
            If inputPdfFilename = outputPdfFilename Then
                document.Pack()
            Else
                document.Pack(outputPdfFilename)
            End If
        End Using
    End Sub
    public static void TestRemoveVectorGraphicsOnAllPages(string inputPdfFilename, string outputPdfFilename)
    {
        // open document
        using (Vintasoft.Imaging.Pdf.PdfDocument document = new Vintasoft.Imaging.Pdf.PdfDocument(inputPdfFilename))
        {
            // for all pages
            foreach (Vintasoft.Imaging.Pdf.Tree.PdfPage page in document.Pages)
            {
                System.Drawing.RectangleF rect = page.MediaBox;
                rect.Inflate(new System.Drawing.SizeF(-rect.Width / 4, -rect.Height / 4));
                // remove vector graphics that intersect with specified rectangle on PDF page
                page.RemoveVectorGraphics(rect);
            }
            // pack document
            if (inputPdfFilename == outputPdfFilename)
                document.Pack();
            else
                document.Pack(outputPdfFilename);
        }
    }
    Requirements

    Target Platforms: Windows 10, Windows 8, Windows 7, Windows Vista, Windows XP, Windows Server 2012, Windows Server 2008, Windows Server 2003

    See Also