//Instantiate a Pdf object by calling its empty constructor
Pdf pdf1 = new Pdf();
//Create a section in the Pdf object
Section sec1 = pdf1.getSections().add();
//Create an image object in the section
aspose.pdf.Image img1 = new aspose.pdf.Image(sec1);
//Add image object into the Paragraphs collection of the section
sec1.getParagraphs().add(img1);
//Set the path of image file
img1.getImageInfo().setFile("C:/Images/Apple.jpg");
//Set the path of image file
img1.getImageInfo().setTitle("JPEG image");
//Save the Pdf
pdf1.save("d:/pdftest/JPEG_image_toPDF.pdf");
//Instantiate Pdf instance by calling its empty constructor
Pdf pdf1 = new Pdf();
//Create a new section in the Pdf object
Section sec1 = pdf1.getSections().add();
//Create an image object in the section
Image image = new aspose.pdf.Image(sec1);
//Add image object into the Paragraphs collection of the section
sec1.getParagraphs().add(image);
//Set the ImageStream information
image.getImageInfo().setSystemImage(ImageIO.read(new java.net.URL("file:///d:/pdftest/BW_MultiPage_TIFF.tif")));
// set the value that all frames of tiff image need be added into PDF document
image.getImageInfo().setTiffFrame(-1);
//Save the pdf document
pdf1.save("d:/pdftest/TextAlignmentTest.pdf");
Copyright © 2024, NextGenUpdate.
All Rights Reserved.