B4J Question PDFBox to load from URL

Markos

Active Member
Licensed User
Longtime User
Dear All,

I would like to load a pdf file from a URL using either the rewrap of pdfbox or other class or object. Any suggestions most welcomed.

Thanks
 

DonManfred

Expert
Licensed User
Longtime User
There is no such method in PDFBox. You need to download the PDF with okhttputils2 first.
 
Upvote 0

Markos

Active Member
Licensed User
Longtime User
Out of curiousity the downliaded file is not easily accessible by other apps or users poking around
 
Upvote 0

Markos

Active Member
Licensed User
Longtime User
Yes password pritected would be the savings grace. I will keep trying to find a streaming load version
 
Upvote 0

Markos

Active Member
Licensed User
Longtime User
The windows acrobat.dll and exe has the option to load via url. There must be a method we can use in conjunction with native java we can achieve same. Or Im too stubborn to give up just yet :D
 
Upvote 0

Markos

Active Member
Licensed User
Longtime User
PDDocument pddDocument = PDDocument.load(new URL("http://<website name>/<file name>.pdf"));

I keep seeing this in natuve java can we leverage this call within b4j?
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
The windows acrobat.dll and exe has the option to load via url.
I guess the acrobat software has the download code within it, it will achieve the same result if you download the file and save it to a temporary location the access it from there..
 
Upvote 0

Markos

Active Member
Licensed User
Longtime User
The ability to load has been satisfied, I was deliberating how to avoid not having to download and have it exist on the local OS but I have a feeling in some shape or form it may be unavoidable so the best case is that the pdf must be password protected to retain some protection from copying and printing by the end user
 
Upvote 0

Markos

Active Member
Licensed User
Longtime User
In the documentation for PDFBox V 1.8.12 https://pdfbox.apache.org/docs/1.8.12/javadocs/index.html?org/apache/pdfbox/pdmodel/PDDocument.html there is a load from URL method.

This seems to have been removed from V2.0.13. https://pdfbox.apache.org/docs/2.0.13/javadocs/ (sorry, can't link directly to the class)
That's what I was seeing but perhaps even that being said they may be just facilitating an implicit download via URL which puts me right back to as if loading a local file copy. So I will say issue closed as that is an acrobat limitation and all classes supporting same. But I have a work around thanks to everyone's help and must have password applied to ensure some protection from copy and printing.
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
If the File is loaded into memory, you may be able to delete the temporary file as soon as it's been loaded (if you don't need it again), at the very least you can delete it when you exit the app.
 
Upvote 0

Markos

Active Member
Licensed User
Longtime User
It would be great to delete as loaded but it nay not be possuble as it is being used unless adobe did somdthibg right and made a copy in memory to release the file. But will try it to see
 
Upvote 0
Top