How to convert images to PDF document.

            using Apitron.Image2Pdf;
            ...
             private static void Main(string[] args)
             {
                 // open and load the 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");
             }
        
Back to List