on 06-17-2011 12:08 PM
Hi Experts,
I want to create a pdf file from some inputstream or string content in Webdynpro Java code.
Can anyone please provide me some code snippet related to this.
I tried below code:
-
public class test {
public static void main(String[] args) {
String strFilePath = "C://demo.pdf";
try {
FileOutputStream fos = new FileOutputStream(strFilePath);
String strContent =
"Write File using Java FileOutputStream example !";
fos.write(strContent.getBytes());
fos.close();
} catch (FileNotFoundException ex) {
System.out.println("FileNotFoundException : " + ex);
} catch (IOException ioe) {
System.out.println("IOException : " + ioe);
}
-
It is creating a pdf file in my local system but while opening the file it is saying "Corrupted file".-
Any kind of help will be highly appreciated.
Regards,
Sambarn
i think you need some open souce lib to generate pdf file. like itext.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You have to use WDResource and related classes for reading/writing the files on portal app server.
For getting some Idea, look at this wiki.
-Yugandhar Reddy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.