使用PDFbox閱讀PDF文件的PDF文件,下面的jave代碼完美地閱讀pdf並存儲在項目位置。PDF閱讀使用PDF盒 - 澄清頁數
String pdfPageCount = 17;
String pdfUrl = "abc.org/invoicepdf.pdf?Range=1";
URL pdfDownload = new URL(pdfUrl);
connectionGet = (HttpsURLConnection) pdfDownload.openConnection();
String authorizationHeader1 = "Bearer " + getToken;
connectionGet.setRequestProperty("Authorization", authorizationHeader1);
connectionGet.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
connectionGet.setRequestMethod("GET");
int responseCode = connectionGet.getResponseCode();
if (responseCode != 404) {
PDDocument pd = new PDDocument();
InputStream inputstreamFinal1 = connectionGet.getInputStream();
PDDocument load = PDDocument.load(inputstreamFinal1);
load.save("CopyOfInvoice1.pdf");
}
我的下一步
我想基礎上,pdfPageCount
價值循環的過程中,目前我做硬編碼在pdfUrl(/invoicepdf.pdf?Range=1
)
的頁面數在1預計:
閱讀所有17頁並保存爲一個pdf文件
所以,你想知道如何將17個獨立的pdf頁面合併成一個文件? –
@rabbitguy:正好 – Prabu
夥計請求幫助 – Prabu