当前位置: 首页>>代码示例>>Java>>正文


Java COSDictionary.setName方法代码示例

本文整理汇总了Java中org.apache.pdfbox.cos.COSDictionary.setName方法的典型用法代码示例。如果您正苦于以下问题:Java COSDictionary.setName方法的具体用法?Java COSDictionary.setName怎么用?Java COSDictionary.setName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.pdfbox.cos.COSDictionary的用法示例。


在下文中一共展示了COSDictionary.setName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: test

import org.apache.pdfbox.cos.COSDictionary; //导入方法依赖的package包/类
/**
 * <a href="https://stackoverflow.com/questions/46642994/how-to-create-pdf-package-using-pdfbox">
 * How to create pdf package using PdfBox?
 * </a>
 * <p>
 * This test implements the equivalent of the OP's code turning
 * a regular PDF into a portable collection.
 * </p>
 */
@Test
public void test() throws IOException {
    try (   InputStream resource = getClass().getResourceAsStream("/mkl/testarea/pdfbox2/sign/test.pdf"))
    {
        PDDocument pdDocument = PDDocument.load(resource);

        COSDictionary collectionDictionary = new COSDictionary();
        collectionDictionary.setName(COSName.TYPE, "Collection");
        collectionDictionary.setName("View", "T");
        PDDocumentCatalog catalog = pdDocument.getDocumentCatalog();
        catalog.getCOSObject().setItem("Collection", collectionDictionary);

        pdDocument.save(new File(RESULT_FOLDER, "test-collection.pdf"));
    }
}
 
开发者ID:mkl-public,项目名称:testarea-pdfbox2,代码行数:25,代码来源:CreatePortableCollection.java

示例2: importAsXObject

import org.apache.pdfbox.cos.COSDictionary; //导入方法依赖的package包/类
public static PDXObjectForm importAsXObject(PDDocument target, PDPage page) throws IOException
{
    final PDStream xobjectStream = new PDStream(target, page.getContents().createInputStream(), false);
    final PDXObjectForm xobject = new PDXObjectForm(xobjectStream);

    xobject.setResources(page.findResources());
    xobject.setBBox(page.findCropBox());

    COSDictionary group = new COSDictionary();
    group.setName("S", "Transparency");
    group.setBoolean(COSName.getPDFName("K"), true);
    xobject.getCOSStream().setItem(COSName.getPDFName("Group"), group);

    return xobject;
}
 
开发者ID:mkl-public,项目名称:testarea-pdfbox1,代码行数:16,代码来源:OverlayWithEffect.java

示例3: testCreateRolloverButton

import org.apache.pdfbox.cos.COSDictionary; //导入方法依赖的package包/类
@Test
public void testCreateRolloverButton() throws IOException, COSVisitorException
{
    PDAnnotationWidget widget = new PDAnnotationWidget();
    COSDictionary dictionary = widget.getDictionary();
    dictionary.setName("FT", "Btn");
    dictionary.setInt("Ff", 65536);
    dictionary.setString("T", "Push");

    PDActionURI action = new PDActionURI();
    action.setURI("http://www.pdfbox.org");
    widget.setAction(action);

    createRollover(widget, "rolloverButton.pdf");
}
 
开发者ID:mkl-public,项目名称:testarea-pdfbox1,代码行数:16,代码来源:RolloverAnnotation.java

示例4: createDssDictionary

import org.apache.pdfbox.cos.COSDictionary; //导入方法依赖的package包/类
COSDictionary createDssDictionary(Iterable<byte[]> certifiates, Iterable<byte[]> crls, Iterable<byte[]> ocspResponses) throws IOException
{
    final COSDictionary dssDictionary = new COSDictionary();
    dssDictionary.setNeedToBeUpdate(true);
    dssDictionary.setName(COSName.TYPE, "DSS");

    if (certifiates != null)
        dssDictionary.setItem(COSName.getPDFName("Certs"), createArray(certifiates));
    if (crls != null)
        dssDictionary.setItem(COSName.getPDFName("CRLs"), createArray(crls));
    if (ocspResponses != null)
        dssDictionary.setItem(COSName.getPDFName("OCSPs"), createArray(ocspResponses));

    return dssDictionary;
}
 
开发者ID:mkl-public,项目名称:testarea-pdfbox1,代码行数:16,代码来源:AddValidationRelatedInformation.java

示例5: importAsXObject

import org.apache.pdfbox.cos.COSDictionary; //导入方法依赖的package包/类
PDXObjectForm importAsXObject(PDDocument target, PDPage page) throws IOException
{
    final PDStream xobjectStream = new PDStream(target, page.getContents().createInputStream(), false);
    final PDXObjectForm xobject = new PDXObjectForm(xobjectStream);

    xobject.setResources(page.findResources());
    xobject.setBBox(page.findCropBox());

    COSDictionary group = new COSDictionary();
    group.setName("S", "Transparency");
    group.setBoolean(COSName.getPDFName("K"), true);
    xobject.getCOSStream().setItem(COSName.getPDFName("Group"), group);

    return xobject;
}
 
开发者ID:mkl-public,项目名称:testarea-pdfbox1,代码行数:16,代码来源:OverlayWithEffect.java


注:本文中的org.apache.pdfbox.cos.COSDictionary.setName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。