2013-07-18 82 views
0

使用PDFbox,我想在/Catalog条目中添加PDXObjectForm。我有这样的使用方法:重命名/目录中创建的PDXObjectForm

  PDStream formstream = new PDStream(template); 
     PDXObjectForm form = new PDXObjectForm(formstream); 
     PDResources res = new PDResources(); 
     form.setResources(res); 
     appendRawCommands(formstream.createOutputStream(), "TESTING"); 
     // this creates AA. I need costum name Object 
     PDDocumentCatalogAdditionalActions ac = new PDDocumentCatalogAdditionalActions(res.getCOSDictionary()); 
     template.getDocumentCatalog().setActions(ac); 

但是/ Catalog条目中的表单名称现在是“AA”。如何将该名称更改为“DSS”?

这样做的最好方法是什么?我不知道如何在/ Catalog条目中添加PDXObjectForm。 DocumentCatalogAdditionalActions不是最好的解决方案,我知道它是错误的,我想使用正确的方法。

我可以在Document Secure Store中使用PDXObjectForm吗?

回答

0

我的解决办法:

PDDocumentCatalog cat = template.getDocumentCatalog(); 
    COSDictionary catDoc = cat.getCOSDictionary(); 

    COSDictionary dssDictionary = new COSDictionary(); 
    catDoc.setItem(COSName.getPDFName("DSS"), dssDictionary); 
  1. DSS必须Dictionary,不PDXObjectForm
  2. PDDocumentCatalogAdditionalActions没有必要。它会创建“AA”,因为AdditionalActions这不是我所需要的。