Free Support Forum -

Add Header while converting to PDF File

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

We want to add header to the output pdf file.

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


Document doc=new Document(inputFileName);;


Workbook workbook = new Workbook(inputFileName);;


Presentation presentation = new Presentation(inputFileName);, 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);, pdfOptions);


Thanks for the details.

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

Hope, this helps a bit.