hi,
I'm working on a Java module and need to access a PDF file and modify it in the Java code.
The file is located under resources/files, but every string I've tried to pass to the com.itextpdf.PdfReader returns IOException, "not found as file or resource."
What am I missing?
thanks,
bront |
|
jeckels responded: |
2014-06-20 09:42 |
Hi Bront,
A couple of options to try, both of which will give you an InputStream:
1. Put the file in the "resources/web" directory for your module. Use ViewServlet.getViewServletContext().getResourceAsStream() with the relative path under that directory. Note that this will also expose the file directly via HTTP as part of the webapp.
2. Put the file under your Java source root. Use getClass().getClassLoader().getResourceAsStream() with the relative path under the source root.
Thanks,
Josh |
|
bront responded: |
2014-06-20 10:07 |
Josh,
Perfect. Thanks for clearing this road block for me.
cheers,
bront |
|
|
|