This is an archived forum post. The information may be outdated. Contact us if you have any questions.

O kb Pdf Created

saurabh1504 wrote on 2015-01-19:
Hi I am using Pdf Corwd for html to PDF.

My problem is that its generate 0 Kb file for my html.
I am not geetting what is the problem.

Here is the sample code which i using :

public void convertToPDF(String htmlPath, String pdfFilePath) throws IOException

{

FileOutputStream fileStream = null;

try

{

// create an API client instance

Client client = new Client("username", "password");

// convert a web page and save the PDF to a file

fileStream = new FileOutputStream(pdfFilePath);

client.convertURI(htmlPath, fileStream);

}

catch(PdfcrowdError why) {

System.err.println(why.getMessage());

logger.error("Error Generating PDF : ", why);

}

catch(IOException exc) {

logger.error("Error Generating PDF : ", exc);

} finally{

if(fileStream != null){

fileStream.close();

}

}

}
support wrote on 2015-01-19:
Hello,

It looks like convertURI() failed and threw an exception. What error message are you getting?
jeff_zacarias wrote on 2015-03-23:
I experience the same problem....
support wrote on 2015-03-23:
Hello,

As said above, this usually occurs when the API returns an error. Are you getting any error message?