How to save a PDF file from the PDF URL of Orbeon form with Java -


i tried save pdf document pdf url generated orbeon java, , inputstream null. when open url in browser work when inspect code don't find body of pdf.

try {     url urlpdf = new url(urlpdforbeon);      urlconnection connection = urlpdf.openconnection();      inputstream in = connection.getinputstream();     system.out.println(ioutils.tostring(in)) ;     fileoutputstream fos = new fileoutputstream(newfile("yourfile.pdf"));      int length = -1;     byte[] buffer = new byte[1024];     while ((length = in.read(buffer)) > -1) {        fos.write(buffer, 0, length);     }     fos.close();     in.close(); 

}

the input stream not null. doesn't have byte read anymore when try writing content file. , that's expected, since before, read in stream calling

system.out.println(ioutils.tostring(in)); 

edit:

if input stream contains html page asking log in, it's need logged in access pdf.


Comments

Popular posts from this blog

php - trouble displaying mysqli database results in correct order -

depending on nth recurrence of job in control M -

sql server - Cannot query correctly (MSSQL - PHP - JSON) -