I wanted to create a PDF doc out of a TXT file.... Before doing that, i just wanted to generate a PDF doc that contains a string in it. I did it using the following code:
try{
FileWriter fr = new FileWriter("C:/WS_FTP.pdf");
fr.write("hello");
fr.close();
}
I could see the PDF getting generated. But when i try to open that, i get a message saying that it is either corrupted or the fileType is not supported or it might be it was not decoded correctly.
I could open the file using TextPad. When i open it using TextPad, i could see the message - "hello" in it.
Can anyone resolve this problem?
If i want to convert the type of docs, how should i proceed... ? For eg., if i want to create hi.PDF from hi.TXT, what should i exactly do?
I was thinking to do in this way -
Put the data from the TXT to OutPutStream and write it in the new PDF doc... I am just giving it a try as i am not well versed in IO..