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


Java COSDictionary.setString方法代码示例

本文整理汇总了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);
	}
}
 
开发者ID:mkl-public,项目名称:testarea-pdfbox1,代码行数:23,代码来源:FillFormCustomFont.java

示例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);
	}
}
 
开发者ID:mkl-public,项目名称:testarea-pdfbox1,代码行数:23,代码来源:FillFormCustomFont.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: 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);
}
 
开发者ID:PM-Master,项目名称:Harmonia-1.5,代码行数:8,代码来源:PDFieldSwingAdapters.java


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