Convert Text File to PDF file
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();
}
}
View Answers
Ads
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 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 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
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
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
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 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
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
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
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
convert a file .doc to .zip
convert a
file .doc to .zip hiii,
I uploaded a
file...;TITLE>Display
file upload form to the user</TITLE></HEAD>
<...;td><b>Choose the
file To Upload:</b></td>
<td><
Reading a text file in java
Reading a
text file in java What is the code for Reading a
text file... in java.io.* package for reading and writing to a
file in Java.
To learn more about reading
text file in Java see the tutorial Read
File in Java.
Thanks
Generate pdf file - JSP-Servlet
Generate
pdf file
Hi Friends,
How to generate the
pdf file for the jsp page or in servets Hi Friend,
You need to download itext api. After that set the classpath and try the following code
Sorting text file
Sorting
text file Hello friends, i'm writing search page for my local website. i'm storing all
file list in
text file. And also adding a value... according to begin value.
Text File having list like this:
5|
3|
can anyone
how to generate pdf file in struts
how to generate
pdf file in struts I am developing a struts application.I am having one registration form when i am submitting the form the values... be shown as
pdf or excel format
how to generate pdf file in struts
how to generate
pdf file in struts I am developing a struts application.I am having one registration form when i am submitting the form the values... be shown as
pdf or excel format
Write Hello in the pdf file
Write Hello in the
pdf file
 ...;Hello" word in a
pdf file irrespective of the
fact whether it exists...*, and com.lowagie.text.*. These two
package will help us to make and use
pdf file in our program.
Now
uploading a text file into a database
uploading a
text file into a database how to upload a
text file... {
static
File file;
public static void main(String[] args) throws Exception {
JLabel label=new JLabel("Choose
File
Read text File
Read
text File Hi,How can I get line and keep in a String in Java
form field mapping with pdf file using java
form field mapping with
pdf file using java Hai all,
I have one...
file.
means,
if click on
text field according that perticular field .the data related to the field in
pdf file should marked with a color.
can any one give