Adds raster images to a PDF document.
public void AddImages(
IList<PDFImageData> images,
string destinationFileName
)
public:
void AddImages(
IList<PDFImageData^>^ images,
String^ destinationFileName
)
def AddImages(self,images,destinationFileName):
images
A List of PDFImageData to write. This must not be null and must be a list of 1 or more items. An empty list (count is zero) will throw an exception.
destinationFileName
Name of the destination PDF document to be created. If the value of this parameter is null, then the filename set in FileName will be updated.
You can use AddImages to add images at any page in a PDF document.
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:\LEADTOOLS22\Resources\Images";
}
PDFFile.AddImages
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document