html to pdf converter

sasmita swain, modified 13 Years ago. Regular Member Posts: 183 Join Date: 2/24/12 Recent Posts
Hi

I am working on LR6.1 ga2.. i want to convert html page to pdf converter..can any body tell me how to convert one html page to pdf and that pdf i have to send in user mailid..

Thanks

Sasmita
thumbnail
Gaurav Jain, modified 13 Years ago. Regular Member Posts: 145 Join Date: 1/31/11 Recent Posts
You can use open office for the document conversions.
Liferay has inbuilt features for integration with open-office.
Some reference links:
http://itsliferay.wordpress.com/2012/09/10/document-conversion-using-liferay-way/

http://www.liferay.com/documentation/liferay-portal/6.1/user-guide/-/ai/openoffice

http://www.liferay.com/documentation/liferay-portal/6.1/user-guide/-/ai/lp-6-1-ugen12-server-administration-0
thumbnail
Manish Yadav, modified 13 Years ago. Expert Posts: 493 Join Date: 5/26/12 Recent Posts
sasmita swain:
Hi

I am working on LR6.1 ga2.. i want to convert html page to pdf converter..can any body tell me how to convert one html page to pdf and that pdf i have to send in user mailid..

Thanks

Sasmita


Try Apache PDFBox

Regards,
Manish Banwari Lal Yadav
thumbnail
Pranoti Nandurkar, modified 13 Years ago. Junior Member Posts: 48 Join Date: 2/3/12 Recent Posts
Hi,
you can use iText converter to convert HTML to pdf:

Java code using iText API is :

private void createPDF (){  
  
  String path = "D:/Deiva/Test.pdf";  
  PdfWriter pdfWriter = null;  
  
  //create a new document  
  Document document = new Document();  
  
  try {  
  
   //get Instance of the PDFWriter  
   pdfWriter = PdfWriter.getInstance(document, new FileOutputStream(path));  
  
   //document header attributes  
   document.addAuthor("betterThanZero");  
   document.addCreationDate();  
   document.addProducer();  
   document.addCreator("MySampleCode.com");  
   document.addTitle("Demo for iText XMLWorker");  
   document.setPageSize(PageSize.LETTER);  
  
   //open document  
   document.open();  
   InputStream is = new FileInputStream("D:/Deiva/CRs/Oncology/Phase5/CR1/HTMLPage/Article.html");  
  
   // create new input stream reader  
   InputStreamReader isr = new InputStreamReader(is);  
  
   //get the XMLWorkerHelper Instance  
   XMLWorkerHelper worker = XMLWorkerHelper.getInstance();  
   //convert to PDF  
   worker.parseXHtml(pdfWriter, document, isr);  
  
   //close the document  
   document.close();  
   //close the writer  
   pdfWriter.close();  
  
  } catch (Exception e) {  
      e.printStackTrace();  
  }  
  
 }