Ниже приведен фрагмент кода, который я попробовал, но он не работает должным образом:
Код: Выделить всё
public void loadPDF(String url, String name) throws IOException {
PDDocument document = null;
URL pdfUrl = new URL(url);
URLConnection urlConnection = pdfUrl.openConnection();
InputStream ip = urlConnection.getInputStream();
BufferedInputStream bf = new BufferedInputStream(ip);
try {
document = Loader.loadPDF((RandomAccessRead) ip);
} catch (IOException e) {
Assert.fail("Could not load PDF. Please check the URL again");
}
}
Подробнее здесь: https://stackoverflow.com/questions/777 ... t-a-method
Мобильная версия