We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

ImageStamp unconventional image formats support

Good day.

I am experimenting with adding ImageStamps to pages in a document, and I noticed that neither .ai (adobe illustrator) vectors nor .pdf images are supported. Is there a work around for using those file types as ImageStamps?

@mohammed.allulu

You can convert AI image to PDF with Aspose.PSD for Java and add output PDF page as a PdfPageStamp with Aspose.PDF for Java:

Aspose.PSD for Java:

String name = "Test";            
String sourceFileName = dataDir + name + ".ai";
String outFileName = dataDir + name + ".pdf";
AiImage image = (AiImage)Image.load(sourceFileName);
ImageOptionsBase options = new PdfOptions();
image.save(outFileName, options);

Aspose.PDF for Java:

Document pdfDoc = new Document("input.pdf");
Document stampDoc = new Document("template.pdf");
PdfPageStamp pageStamp = new PdfPageStamp(stampDoc.getPages().get_Item(1));
pageStamp.setBackground(false);            
pdfDoc.getPages().get_Item(1).addStamp(pageStamp);
pdfDoc.save(dataDir + "outputFile.pdf");
1 Like