Firstly thanks for providing a great library!
Now onto the issue I am having!
I have the following method:-
* read a pdf document.
protected void readFile(String location) throws IOException
Debug.logInfo("File location passed into PDFIngestService:" + location, module);
FileLocator locator = new FileLocator(location);
document = PDDocument.createFromLocator(locator);
catch (COSLoadException e)
Debug.logInfo("Problem parsing PDF document. Check format.", module);
The issue I am having is that the filename the locator is using has my local path appended, ie: the path I pass in is:
and the path the createFromLocator method uses is:-
It appears to append my local path when trying to access the file.
Any advice you could give would be much appreciated.
Thanks In Advance,
>The issue I am having is that the filename the locator is using has my local path appended,
>ie: the path I pass in is: http://webadress/img/aviva/TempDocs/Doc01.doc
The class FileLocator just handles local files and not URLs. So the FileLocator behaves as expected. You have to load the URL yourself and store it either in a temporary file or in memory. Then you can access the temporary file with a FileLocator (new FileLocator("path/to/tempFile")) or use a ByteArrayLocator to access a in memory byte array, if you saved the URL's document in memory.
The other thing is, it seems like you are trying to load a Word document (Doc01.doc), which will not work. You can only load PDF documents with the jPod library. If you want to convert the doc file to a PDF document, then you will have to use one of the many Ghostscript bases PDF printers.
Many thanks for the reply. Apologies the example I stated was using a word document but I was using a PDF file in actual code!
I thought it may be an issue with using a http location in the locator!
Problem is now fixed!