←Select platform

AnnPDFConvertor Class

Summary
Defines a class that converts between AnnObject annotation objects and PDFAnnotation annotation objects.
Syntax
C#
C++/CLI
Python
public static class AnnPDFConvertor 
public: 
   ref class AnnPDFConvertor sealed abstract 
class AnnPDFConvertor: 
Remarks

AnnPDFConvertor loads a PDF file with its annotations to allow conversion into AnnObject. Conversely, loads AnnObject to allow embedding core annotation objects into a PDF file by converting it to PDFAnnotation.

Example

This example demonstrates how to convert from AnnObject objects to PDFAnnotation objects and vice versa.

C#
using Leadtools.Annotations.Engine; 
using Leadtools.Pdf.Annotations; 
using LeadtoolsExamples.Common; 
using Leadtools.Pdf; 
 
public void AnnPDFConvertor_AnnPDFConvertor() 
{ 
   //Create some annotation objects and add it to container 
   AnnRectangleObject rectangle = new AnnRectangleObject(); 
   AnnTextObject text = new AnnTextObject(); 
 
   //Create new container and annotation object to it 
   AnnContainer container = new AnnContainer(); 
   container.Children.Add(rectangle); 
   container.Children.Add(text); 
 
   //Create list of PDFAnnotation as target of our conversion 
   List<PDFAnnotation> pdfAnnotations = new List<PDFAnnotation>(); 
 
   //Convert fro core annotation object to PDF annotation objects 
   AnnPDFConvertor.ConvertToPDF(container, pdfAnnotations, 800); 
 
   //Print the count of converted objects 
   Debug.WriteLine(pdfAnnotations.Count); // the result will be "2" 
 
   //Now convert from PDF annotation objects to our core annotation objects  
   AnnContainer newContainer = new AnnContainer(); 
 
   //Assume the size of pdf page that we want to add annotations to is 600*800 
   AnnPDFConvertor.ConvertFromPDF(pdfAnnotations, newContainer, LeadSizeD.Create(600, 800)); 
 
   //Print the count of converted objects 
   Debug.WriteLine(newContainer.Children.Count); // the result will be "2" 
} 
Requirements

Target Platforms

Help Version 22.0.2023.3.31
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.