How to use PageSettings for Image2PDF.

            using Apitron.Image2Pdf;
            ...
            private static void Main(string[] args)
            {
                // open and load the TIF image files
                string[] images = Directory.GetFiles(@"\Documents\", "*.jpg");

                // this objects represents a PDF document (with properties "Title", "Subject", "Author", "keywords")
                Document document = new Document("Sample document", "Apitron", "document", "PDF SAMPLE IMAGE2PDF");

                // intialize settings object
                PageSettings settings = new PageSettings(Boundaries.A4);
                settings.PageOrientation = Orientation.Auto;
                settings.Margin = new Margin(10, 20, 30, 40);
                settings.Padding = new Padding(10, 20, 30, 40);
                settings.ScaleMode = ImageScaleMode.PreserveAspectRatio;

                // process and save images to PDF one by one
                foreach (string image in images)
                {
                    // you can specify the personal settings for each page
                    document.AddImage(image, settings);
                }
                document.Save("PageSettingsSample.pdf");
            }
        
Back to List