2013-07-18 80 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這不是我所需要的。