Hi everyone, some help please
i wanted to create pdf with Itext , everything works well until i've made the runnable jar . Adobe reader shows that message : "Adobe Reader could not open xxx.pdf because it is either not a supported file type or because the file has been damaged. and the file generated 0 ko here is some of my code :
That's probably too much for anyone to step through and, as it isn't an SSCCE, i's not something we could attempt to debug.
There's database connections in there as well.
So, I suggest you stick debug statements in there to see what values you are getting through that method.
That might help you see what is being added to your document and whether or not it is being saved.
ETA: Actually, thinking about it, I'd take out most of that code and add bits in slowly, seeing whether the document saves properly.
For starters, skip the database bits and just try and get some dummy paragraph saved.
If that code produces a PDF file with zero bytes, that must mean that the code which generates the PDF and writes it to the file is not executed. Or at least the "doc.close()" is not executed.
That strongly suggests to me that an exception has been thrown somewhere. You may think that printing the name of the exception to sysout would tell you that, but since the code you are running is Swing code, you don't get to see sysout.
I also notice that your code uses relative paths to access files. It is possible that when you run the executable jar file, your current working directory is not the same as it was in Netbeans. That will also be a problem.
posted 2 months ago
when i am on netbeans , every thing is going well , the pdf is created and i can print it.
but when i make the runnable jar the pdf is created but his size is 0ko and can't be opened