←Select platform

ConvertFromPDF Method

Summary
Converts a list of PDFAnnotation objects into a list of AnnObject objects by adding it to target AnnContainer.
Syntax
C#
C++/CLI
Java
Python
public static void ConvertFromPDF( 
   IList<PDFAnnotation> source, 
   AnnContainer target, 
   LeadSizeD pdfPageSize 
) 
public static void convertFromPDF(List<PDFAnnotation> source, AnnContainer target, LeadSizeD pdfPageSize) 
 function Leadtools.Pdf.Annotations.AnnPDFConvertor.ConvertFromPDF(  
   source , 
   target , 
   pdfPageSize  
) 
public:  
   static void ConvertFromPDF( 
      IList<PDFAnnotation^>^ source, 
      AnnContainer^ target, 
      LeadSizeD^ pdfPageSize 
   ) 
def ConvertFromPDF(self,source,target,pdfPageSize): 

Parameters

source
The list of PDFAnnotation objects to fill into AnnContainer. This value must not be null.

target
The target AnnContainer is used to fill into it a list of PDFAnnotation objects. This parameter must not be null.

pdfPageSize
The size of the PDF page with the annotations.

Remarks

Note:The ConvertToPDF and ConvertFromPDF methods have different signatures for WinRT and WinRTPhone. Refer to the following for the correct signatures:

WinRT and WinRTPhone

public static void ConvertToPDF(AnnContainer source, IList<IPDFAnnotation> target, double pdfPageHeight) 
public static void ConvertFromPDF(IList<IPDFAnnotation> source, AnnContainer target, LeadSizeD pdfPageSize) 
Example
C#
Java
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" 
} 
 
import java.io.File; 
import java.io.IOException; 
import java.util.ArrayList; 
 
import org.junit.*; 
import org.junit.Test; 
import org.junit.runner.JUnitCore; 
import org.junit.runner.Result; 
import org.junit.runner.notification.Failure; 
import static org.junit.Assert.*; 
 
import leadtools.*; 
import leadtools.annotations.engine.*; 
import leadtools.pdf.PDFAnnotation; 
import leadtools.pdf.annotations.AnnPDFConvertor; 
 
 
public void annPDFConvertorExamples() { 
 
   // Create some annotation objects and add it to container 
   AnnRectangleObject rectangle = new AnnRectangleObject(); 
   AnnTextObject text = new AnnTextObject(); 
 
   // Create new container and add annotation object to it 
   AnnContainer container = new AnnContainer(); 
   container.getChildren().add(rectangle); 
   container.getChildren().add(text); 
 
   // Create list of PDFAnnotation as target of our conversion 
   ArrayList<PDFAnnotation> pdfAnnotations = new ArrayList<PDFAnnotation>(); 
 
   // Convert from core annotation object to PDF annotation objects 
   AnnPDFConvertor.convertToPDF(container, pdfAnnotations, 800); 
 
   // Print the count of converted objects 
   System.out.println(pdfAnnotations.size()); // 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 ocunt of converted objects 
   System.out.println("Converted objects: " + newContainer.getChildren().size()); // Result will be "2" 
   assertTrue(newContainer.getChildren().size() == 2); 
 
} 
Requirements

Target Platforms

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