Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Development-process 8211-Excel- Excel / Doc to PDF conversion using Acrobat9
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Manoj
Excel / Doc to PDF conversion using Acrobat9
1 Answer(s)      5 years ago
Posted in : Development process


Hi,

I need to convert .xls / .doc files to .pdf files using Acrobat9. Please suggest the possible ways.

Thanks in advance.


Advertisement
View Answers

January 14, 2010 at 3:07 PM


Hi Friend,

We have used itext api and POI library to convert doc file into pdf file.

import java.io.*;
import com.lowagie.text.*;
import com.lowagie.text.pdf.PdfWriter;
import org.apache.poi.hwpf.HWPFDocument;
import org.apache.poi.hwpf.extractor.WordExtractor;

public class ConvertDocToPDF {
public static void main(String[] args) {
File file = null;
WordExtractor extractor = null ;
try {

file = new File("New.doc");
FileInputStream fis=new FileInputStream(file.getAbsolutePath());
HWPFDocument document=new HWPFDocument(fis);
extractor = new WordExtractor(document);
String [] fileData = extractor.getParagraphText();
String st="";
for(int i=0;i<fileData.length;i++){
if(fileData[i] != null)
st+=fileData[i]+" ";
}
Document doc=new Document();
PdfWriter.getInstance(doc,new FileOutputStream("Hello.pdf"));
doc.open();
doc.add(new Paragraph(st));
doc.close();
file.delete();
}
catch(Exception e){}
}
}

Hope that it will be helpful for you.
Thanks


Related Tutorials/Questions & Answers:
Excel / Doc to PDF conversion using Acrobat9 - Development process
Excel / Doc to PDF conversion using Acrobat9  Hi, I need to convert .xls / .doc files to .pdf files using Acrobat9. Please suggest the possible... and POI library to convert doc file into pdf file. import java.io.*; import
doc to pdf convertion - Java Beginners
doc to pdf convertion  hi , I need to convert a .doc file that contains tables,pictures and text to pdf using Itext. I tried but it convert only texts. code i tried is package de.vogella.pdf.write; import java.io.
Advertisements
convert excel into pdf
convert excel into pdf  How to convert excel into pdf files
Reports to pdf conversion
Reports to pdf conversion  I need to convert reports into pdf format using java.. Will i get any sample code
pdf to xml conversion
pdf to xml conversion  i want to convert pdf file into xml file.. where i am having a table in pdf file with some headers and some data into it. i want the headers to be the tag of xml file. how can i do that using java? please
openning the pdf or doc file in same jsp
openning the pdf or doc file in same jsp   **how to open the pdf and doc file in same jsp after clicking the link or button (which is with out moving to the next page). will some body help me on this @simple format please
Byte array to PDF Conversion
Byte array to PDF Conversion  Hi, Am getting a letter Format in Byte array and i have to display that in PDF.Is that possible in PHP ? If so please let me knw how should i ? I can able to display that in a word Document but i
Excel conversion tool. - Java Beginners
Excel conversion tool.  Hi, I need a conversion tool which can convert .xls(Excel 2003) to .xlsx (Excel 2007) and vice-versa. Please suggest any links ro tools. Thank You
Reading .doc file using swing
Reading .doc file using swing  Sir, Could U Please Tell me the Way To Read .doc file in java using swing,with code
PDF to Word Conversion - Java Beginners
PDF to Word Conversion  Hello, Can we convert a PDF document to Microsoft word document thru Java. If its not possible in Java, is it possible in any other language
onfly conversion of jsp to pdf (urgent) - Development process
onfly conversion of jsp to pdf (urgent)  Hi, i m facing problem to convert jsp to pdf on on fly, i have an application in which there is some... (in PDF form) on a button click event all the text in jsp is dynamic comes from
To save table format data in pdf/excel in jsp
To save table format data in pdf/excel in jsp  Hello, I am doing web... table. So my question is ,I want so save this html format data in pdf/excel format... can save html table data in pdf/excel format.Your inputs are valuable to me
generate pdf using jsp
generate pdf using jsp  how do i generate a pdf using jsp that should query the data from the database and write it into a pdf and download the same
Merge multiple jasper file to one word Doc using java
Merge multiple jasper file to one word Doc using java   how to Merge multiple jasper file to one word Doc using java
how to convert doc file into html using java swing
how to convert doc file into html using java swing  i want to convert doc file into html and display it on jtextarea please help me and give the sample code
Open a .doc file by click on the link using struts - Struts
Open a .doc file by click on the link using struts   I want to open a doc extension file when i click a link on jsp page .I know only about which is write in web.xml but not exactly know how i do this.Plz any one can help me
how to create xml schema from xml doc using java
how to create xml schema from xml doc using java  i want to create xml schema from xml document programatically using java... am using Netbeans IDE... need to create the xml schema for that document and send both xml doc ans schema
About search and replace contains of .doc or .docx file using java.
About search and replace contains of .doc or .docx file using java.  Hi , I am trying to replace contents of ms.word document in .doc or .docx... any one tell me how could I replace them using java
regarding the pdf table using itext
regarding the pdf table using itext  if table exceeds the maximum width of the page how to manage
how to use Excel Templet to write excel file using java.
how to use Excel Templet to write excel file using java.  how to use Excel Templet to write excel file using java
convert html to excel using jsp
convert html to excel using jsp   i want to convert a html page into mcrosoft excel page using jsp.how i do
update excel sheet using jsp::
update excel sheet using jsp::   Hi Sir,... I have a excel... given excel sheet and display it into another excel sheet using jsp" i am using 'session' to get the empid from one page to another jsp
how to use Excel Template to write excel file using java
how to use Excel Template to write excel file using java  How to use Excel template to write data in that file using java
excel file using JDBC java.?
excel file using JDBC java.?  hey, i am a telecomm. engineer , and i am try to develop a tool which reads from a excel file and then appends the same... used JDBC ODBC to read from excel file. i am not able to append it using
Convert ZIP To PDF
in this pdf file by using the code PdfWriter.getInstance (doc, new...;  Lets discuss the conversion of a zipped file into pdf file... by using the string class constructor.Generate a pdf file by using
Excel file wriring using java
Excel file wriring using java  i have one predefined bill format in excel i want to append values in it using java apche POI or Jexcel i tried it but it overwrites file and lost previous contents what can i do
Exporting to excel using display tag?
Exporting to excel using display tag?  Hai , I am implementing pagination in struts.It has export to excel option.When I am clicking... to excel option.Please help me on this. Regards, N.Santosh
how to create pdf file using java and itextjar
how to create pdf file using java and itextjar  How to create pdf file having paragraphs and alignments done using java and itextjar 5.10 version.? hope i get quick response
how to create pdf file using java and itextjar
how to create pdf file using java and itextjar  How to create pdf file having paragraphs and alignments done using java and itextjar 5.10 version.? hope i get quick response
how to create an excel file using java
how to create an excel file using java  how to create an excel file using java
pdf to text
pdf to text  how to covert pdf file (which contain table and text) into word or excel file using itext api
 

 

 

DMCA.com