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

Free Support Forum - aspose.com

Getting Started?

I’ve just downloaded the Java Components from the downloads page and got a .ZIP file.


I’m looking to start using the trial to convert text documents to PDFs however there’s nothing in that .ZIP that tells me what purpose any of the files have. I see some JARs in there, but I’m not if they’re there for developing or as part of the example.

Any help would be greatly appreciated.

Hi Cory,


Thanks for your interest in our API’s.

In order to accomplish your requirement, please visit the following link Converting Text File to PDF

So I’ve just used it on an RTF that has an image and formatting in it. It converted it to a PDF however the content looks like raw data.


I’ve tested using simple .txt and .rtf files with no formatting and multiple lines and they converted just fine. Is there a special way I need to read the .RTF so that the formatting is rendered properly in the .PDF?

Just as a note, when executing this code I print out what the reader is pulling from the file by printing it out to the console:

while ((strLine = br.readLine()) != null)
{
//Create a new text paragraph and pass the text to its constructor as argument
Text text1 = new Text(sec,strLine);
System.out.println(strLine);
sec.getParagraphs().add(text1);
}

The lines that are printed out are exactly what I see when it makes it to the PDF

I’ve attached the source file (the RTF) and the output (the PDF).

Hi Cory,


Thanks for sharing the details.

Please note that in order to manipulate/convert RTF/DOC/DOCX (i.e. MS Word) files to PDF format, you need to try using Aspose.Words for Java. For further details, please visit How to Convert a Document to PDF