Convert xls, xlsx, doc, .docx, .ppt, .pptx files into PDF


#1

Hi Team,
Can you please help me in converting the different file types such as Excel Files, Word Files, Presentation Files, .msg files, text files and images files into the PDF?
What are the APIs?
Which product family I need to use. Any sample code / example.
I want to use it in Java Langauage.

Thanks & Regards,
-Venkat


#2

@vgkkonda,

I have observed your requirements and like to share that Aspose APIs offer exporting Excel Files, Presentations, .MSG files, Text Files and Image files to PDF.

We have Aspose.Cells to manage the Excel files and exporting it to PDF.
We have Aspose.Slides to manage the PowerPoint files and exporting it to PDF.
We have Aspose.Email to manage the .MSG files and exporting it to PDF.
We have Aspose.Words to manage Word and Text file and their export to PDF.
We have Aspose.Imaging for converting images to PDF.

Please feel free to share if there is any thing incurring on your end.


#3

Hi Mudassir,

Thanks for response.

But I am not able to find the exact API or code snippet where I can convert the files to PDF.

Say for example I want to convert Excel Files to PDF, where can I find the code snippet or examples.

I went through the above link you shared, also went through your GIST and GIT Repository for Examples.

If you can help me in getting these code snippet or examples will be great.

Thanks in advance.

Thanks & Regards,
-Venkat


#4

@vgkkonda,

I have observed your comments. I have shared sample code with you. This will help you to achieve your requirements. Please share feedback with us if there is still an issue.

String dataDir = Utils.getSharedDataDir(SaveInPdfFormat.class) + “loading_saving/”;

// Creating an Workbook object with an Excel file path
Workbook workbook = new Workbook();

// Save in PDF format
workbook.save(dataDir + “SIPdfFormat_out.pdf”, FileFormatType.PDF);

// Print Message
System.out.println(“Worksheets are saved successfully.”);


#5

@vgkkonda,

Please see the sub-topic in the document with example code for your reference:
https://docs.aspose.com/display/cellsjava/Converting+Workbook+to+Different+Formats#ConvertingWorkbooktoDifferentFormats-ConvertingExceltoPDFFiles

I will also paste simplest code segment on how to convert an Excel file to PDF via Aspose.Cells APIs:
e.g
Sample code:

Workbook workbook = new Workbook("Book1.xls");
// Save the document in PDF format
workbook.save("out1.pdf", SaveFormat.PDF);

Hope, this helps a bit.