rajum
August 27, 2018, 6:35am
1
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.
How to add header to the file being converted to pdf ?
How to handle if the Input File already has a header?
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 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:
Hi Evgen, I have observed your requirements and like to share that the header text can only be set in NoteSlideView inside slide. For other slide views there is no header and for that reason it is not directly available in HeaderFooterManger. However, you can still set the header text but in NotesSlideView using following sample code. I hope this will help you. public static void ManageHeader() { String path=@“C:\Aspose Data”; Presentation presentation = new Presentation(path + “h…
Hope, this helps a bit.