←Select platform

PDFImagePosition Structure

Summary

Information about image position properties.

Syntax

C#
C++/CLI
Python
[SerializableAttribute()] 
public struct PDFImagePosition 
public: 
   [SerializableAttribute] 
   value class PDFImagePosition sealed 
class PDFImagePosition: 

Remarks

The PDFImagePosition structure contains information about the image's bounding box and page number.

Example

C#
Java
using Leadtools.WinForms; 
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.Controls; 
using Leadtools.Drawing; 
using Leadtools.ImageProcessing; 
using Leadtools.Pdf; 
using Leadtools.Svg; 
 
 
public void PDFAddImagesExample() 
{ 
   string srcFileName = Path.Combine(LEAD_VARS.ImagesDir, "leadtools.pdf"); ; 
   string dstFileName = Path.Combine(LEAD_VARS.ImagesDir, @"out.pdf"); 
   string imageFileName = Path.Combine(LEAD_VARS.ImagesDir, "Cannon.jpg"); 
 
   var imagesData = new List<PDFImageData>(); 
   var codecs = new RasterCodecs(); 
   RasterImage image = codecs.Load(imageFileName); 
 
   var file = new PDFFile(srcFileName); 
   var imageData = new PDFImageData(); 
          
   var imagePositions = new List<PDFImagePosition>(); 
   var imagePosition = new PDFImagePosition(); 
   imagePosition.PageNumber = 5; 
   imagePosition.Bounds = new PDFRect(250, 500, 350, 200); 
   imagePositions.Add(imagePosition); 
 
   imageData.Image = image; 
   imageData.ImagePosition = imagePositions; 
 
   imagesData.Add(imageData); 
 
   file.AddImages(imagesData, dstFileName); 
   image.Dispose(); 
   codecs.Dispose(); 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images"; 
} 
 
import java.io.ByteArrayInputStream; 
import java.io.File; 
import java.io.FileInputStream; 
import java.io.FileNotFoundException; 
import java.io.FileOutputStream; 
import java.io.FileReader; 
import java.io.IOException; 
import java.io.InputStream; 
import java.nio.file.Files; 
import java.nio.file.Paths; 
import java.nio.file.StandardCopyOption; 
import java.util.ArrayList; 
import java.util.Date; 
import java.util.List; 
import java.util.Scanner; 
 
import org.junit.*; 
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.codecs.*; 
import leadtools.pdf.*; 
 
 
public void pdfFileAddImagesExample() { 
 
   final String LEAD_VARS_IMAGES_DIR = "C:\\LEADTOOLS23\\Resources\\Images"; 
   String srcFileName = combine(LEAD_VARS_IMAGES_DIR, "leadtools.pdf"); 
   String dstFileName = combine(LEAD_VARS_IMAGES_DIR, "out.pdf"); 
   String imageFileName = combine(LEAD_VARS_IMAGES_DIR, "Cannon.jpg"); 
   ArrayList<PDFImageData> imagesData = new ArrayList<PDFImageData>(); 
   RasterCodecs codecs = new RasterCodecs(); 
   RasterImage image = codecs.load(imageFileName); 
 
   PDFFile file = new PDFFile(srcFileName); 
   PDFImageData imageData = new PDFImageData(); 
 
   ArrayList<PDFImagePosition> imagePositions = new ArrayList<PDFImagePosition>(); 
   PDFImagePosition imagePosition = new PDFImagePosition(); 
   imagePosition.setPageNumber(5); 
   imagePosition.setBounds(new PDFRect(250, 500, 350, 200)); 
   imagePositions.add(imagePosition); 
 
   imageData.setImage(image); 
   imageData.setImagePosition(imagePositions); 
 
   imagesData.add(imageData); 
 
   file.addImages(imagesData, dstFileName); 
   image.dispose(); 
   codecs.dispose(); 
   assertTrue("Check that new file was created", new File(dstFileName).exists()); 
 
} 

Requirements

Target Platforms

See Also

Leadtools.Pdf Namespace

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

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