on 10-18-2005 11:25 PM
I have added a PDF to my web project and now I want to access this within a servlet/jsp with a file reference. Like new File("webproject/webContent/pdfs/mine.pdf");. Is this possible?
Hi Nathan, you can read a .pdf file but what you will see is something like that:
"%PDF-1.4
%âãÏÓ
962 0 obj+µk#Ù»Òêb[ B1)n,G6 -Ie#Û8ÁÁÆ?¡´ 9Ä&q( Ѧ?l\u00A2¤¥1!Kë&! J´ôF éLá? 3?I i3}Hé é%íL_zþ¯Öm úØ?µÿ¹ïv- ..."
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nathan,
Usually you can do it but not with new File( ). You can do it via the getResourceAsStream from your class loader object, which you can access through your class or through you thread.
For example :
ClassName.class.getResourceAsStream( ) or this.getClass().getResourceAsStream( ) or Thread. currentThread().getContextClassLoader().().getResourceAsStream( )
Regards,
Avi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
9 | |
8 | |
6 | |
6 | |
6 | |
5 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.