當前位置: 首頁>>代碼示例>>Java>>正文


Java PdfReader.getInfo方法代碼示例

本文整理匯總了Java中com.itextpdf.text.pdf.PdfReader.getInfo方法的典型用法代碼示例。如果您正苦於以下問題:Java PdfReader.getInfo方法的具體用法?Java PdfReader.getInfo怎麽用?Java PdfReader.getInfo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.itextpdf.text.pdf.PdfReader的用法示例。


在下文中一共展示了PdfReader.getInfo方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createCropJob

import com.itextpdf.text.pdf.PdfReader; //導入方法依賴的package包/類
public static CropJob createCropJob(ClusterJob curClusterJob) throws IOException {
	File source = curClusterJob.getSource();
	if (source != null && source.exists()) {
		PdfReader reader = new PdfReader(source.getAbsolutePath());
		CropJob result = new CropJob(source, reader.getNumberOfPages(), reader.getInfo(),
				SimpleBookmark.getBookmark(reader));
		reader.close();
		result.setClusterCollection(curClusterJob.getClusterCollection());
		return result;
	}
	return null;
}
 
開發者ID:mbaeuerle,項目名稱:Briss-2.0,代碼行數:13,代碼來源:CropManager.java

示例2: testChangeTitleWithoutTempFile

import com.itextpdf.text.pdf.PdfReader; //導入方法依賴的package包/類
/**
 * <a href="http://stackoverflow.com/questions/43511558/how-to-set-attributes-for-existing-pdf-that-contains-only-images-using-java-itex">
 * how to set attributes for existing pdf that contains only images using java itext?
 * </a>
 * <p>
 * The OP indicated in a comment that he searches a solution without a second file.
 * This test shows how to work with a single file, by first loading the file into a byte array.
 * </p>
 */
@Test
public void testChangeTitleWithoutTempFile() throws IOException, DocumentException
{
    File singleFile = new File(RESULT_FOLDER, "eg_01-singleFile.pdf");
    try (   InputStream resource = getClass().getResourceAsStream("eg_01.pdf")  )
    {
        Files.copy(resource, singleFile.toPath());
    }

    byte[] original = Files.readAllBytes(singleFile.toPath());

    PdfReader reader = new PdfReader(original);
    PdfStamper stamper = new PdfStamper(reader, new FileOutputStream(singleFile));
    Map<String, String> info = reader.getInfo();
    info.put("Title", "New title");
    info.put("CreationDate", new PdfDate().toString());
    stamper.setMoreInfo(info);
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    XmpWriter xmp = new XmpWriter(baos, info);
    xmp.close();
    stamper.setXmpMetadata(baos.toByteArray());
    stamper.close();
    reader.close();
}
 
開發者ID:mkl-public,項目名稱:testarea-itext5,代碼行數:34,代碼來源:UpdateMetaData.java

示例3: PdfMetaInformation

import com.itextpdf.text.pdf.PdfReader; //導入方法依賴的package包/類
public PdfMetaInformation(final File source) throws IOException {
	PdfReader reader = new PdfReader(source.getAbsolutePath());
	this.sourcePageCount = reader.getNumberOfPages();
	this.sourceMetaInfo = reader.getInfo();
	this.sourceBookmarks = SimpleBookmark.getBookmark(reader);
	reader.close();

}
 
開發者ID:mbaeuerle,項目名稱:Briss-2.0,代碼行數:9,代碼來源:DocumentCropper.java


注:本文中的com.itextpdf.text.pdf.PdfReader.getInfo方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。