JAVA開発メモ
PDFBox
 

[リロード]   [新規|編集|差分|添付]   [トップ|一覧|単語検索|最終更新|バックアップ|ヘルプ]

サイトメニュー

String readFile = "xxx.pdf"; FileInputStream pdfStream = null; try { pdfStream = new FileInputStream(readFile); PDFParser pdfParser = new PDFParser(pdfStream); pdf = pdfParser.getPDDocument(); } catch (Exception e) { e.printStackTrace(); } finally { if (pdfStream != null) { pdfStream.close(); } } String writeFile = "xxx.pdf"; COSWriter writer = null; FileOutputStream stream = null; try { stream = new FileOutputStream(writeFile); writer = new COSWriter(stream); } catch (Exception e) { e.printStackTrace(); } finally { if (stream != null) { stream.close(); } if (writer != null) { writer.close(); } } PDDocumentCatalog docCatalog = pdf.getDocumentCatalog(); PDAcroForm acroForm = docCatalog.getAcroForm(); if (field != null) { } else { } String readFile = "C:\\tmp\\Antenna_Data_Sheet.pdf"; FileInputStream pdfStream = null; try { pdfStream = new FileInputStream(readFile); PDFParser pdfParser = new PDFParser(pdfStream); pdf = pdfParser.getPDDocument(); int imageCounter = 1; List pages = pdf.getDocumentCatalog().getAllPages(); Iterator iter = pages.iterator(); PDPage page = (PDPage) iter.next(); PDResources resources = page.getResources(); Map images = resources.getImages(); if (images != null) { Iterator imageIter = images.keySet().iterator(); while (imageIter.hasNext()) { String key = (String) imageIter.next(); PDXObjectImage image = (PDXObjectImage) images.get(key); String name = key + "-" + imageCounter; imageCounter++; System.out.println("Writing image:" + name); } } } } catch (Exception e) { e.printStackTrace(); } finally { if (pdfStream != null) { pdfStream.close(); } }

添付ファイル: filetest.png 534件 [削除]   fileCubeFX.exe 814件 [削除]   file110003224650.pdf 2940件 [削除]   fileクラスタリング参考.pdf 9731件 [削除]
リロード   新規 編集 差分   トップ 一覧 検索 最終更新 バックアップ   ヘルプ   最終更新のRSS
Last-modified: Tue, 13 Oct 2020 09:41:01 UTC (584d)
Link: FrontPage(2522d)

Modified by MT22(Moriwaki Takashi)

"PukiWiki" 1.3.7 Copyright © 2001,2002,2003 PukiWiki Developers Team. License is GNU/GPL.
Based on "PukiWiki" 1.3 by sng
Powered by PHP 7.4.28

HTML convert time to 0.022 sec.