本文整理汇总了Java中com.lowagie.text.pdf.PdfBoolean类的典型用法代码示例。如果您正苦于以下问题:Java PdfBoolean类的具体用法?Java PdfBoolean怎么用?Java PdfBoolean使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PdfBoolean类属于com.lowagie.text.pdf包,在下文中一共展示了PdfBoolean类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setSortOrder
import com.lowagie.text.pdf.PdfBoolean; //导入依赖的package包/类
/**
* Defines the sort order of the field (ascending or descending).
* @param ascending an array with every element corresponding with a name of a field.
*/
public void setSortOrder(boolean[] ascending) {
PdfObject o = get(PdfName.S);
if (o instanceof PdfArray) {
if (((PdfArray)o).size() != ascending.length) {
throw new IllegalArgumentException("The number of booleans in this array doesn't correspond with the number of fields.");
}
PdfArray array = new PdfArray();
for (int i = 0; i < ascending.length; i++) {
array.add(new PdfBoolean(ascending[i]));
}
put(PdfName.A, array);
}
else {
throw new IllegalArgumentException("You need a single boolean for this collection sort dictionary.");
}
}
示例2: setViewerPreferences
import com.lowagie.text.pdf.PdfBoolean; //导入依赖的package包/类
/**
* Sets the viewer preferences as the sum of several constants.
*
* @param preferences
* the viewer preferences
* @see PdfViewerPreferences#setViewerPreferences
*/
public void setViewerPreferences(int preferences) {
this.pageLayoutAndMode |= preferences;
// for backwards compatibility, it is also possible
// to set the following viewer preferences with this method:
if ((preferences & viewerPreferencesMask) != 0) {
pageLayoutAndMode = ~viewerPreferencesMask & pageLayoutAndMode;
if ((preferences & PdfWriter.HideToolbar) != 0)
viewerPreferences.put(PdfName.HIDETOOLBAR, PdfBoolean.PDFTRUE);
if ((preferences & PdfWriter.HideMenubar) != 0)
viewerPreferences.put(PdfName.HIDEMENUBAR, PdfBoolean.PDFTRUE);
if ((preferences & PdfWriter.HideWindowUI) != 0)
viewerPreferences.put(PdfName.HIDEWINDOWUI, PdfBoolean.PDFTRUE);
if ((preferences & PdfWriter.FitWindow) != 0)
viewerPreferences.put(PdfName.FITWINDOW, PdfBoolean.PDFTRUE);
if ((preferences & PdfWriter.CenterWindow) != 0)
viewerPreferences.put(PdfName.CENTERWINDOW, PdfBoolean.PDFTRUE);
if ((preferences & PdfWriter.DisplayDocTitle) != 0)
viewerPreferences.put(PdfName.DISPLAYDOCTITLE, PdfBoolean.PDFTRUE);
if ((preferences & PdfWriter.NonFullScreenPageModeUseNone) != 0)
viewerPreferences.put(PdfName.NONFULLSCREENPAGEMODE, PdfName.USENONE);
else if ((preferences & PdfWriter.NonFullScreenPageModeUseOutlines) != 0)
viewerPreferences.put(PdfName.NONFULLSCREENPAGEMODE, PdfName.USEOUTLINES);
else if ((preferences & PdfWriter.NonFullScreenPageModeUseThumbs) != 0)
viewerPreferences.put(PdfName.NONFULLSCREENPAGEMODE, PdfName.USETHUMBS);
else if ((preferences & PdfWriter.NonFullScreenPageModeUseOC) != 0)
viewerPreferences.put(PdfName.NONFULLSCREENPAGEMODE, PdfName.USEOC);
if ((preferences & PdfWriter.DirectionL2R) != 0)
viewerPreferences.put(PdfName.DIRECTION, PdfName.L2R);
else if ((preferences & PdfWriter.DirectionR2L) != 0)
viewerPreferences.put(PdfName.DIRECTION, PdfName.R2L);
if ((preferences & PdfWriter.PrintScalingNone) != 0)
viewerPreferences.put(PdfName.PRINTSCALING, PdfName.NONE);
}
}
示例3: addViewerPreference
import com.lowagie.text.pdf.PdfBoolean; //导入依赖的package包/类
/**
* Sets the viewer preferences for printing.
*/
public void addViewerPreference(PdfName key, PdfObject value) {
switch(getIndex(key)) {
case 0: // HIDETOOLBAR
case 1: // HIDEMENUBAR
case 2: // HIDEWINDOWUI
case 3: // FITWINDOW
case 4: // CENTERWINDOW
case 5: // DISPLAYDOCTITLE
case 14: // PICKTRAYBYPDFSIZE
if (value instanceof PdfBoolean) {
viewerPreferences.put(key, value);
}
break;
case 6: // NONFULLSCREENPAGEMODE
if (value instanceof PdfName
&& isPossibleValue((PdfName)value, NONFULLSCREENPAGEMODE_PREFERENCES)) {
viewerPreferences.put(key, value);
}
break;
case 7: // DIRECTION
if (value instanceof PdfName
&& isPossibleValue((PdfName)value, DIRECTION_PREFERENCES)) {
viewerPreferences.put(key, value);
}
break;
case 8: // VIEWAREA
case 9: // VIEWCLIP
case 10: // PRINTAREA
case 11: // PRINTCLIP
if (value instanceof PdfName
&& isPossibleValue((PdfName)value, PAGE_BOUNDARIES)) {
viewerPreferences.put(key, value);
}
break;
case 12: // PRINTSCALING
if (value instanceof PdfName
&& isPossibleValue((PdfName)value, PRINTSCALING_PREFERENCES)) {
viewerPreferences.put(key, value);
}
break;
case 13: // DUPLEX
if (value instanceof PdfName
&& isPossibleValue((PdfName)value, DUPLEX_PREFERENCES)) {
viewerPreferences.put(key, value);
}
break;
case 15: // PRINTPAGERANGE
if (value instanceof PdfArray) {
viewerPreferences.put(key, value);
}
break;
case 16: // NUMCOPIES
if (value instanceof PdfNumber) {
viewerPreferences.put(key, value);
}
break;
}
}
示例4: setVisible
import com.lowagie.text.pdf.PdfBoolean; //导入依赖的package包/类
/**
* Sets the initial visibility of the field.
* @param visible the default is true (visible)
*/
public void setVisible(boolean visible) {
put(PdfName.V, new PdfBoolean(visible));
}
示例5: setEditable
import com.lowagie.text.pdf.PdfBoolean; //导入依赖的package包/类
/**
* Indication if the field value should be editable in the viewer.
* @param editable the default is false (not editable)
*/
public void setEditable(boolean editable) {
put(PdfName.E, new PdfBoolean(editable));
}