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


Java PDDocumentInformation類代碼示例

本文整理匯總了Java中org.sejda.sambox.pdmodel.PDDocumentInformation的典型用法代碼示例。如果您正苦於以下問題:Java PDDocumentInformation類的具體用法?Java PDDocumentInformation怎麽用?Java PDDocumentInformation使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: testPDFBox3208

import org.sejda.sambox.pdmodel.PDDocumentInformation; //導入依賴的package包/類
@Test
public void testPDFBox3208() throws IOException
{
    try (PDDocument doc = PDFParser.parse(SeekableSources.inMemorySeekableSourceFrom(getClass()
            .getResourceAsStream(
                    "/org/sejda/sambox/input/PDFBOX-3208-L33MUTT2SVCWGCS6UIYL5TH3PNPXHIS6.pdf"))))
    {
        PDDocumentInformation di = doc.getDocumentInformation();
        assertEquals("Liquent Enterprise Services", di.getAuthor());
        assertEquals("Liquent services server", di.getCreator());
        assertEquals("Amyuni PDF Converter version 4.0.0.9", di.getProducer());
        assertEquals("", di.getKeywords());
        assertEquals("", di.getSubject());
        assertEquals("892B77DE781B4E71A1BEFB81A51A5ABC_20140326022424.docx", di.getTitle());
        assertEquals(DateConverter.toCalendar("D:20140326142505-02'00'"), di.getCreationDate());
        assertEquals(DateConverter.toCalendar("20140326172513Z"), di.getModificationDate());
    }
}
 
開發者ID:torakiki,項目名稱:sambox,代碼行數:19,代碼來源:PDFParserTest.java

示例2: testPDFBox3940

import org.sejda.sambox.pdmodel.PDDocumentInformation; //導入依賴的package包/類
@Test
public void testPDFBox3940() throws IOException
{
    try (PDDocument doc = PDFParser.parse(SeekableSources.inMemorySeekableSourceFrom(
            getClass().getResourceAsStream("/org/sejda/sambox/input/PDFBOX-3940-079977.pdf"))))
    {
        PDDocumentInformation di = doc.getDocumentInformation();
        assertEquals("Unknown", di.getAuthor());
        assertEquals("C:REGULA~1IREGSFR_EQ_EM.WP", di.getCreator());
        assertEquals("Acrobat PDFWriter 3.02 for Windows", di.getProducer());
        assertEquals("", di.getKeywords());
        assertEquals("", di.getSubject());
        assertEquals("C:REGULA~1IREGSFR_EQ_EM.PDF", di.getTitle());
        assertEquals(DateConverter.toCalendar("Tuesday, July 28, 1998 4:00:09 PM"),
                di.getCreationDate());
    }
}
 
開發者ID:torakiki,項目名稱:sambox,代碼行數:18,代碼來源:PDFParserTest.java

示例3: accept

import org.sejda.sambox.pdmodel.PDDocumentInformation; //導入依賴的package包/類
@Override
public void accept(PDDocument document, PdfDocumentDescriptor descriptor) {
    descriptor.pages(document.getNumberOfPages());
    descriptor.setVersion(getVersion(document.getVersion()));
    PDDocumentInformation info = document.getDocumentInformation();
    descriptor.putInformation(PdfMetadataKey.TITLE.getKey(), info.getTitle());
    descriptor.putInformation(PdfMetadataKey.AUTHOR.getKey(), info.getAuthor());
    descriptor.putInformation(PdfMetadataKey.CREATOR.getKey(), info.getCreator());
    descriptor.putInformation(PdfMetadataKey.SUBJECT.getKey(), info.getSubject());
    descriptor.putInformation(PdfMetadataKey.KEYWORDS.getKey(), info.getKeywords());
    descriptor.putInformation("Producer", info.getProducer());
    Optional.ofNullable(info.getCreationDate()).map(FORMATTER::format)
            .ifPresent(c -> descriptor.putInformation("FormattedCreationDate", c));
}
 
開發者ID:torakiki,項目名稱:pdfsam,代碼行數:15,代碼來源:DefaultSAMBoxLoader.java

示例4: setUp

