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

Reg:htmlconvert file to pdf by using java api

sarath934 wrote on 2013-05-13:
Hi,

By using this java api i can't generate pdf.becouse,I can be terminated automatically.how can i generate bulk of html pages to pdf's. can you please any one help me it's urgent....



Thank's,
M.Sarath
support wrote on 2013-05-13:
You can use the following function which converts a webpage URL to a PDF file on your computer:
public boolean webpageToPdfFile(String url, String pdfFilePath) 
{
  try 
  {
     Client client = new Client("***", "***");

     FileOutputStream fileStream = new FileOutputStream(pdfFilePath);
     client.convertURI(url, fileStream);
     fileStream.close();
     return true;
  }
  catch(PdfcrowdError why) {
     System.err.println(why.getMessage());
  }
  catch(IOException exc) {
     // handle the exception
  }
  return false;
}