Hi there,
Hi there,
String inFile = myDir + “Test
(2).tif”;<o:p></o:p>
com.aspose.pdf.Document doc = new com.aspose.pdf.Document();
com.aspose.pdf.Page page = doc.getPages().add();
java.io.FileInputStream imageStream = new java.io.FileInputStream(
new java.io.File(inFile));
page.getPageInfo().getMargin().setBottom(0);
page.getPageInfo().getMargin().setTop(0);
page.getPageInfo().getMargin().setLeft(0);
page.getPageInfo().getMargin().setRight(0);
page.getPageInfo().setHeight(
com.aspose.pdf.PageSize.getA4().getHeight());
page.getPageInfo().setWidth(com.aspose.pdf.PageSize.getA4().getWidth());
// Create an image object
com.aspose.pdf.Image image1 = new com.aspose.pdf.Image();
// Add the image into paragraphs collection of the section
page.getParagraphs().add(image1);
// Set the ImageStream to a MemoryStream object
image1.setImageStream(imageStream);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
doc.save(baos);
ByteArrayInputStream bais= new ByteArrayInputStream(baos.toByteArray());
com.aspose.pdf.Document document = new com.aspose.pdf.Document(new ByteArrayInputStream(baos.toByteArray()));
document.convert(myDir+"logFile.txt", PdfFormat.PDF_A_1A, ConvertErrorAction.Delete);
document.save(myDir+"AsposePDF_PDFA.pdf");
document.dispose();
Please feel free to contact us for any further assistance.
Best Regards,
Thank you very much for your help
Hi there,