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



Home Answers Viewqa JavaScriptQuestions Convert Text File to PDF file
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Krishna Kumar
Convert Text File to PDF file
0 Answer(s)      a year and 8 months ago
Posted in : JavaScript Questions


import java.io.BufferedReader; import java.io.FileOutputStream; import java.io.FileReader;

import com.lowagie.text.Document; import com.lowagie.text.Paragraph; import com.lowagie.text.pdf.PdfWriter;

public class TextFileToPDF { private static void doReadWriteTextFile() {

    try {

        BufferedReader inputStream = new BufferedReader(new FileReader(
                Input File));

        String inLine = null;
        StringBuffer sb = new StringBuffer("");

        while ((inLine = inputStream.readLine()) != null) {

            sb.append(inLine);
        }

        Document document = new Document();
        PdfWriter.getInstance(document, new FileOutputStream(
                output file));
        document.open();
        document.add(new Paragraph(sb.toString()));
        sb.append(inLine);
        System.out.println("Text is inserted into pdf file");
        document.close();

        inputStream.close();

    } catch (Exception e) {

        System.out.println("IOException:");
        e.printStackTrace();

    }

}

public static void main(String[] args) {
    doReadWriteTextFile();
}

}


Advertisement
View Answers

Related Tutorials/Questions & Answers:
Convert Text File to PDF file
Convert Text File to PDF file  Here is the way how to covert your Text file to PDF File, public class TextFileToPDF { private static void...(inLine); System.out.println("Text is inserted into pdf file
Convert Text File to PDF file
Convert Text File to PDF file  import java.io.BufferedReader; import...); System.out.println("Text is inserted into pdf file"); document.close... FileReader( Input File)); String inLine = null
Advertisements
convert data from pdf to text file - Java Beginners
convert data from pdf to text file   how to read the data from pdf file and put it into text file(.txt
Convert pdf to text file using Java
How to Convert pdf to text file in Java In this section, you will learn how to convert pdf file to text file in Java Programming. We have used itext api for this purpose. To read resume.pdf  file, we have used PDFReader class
Java code to convert pdf file to word file
Java code to convert pdf file to word file  How to convert pdf file to word file using Java
convert an pdf file to html in Java
convert an pdf file to html in Java  Hi all, How to convert an pdf file to html in Java? Currently all my data is generated into a report in pdf and i want to be able to generate it to html page as well. How to go about
CONVERT JTable DATA TO PDF FILE
CONVERT JTable DATA TO PDF FILE  HOW TO CONVERT JTable DATA TO .PDF FILE??PLEASE GIVE ME CODE FOR THAT.   Here is an example that reads the jtable data from the jframe and stored the data into the pdf file in the form
How to Convert PDF into rtf File Java
How to Convert PDF into rtf File Java  Hi, How could in covert the PDF file to rtf file in Java Programming. Please suggest any online example... the online example of Java Convert PDF into rtf File. Thanks
how to convert image file to text file?
how to convert image file to text file?  hi, can anybody tell how to convert image file to text file? plz help me
Add text into the pdf File - Development process
Add text into the pdf File  Hi friend, How can i insert or Add text into the pdf file from the exsting one in java.. Thanks in Advance...  Hi Friend, Please visit the following links: http
How to Convert Text Files into Gzip File
How to Convert Text Files into Gzip File  Hi, I am developing a small application using PHP language. The real problem is that how do i convert the text files into gzip file. how can i solve the problem.... Tnanks
Java convert jtable data to pdf file
Java convert jtable data to pdf file In this tutorial, you will learn how to convert jtable data to pdf file. Here is an example where we have created... have fetched the data from the jtable and save the data to pdf file. Example
how to convert text file to xml file in java. - XML
how to convert text file to xml file in java.  Hi all, I m having some problem. Problem is I want to convert a text file which is having the no of record(i.e no of different line of information)to a xml file through java
Convert pdf to rtf file using Java
Convert pdf to rtf file using Java In this section, you will learn how to convert .pdf file to .rtf file in java programming language. We have used itext api for this purpose. To read resume.pdf  file, we have used PDFReader class
Convert Text To PDF
Convert Text To PDF       Here we are discussing the convertion of a text file into a pdf file... required for the conversion of a text file into the pdf file from http
Convert text file to XML file in Java
Convert text file to XML file Java In this section, you will learn how to convert the text file into xml file in Java language. To do this, we have used... file. The Parser invoked startElement() method at the beginning of every element
Download PDF file
Download PDF file  How to download PDF file with JSF
converting html file into pdf - Struts
converting html file into pdf  i want to convert html file into pdf file using java code please help me
about pdf file handeling
about pdf file handeling  can i apend something in pdf file using... to handle pdf files. You can find the related examples from the given link: Handling PDF files
pdf file in jsp
pdf file in jsp  i have a pdf, which has to be displayed in a jsp page along with some html tags, the pdf which is to be displayed shold be readonly and wont allow the uer to save too
about pdf file handeling
about pdf file handeling  i have downloaded a jar file containing packages for writing in pdf files . in which folder i should copy it ? i'm using windowsXP os.pls give whole path
upload the pdf file only - Struts
upload the pdf file only  plz tell me,in my web application i want to upload only pdf file.but i m getting the problem when anyone change the extesion of EXE or TEXT with .pdf its also upload.plz give me response ASAP plz
text file
text file  Hello can I modify the program below so that all the numerical data is stored in an external text file,that is the data contained in the array list.Thank you! mport java.util.*; import java.text.*; import
text file
text file  Hi can you help me I have to modify the program below so that all the data held in it is stored in an external text file.So there should... at the start of the program from a seperate external text file.Thank you! mport
Uploading and download pdf or .txt file.
Uploading and download pdf or .txt file.  I want admin user to upload pdf file into database and the users can download those pdf format from database
pdf to text
pdf to text  how to covert pdf file (which contain table and text) into word or excel file using itext api
read restricted pdf file
read restricted pdf file  i have restricted file. package Encryption; import java.io.*; import java.util.*; import com.lowagie.text.*; import...()); } } } pdf given to code is in marathi it gives following output
read restricted pdf file
read restricted pdf file  i have restricted file. package Encryption; import java.io.*; import java.util.*; import com.lowagie.text...."+e.getStackTrace()); } } } pdf given to code
how to dispaly pdf file on browser
how to dispaly pdf file on browser  In my project i have created one pdf file(by pdfwriter) into my local mechine . after that it need to display in browser as a pdf file . but in jsp i can't display by tag can anyone give me
how to convert a text file thats is in russian to english and vice versa using java ?
how to convert a text file thats is in russian to english and vice versa using java ?   Hello, I am a beginner to java, I want to convert a text file which is in english to russian and vice versa Kindly advice me Thanks
Converting the text files into gzip file.
Converting text file into gzip file This example will explain you how to convert text files into gzip file. Under gzip operation, first text files... the phph tag. <?php # Compress text file into gzip and write gzip and read gzip
 

 

 

DMCA.com