Hi,
I am trying to open a pdf document using pdfreader. The problem is that the
url that the pdf is in requires authentication... I have tried setting the
url as: username:"passw...@url", but this works in a browser but when
running the code using that url I get the same: "java.io.IOException: Server
returned HTTP response code: 401" Error...

Searching around I have tried this:

URL url = new URL (file_name);
String userPassword = user + ":" + password;
String encoding = new sun.misc.BASE64Encoder().encode
(userPassword.getBytes());
URLConnection uc = url.openConnection();
uc.setRequestProperty("Authorization", "Basic " + encoding);
PdfReader reader = new PdfReader(uc.getURL());

But that just returns the same thing.

Any suggestions on how to do this would be appreciated.
Thank you.
-- 
View this message in context: 
http://itext-general.2136553.n4.nabble.com/PDFReader-and-authenticated-url-tp2318687p2318687.html
Sent from the iText - General mailing list archive at Nabble.com.

------------------------------------------------------------------------------
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.itextpdf.com/book/
Check the site with examples before you ask questions: 
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/

Reply via email to