Turn images to PDF with our
new product Apitron Image 2
PDF for .NET a .NET component that allows you to convert a
set of images into a PDF file. It can be used to create booklets, combine scanned
documents or pack slides into single PDF document and other similar tasks.
The API
Simple and functional API
carefully designed to be intuitive and clear. Here I’m going to show some code
so you’ll be able to see its basics.
So the task is to convert a
set of images from some folder to a PDF document and the solution is below.
using System.IO;
using Apitron.Image2Pdf;
internal class Program
{
private static void Main(string[]
args)
{
// open and load image files
string[] images = Directory.GetFiles(@"..\..\..\Documents\");
// this object represents a PDF document
Document document = new Document();
// intialize settings object
PageSettings settings = new
PageSettings();
settings.ScaleMode
= ImageScaleMode.PreserveAspectRatio;
settings.KeepImageOrientation = true;
// process and save images to PDF one by one
foreach (string image
in images)
{
document.AddImage(image, settings);
}
document.Save("ImageToPdfSample.pdf");
// preview PDF document
Process.Start("ImageToPdfSample.pdf");
}
}
As you may see it doesn’t
take much, but generates a readable PDF document with pages created from
corresponding images. Things like page size, orientation, scaling, autosizing
can be controlled using conversion settings. Image below demonstrates the
result produced using the sample included in download package.
As
usual your feedback is welcome, share your thoughts or impovement ideas and get
a personal discount for the product.
No comments:
Post a Comment