import org.sejda.sambox.pdmodel.PDDocumentInformation; //導入依賴的package包/類
@Before
public void setUp() {
    document = mock(PDDocument.class);
    descriptor = PdfDocumentDescriptor.newDescriptorNoPassword(mock(File.class));
    info = mock(PDDocumentInformation.class);
    when(document.getDocumentInformation()).thenReturn(info);
    when(document.getVersion()).thenReturn("1.4");
    when(document.getNumberOfPages()).thenReturn(2);
    when(info.getAuthor()).thenReturn("Chuck Norris");
    when(info.getSubject()).thenReturn("Roundhause");
    when(info.getCreationDate()).thenReturn(new GregorianCalendar());
}
 
開發者ID:torakiki,項目名稱:pdfsam,代碼行數:13,代碼來源:DefaultSAMBoxLoaderTest.java

示例5: doExecute

import org.sejda.sambox.pdmodel.PDDocumentInformation; //導入依賴的package包/類
private void doExecute() throws IOException {
    testContext.pdfOutputTo(parameters);
    execute(parameters);
    PDDocument document = testContext.assertTaskCompleted();
    testContext.assertCreator().assertVersion(PdfVersion.VERSION_1_7);
    PDDocumentInformation info = document.getDocumentInformation();
    assertEquals("test_author", info.getAuthor());
    assertEquals("test_keywords", info.getKeywords());
    assertEquals("test_subject", info.getSubject());
    assertEquals("test_title", info.getTitle());
}
 
開發者ID:torakiki,項目名稱:sejda,代碼行數:12,代碼來源:SetMetadataTaskTest.java

示例6: execute

import org.sejda.sambox.pdmodel.PDDocumentInformation; //導入依賴的package包/類
@Override
public void execute(SetMetadataParameters parameters) throws TaskException {
    executionContext().assertTaskNotCancelled();
    notifyEvent(executionContext().notifiableTaskMetadata()).progressUndetermined();

    PdfSource<?> source = parameters.getSource();
    LOG.debug("Opening {}", source);
    documentHandler = source.open(documentLoader);
    documentHandler.setCreatorOnPDDocument();

    File tmpFile = createTemporaryBuffer(parameters.getOutput());
    outputWriter.taskOutput(tmpFile);
    LOG.debug("Temporary output set to {}", tmpFile);

    LOG.debug("Setting metadata on temporary document.");
    PDDocumentInformation actualMeta = documentHandler.getUnderlyingPDDocument().getDocumentInformation();
    for (Entry<PdfMetadataKey, String> meta : parameters.entrySet()) {
        LOG.trace("'{}' -> '{}'", meta.getKey().getKey(), meta.getValue());
        actualMeta.setCustomMetadataValue(meta.getKey().getKey(), meta.getValue());
    }

    documentHandler.setVersionOnPDDocument(parameters.getVersion());
    documentHandler.setCompress(parameters.isCompress());
    documentHandler.savePDDocument(tmpFile);
    nullSafeCloseQuietly(documentHandler);

    parameters.getOutput().accept(outputWriter);

    LOG.debug("Metadata set on {}", parameters.getOutput());

}
 
開發者ID:torakiki,項目名稱:sejda,代碼行數:32,代碼來源:SetMetadataTask.java

示例7: setDocumentTitle

import org.sejda.sambox.pdmodel.PDDocumentInformation; //導入依賴的package包/類
public void setDocumentTitle(String title) {
    PDDocumentInformation info = document.getDocumentInformation();
    info.setTitle(title);
    document.setDocumentInformation(info);
}
 
開發者ID:torakiki,項目名稱:sejda,代碼行數:6,代碼來源:PDDocumentHandler.java

示例8: setThreadInfo

import org.sejda.sambox.pdmodel.PDDocumentInformation; //導入依賴的package包/類
/**
 * Set the thread info, can be null.
 *
 * @param info The info dictionary about this thread.
 */
public void setThreadInfo(PDDocumentInformation info)
{
    thread.setItem("I", info);
}
 
開發者ID:torakiki,項目名稱:sambox,代碼行數:10,代碼來源:PDThread.java

示例9: setDocumentInformation

import org.sejda.sambox.pdmodel.PDDocumentInformation; //導入依賴的package包/類
/**
 * Set the document information on the underlying {@link PDDocument}
 * 
 * @param info
 */
public void setDocumentInformation(PDDocumentInformation info) {
    document.setDocumentInformation(info);
}
 
開發者ID:torakiki,項目名稱:sejda,代碼行數:9,代碼來源:PDDocumentHandler.java


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