PDF XLSX
Aspose.PDF  for .NET
PDF

Get Polyline annotations from PDF via Python

Build your own Python apps to manipulate comments & authors in document files using server-side APIs.

How to retrieve Polyline annotations from PDF using Python

In order to annotate PDF file, Aspose.PDF for .NET API which is a feature-rich, powerful and easy to use PDF manipulation and conversion API for Python platform. Even one can also generates password-protected PDF files. Create requirements.txt with this content.

pip==21.3.1
pycparser==2.21
pythonnet==2.5.2
setuptools==60.1.0

PowerShell Console

    pip install -r requirements.txt

Get Polyline Annotations from PDF via Python

You need aspose.pdf.dll to try the code in your environment.

  • Load PDF in an instance of Document class
  • Get a reference to an existing Page
  • Make a LINQ query to Page.Annotations Polyline annotation and filter only AnnotationType.Polyline
  • Iterate through results and make desired action (e.g. print location coordinates)

System Requirements

Aspose.PDF for .NET is supported on all major operating systems. Just make sure that you have the following prerequisites.

  • Microsoft Windows or a compatible Linux OS with .NET Framework, .NET Core.
  • Development environment like Microsoft Visual Studio Code or JetBrains PyCharm.
  • Aspose.PDF for .NET DLL referenced in your project.
 

Remove Annotations from PDF - Python


    def polyline_annotation_get(self, infile):

        path_infile = self.dataDir + infile

        pdfDocument = Document(path_infile)
        polylineAnnotations = [a for a in pdfDocument.Pages[1].Annotations if (a.AnnotationType == AnnotationType.polyline)]

        for pa in polylineAnnotations:
            print (pa.Rect)
 
  • About Aspose.PDF for .NET API

    Aspose.PDF API can be used for PDF document manipulation and parsing within applications. One can create, modify, compress, secure, print or save PDF to TXT, HTML, PCL, XFA, XML, XPS, EPUB, TEX, Images and more formats. Aspose.PDF is a standalone API and it does not depend on any software including Adobe Acrobat.

    Remove Annotation from PDF via Online App