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

Free Support Forum - aspose.com

JAVA excel to pdf conversion - current example

The example you have for pdf conversion is not working form me.

com.aspose.pdf.bindXML(.... does not seem to exist

I have downloaded and am using the latest .cells and .pdf

Can you provide a current example

I have done the reading and understand the example.

Thank you

Hi,

Thank you for considering Aspose.

We will look into this issue and get back to you soon.

Thank You & Best Regards,

Hi,

I think you are doing a minor mistake, kindly import com.aspose.pdf.elements package so that you may utilize Pdf.bindXML() method. Here is sample program:

import java.io.*;
import com.aspose.cells.*;
import com.aspose.pdf.elements.*;
import com.aspose.pdf.exception.AsposeBaseException;


public class Xls2Pdf {


public static void main(String[] args)
{

try
{

Workbook workbook = new Workbook();
workbook.open("e:\\files\\xls2pdf\\blub.xls");
workbook.save("e:\\files\\xls2pdf\\n1blub.xml", FileFormatType.ASPOSE_PDF);
Pdf pdf = new Pdf();
pdf=Pdf.bindXML(new FileInputStream("e:\\files\\xls2pdf\\n1blub.xml"));
pdf.save(new FileOutputStream("e:\\files\\xls2pdf\\n1blub.pdf"));


}

catch(Exception ee)
{

System.out.println(ee);
}


}

}

Thank you.

Thank you. Your code got me further along

Now I am getting:

Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space

this occurs at:

pdf=Pdf.bindXML(new FileInputStream(XMLfile));

The xls file created is a small 16kb file(one page).... the XML file created is huge 5000kb +

How can I limit what is dumped into the XML file?


Hi,

Could you post your template xls file here, we will check the issue soon.

Thank you.