I'm working on a JSF 2.0 project using Mojarra, PrimeFaces and Tomcat 6.x, but in front I have an Apache HTTP server.
I created a web form where I can select PDF files which I want to merge. These files are external of my WAR in a directory under Apache HTTPD's control. I use iText 2.1.7 to merge the PDF files.
At the moment I'm accessing the files as follows:
PdfReader reader1 = new PdfReader(new URL("file:///appli/Vignette/vcm/inst-vgninst/docroot_CDC" + file));
PdfReader reader1 = new PdfReader(new URL("http://centos" + file));
PdfReader apparently can't work directly with URLs which point to an external resource. If you really intend to work with
URL rather than
FileInputStream, then your best bet is to use
URL#openStream() to return an
InputStream to the
PdfReader. It has namely also a constructor for that.
PdfReader reader1 = new PdfReader(new URL("http://centos" + file).openStream());