1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| // connexion au ftp --> pas de problème
ftp.setFileType(FTP.BINARY_FILE_TYPE);
// s est un String égal au nom du fichier pdf que je veux récupérer
InputStream myStream = ftp.retrieveFileStream(s);
myStream.close();
ftp.completePendingCommand();
ByteArrayOutputStream bos = new ByteArrayOutputStream(5000);
// Remplir ici votre bos avec le flux du PDF
response.setContentType("application/pdf");
OutputStream os = response.getOutputStream();
os.write(bos.toByteArray(), 0, bos.size());
os.flush();
os.close();
return null; |
Partager