本文整理汇总了Java中org.apache.pdfbox.cos.COSDictionary.setString方法的典型用法代码示例。如果您正苦于以下问题:Java COSDictionary.setString方法的具体用法?Java COSDictionary.setString怎么用?Java COSDictionary.setString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.pdfbox.cos.COSDictionary
的用法示例。
在下文中一共展示了COSDictionary.setString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setField
import org.apache.pdfbox.cos.COSDictionary; //导入方法依赖的package包/类
public static void setField(PDDocument _pdfDocument, String name, String value) throws IOException
{
PDDocumentCatalog docCatalog = _pdfDocument.getDocumentCatalog();
PDAcroForm acroForm = docCatalog.getAcroForm();
PDField field = acroForm.getField(name);
COSDictionary dict = ((PDField) field).getDictionary();
COSString defaultAppearance = (COSString) dict
.getDictionaryObject(COSName.DA);
if (defaultAppearance != null)
{
dict.setString(COSName.DA, "/Helv 10 Tf 0 g");
if (name.equalsIgnoreCase("Field1")) {
dict.setString(COSName.DA, "/Helv 12 Tf 0 g");
}
}
if (field instanceof PDTextbox)
{
field = new PDTextbox(acroForm, dict);
((PDField) field).setValue(value);
}
}
示例2: setFieldBold
import org.apache.pdfbox.cos.COSDictionary; //导入方法依赖的package包/类
public static void setFieldBold(PDDocument _pdfDocument, String name, String value) throws IOException
{
PDDocumentCatalog docCatalog = _pdfDocument.getDocumentCatalog();
PDAcroForm acroForm = docCatalog.getAcroForm();
PDField field = acroForm.getField(name);
COSDictionary dict = ((PDField) field).getDictionary();
COSString defaultAppearance = (COSString) dict
.getDictionaryObject(COSName.DA);
if (defaultAppearance != null)
{
dict.setString(COSName.DA, "/Helv 10 Tf 2 Tr .5 w 0 g");
if (name.equalsIgnoreCase("Field1")) {
dict.setString(COSName.DA, "/Helv 12 Tf 0 g");
}
}
if (field instanceof PDTextbox)
{
field = new PDTextbox(acroForm, dict);
((PDField) field).setValue(value);
}
}
示例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: setFieldFromComponent
import org.apache.pdfbox.cos.COSDictionary; //导入方法依赖的package包/类
@Override
public void setFieldFromComponent() {
COSDictionary dict = getField().getDictionary();
dict.setString(PM_SIGNATURE_NAME_KEY, PM_SIGNATURE_NAME_PLACEHOLDER);
compatibleUI().setAppearance(PM_SIGNATURE_NAME_PLACEHOLDER);
compatibleUI().setSigned(true);
}