本文整理汇总了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"));
}
}
示例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;
}
示例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");
}
示例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;
}
示例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;
}