Add Watermark to XLS/DOCX/PPT while converting them to PDF using Aspose APIs

We want to convert Word,Excel,PPT, CAD Files to be converted to PDF.
We tried to use below code as provided in the documentation for converting to pdf.

We want to add watermark to the output pdf file.

  1. How to add watermark to the file being converted?
  2. How to handle if the Input File already has a watermark

Document:

Document doc=new Document(inputFileName);
doc.save(outputFileName);

Excel

Workbook workbook = new Workbook(inputFileName);
workbook.save(outputFileName);

PPT

Presentation presentation = new Presentation(inputFileName);
presentation.save(outputFileName, SaveFormat.Pdf);

CAD Files

Image image = Image.load(inputFileName);
CadRasterizationOptions rasterizationOptions = new CadRasterizationOptions();
rasterizationOptions.setPageSize(new SizeF(1200, 1200));
PdfOptions pdfOptions = new PdfOptions();
pdfOptions.setVectorRasterizationOptions(rasterizationOptions);
image.save(outputFileName, pdfOptions);

@rajum,

Thanks for the details.

Well, I think you should add watermarks to your input file formats (e.g DOC/DOCX, XLS/XLSX, PPT, etc.) via Aspose APIs, so when you convert to PDF, the watermarks would be retained. For example, see the document on how to add watermark to the Word document. Similarly using Aspose.Cells API, you may add watermark to the worksheet. Moreover, see the thread on how to add watermark to Powerpoint presentation using Aspose.Slides APIs:

Also, see the thread with example on how to add watermark to CAD files:

Hope, this helps a bit.