本文整理匯總了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;
}
示例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();
}
示例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();
}