本文整理汇总了Java中com.lowagie.text.pdf.PdfNumber类的典型用法代码示例。如果您正苦于以下问题:Java PdfNumber类的具体用法?Java PdfNumber怎么用?Java PdfNumber使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PdfNumber类属于com.lowagie.text.pdf包,在下文中一共展示了PdfNumber类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: invoke
import com.lowagie.text.pdf.PdfNumber; //导入依赖的package包/类
public void invoke(PdfContentStreamProcessor processor, PdfLiteral operator, ArrayList operands) {
PdfNumber aw = (PdfNumber) operands.get(0);
PdfNumber ac = (PdfNumber) operands.get(1);
PdfString string = (PdfString) operands.get(2);
ArrayList twOperands = new ArrayList(1);
twOperands.add(0, aw);
processor.invokeOperator(new PdfLiteral("Tw"), twOperands);
ArrayList tcOperands = new ArrayList(1);
tcOperands.add(0, ac);
processor.invokeOperator(new PdfLiteral("Tc"), tcOperands);
ArrayList tickOperands = new ArrayList(1);
tickOperands.add(0, string);
processor.invokeOperator(new PdfLiteral("'"), tickOperands);
}
示例2: getColorspace
import com.lowagie.text.pdf.PdfNumber; //导入依赖的package包/类
PdfObject getColorspace() {
if (icc_profile != null) {
if ((colorType & 2) == 0)
return PdfName.DEVICEGRAY;
else
return PdfName.DEVICERGB;
}
if (gamma == 1f && !hasCHRM) {
if ((colorType & 2) == 0)
return PdfName.DEVICEGRAY;
else
return PdfName.DEVICERGB;
}
else {
PdfArray array = new PdfArray();
PdfDictionary dic = new PdfDictionary();
if ((colorType & 2) == 0) {
if (gamma == 1f)
return PdfName.DEVICEGRAY;
array.add(PdfName.CALGRAY);
dic.put(PdfName.GAMMA, new PdfNumber(gamma));
dic.put(PdfName.WHITEPOINT, new PdfLiteral("[1 1 1]"));
array.add(dic);
}
else {
PdfObject wp = new PdfLiteral("[1 1 1]");
array.add(PdfName.CALRGB);
if (gamma != 1f) {
PdfArray gm = new PdfArray();
PdfNumber n = new PdfNumber(gamma);
gm.add(n);
gm.add(n);
gm.add(n);
dic.put(PdfName.GAMMA, gm);
}
if (hasCHRM) {
float z = yW*((xG-xB)*yR-(xR-xB)*yG+(xR-xG)*yB);
float YA = yR*((xG-xB)*yW-(xW-xB)*yG+(xW-xG)*yB)/z;
float XA = YA*xR/yR;
float ZA = YA*((1-xR)/yR-1);
float YB = -yG*((xR-xB)*yW-(xW-xB)*yR+(xW-xR)*yB)/z;
float XB = YB*xG/yG;
float ZB = YB*((1-xG)/yG-1);
float YC = yB*((xR-xG)*yW-(xW-xG)*yW+(xW-xR)*yG)/z;
float XC = YC*xB/yB;
float ZC = YC*((1-xB)/yB-1);
float XW = XA+XB+XC;
float YW = 1;//YA+YB+YC;
float ZW = ZA+ZB+ZC;
PdfArray wpa = new PdfArray();
wpa.add(new PdfNumber(XW));
wpa.add(new PdfNumber(YW));
wpa.add(new PdfNumber(ZW));
wp = wpa;
PdfArray matrix = new PdfArray();
matrix.add(new PdfNumber(XA));
matrix.add(new PdfNumber(YA));
matrix.add(new PdfNumber(ZA));
matrix.add(new PdfNumber(XB));
matrix.add(new PdfNumber(YB));
matrix.add(new PdfNumber(ZB));
matrix.add(new PdfNumber(XC));
matrix.add(new PdfNumber(YC));
matrix.add(new PdfNumber(ZC));
dic.put(PdfName.MATRIX, matrix);
}
dic.put(PdfName.WHITEPOINT, wp);
array.add(dic);
}
return array;
}
}
示例3: getInstance
import com.lowagie.text.pdf.PdfNumber; //导入依赖的package包/类
/**
* Reuses an existing image.
* @param ref the reference to the image dictionary
* @throws BadElementException on error
* @return the image
*/
public static Image getInstance(PRIndirectReference ref) throws BadElementException {
PdfDictionary dic = (PdfDictionary)PdfReader.getPdfObjectRelease(ref);
int width = ((PdfNumber)PdfReader.getPdfObjectRelease(dic.get(PdfName.WIDTH))).intValue();
int height = ((PdfNumber)PdfReader.getPdfObjectRelease(dic.get(PdfName.HEIGHT))).intValue();
Image imask = null;
PdfObject obj = dic.get(PdfName.SMASK);
if (obj != null && obj.isIndirect()) {
imask = getInstance((PRIndirectReference)obj);
}
else {
obj = dic.get(PdfName.MASK);
if (obj != null && obj.isIndirect()) {
PdfObject obj2 = PdfReader.getPdfObjectRelease(obj);
if (obj2 instanceof PdfDictionary)
imask = getInstance((PRIndirectReference)obj);
}
}
Image img = new ImgRaw(width, height, 1, 1, null);
img.imageMask = imask;
img.directReference = ref;
return img;
}
示例4: invoke
import com.lowagie.text.pdf.PdfNumber; //导入依赖的package包/类
public void invoke(PdfContentStreamProcessor processor, PdfLiteral operator, ArrayList operands) {
PdfNumber aw = (PdfNumber)operands.get(0);
PdfNumber ac = (PdfNumber)operands.get(1);
PdfString string = (PdfString)operands.get(2);
ArrayList twOperands = new ArrayList(1);
twOperands.add(0, aw);
processor.invokeOperator(new PdfLiteral("Tw"), twOperands);
ArrayList tcOperands = new ArrayList(1);
tcOperands.add(0, ac);
processor.invokeOperator(new PdfLiteral("Tc"), tcOperands);
ArrayList tickOperands = new ArrayList(1);
tickOperands.add(0, string);
processor.invokeOperator(new PdfLiteral("'"), tickOperands);
}
示例5: indexedModel
import com.lowagie.text.pdf.PdfNumber; //导入依赖的package包/类
private Image indexedModel(byte bdata[], int bpc, int paletteEntries) throws BadElementException {
Image img = new ImgRaw(width, height, 1, bpc, bdata);
PdfArray colorspace = new PdfArray();
colorspace.add(PdfName.INDEXED);
colorspace.add(PdfName.DEVICERGB);
byte np[] = getPalette(paletteEntries);
int len = np.length;
colorspace.add(new PdfNumber(len / 3 - 1));
colorspace.add(new PdfString(np));
PdfDictionary ad = new PdfDictionary();
ad.put(PdfName.COLORSPACE, colorspace);
img.setAdditional(ad);
return img;
}
示例6: getValue
import com.lowagie.text.pdf.PdfNumber; //导入依赖的package包/类
/**
* Returns a PdfObject that can be used as the value of a Collection Item.
* @param v value the value that has to be changed into a PdfObject (PdfString, PdfDate or PdfNumber)
*/
public PdfObject getValue(String v) {
switch(fieldType) {
case TEXT:
return new PdfString(v, PdfObject.TEXT_UNICODE);
case DATE:
return new PdfDate(PdfDate.decode(v));
case NUMBER:
return new PdfNumber(v);
}
throw new IllegalArgumentException(v + " is not an acceptable value for the field " + get(PdfName.N).toString());
}
示例7: addItem
import com.lowagie.text.pdf.PdfNumber; //导入依赖的package包/类
/**
* Sets the value of the collection item.
* @param n
*/
public void addItem(String key, PdfNumber n) {
PdfName fieldname = new PdfName(key);
PdfCollectionField field = (PdfCollectionField)schema.get(fieldname);
if (field.fieldType == PdfCollectionField.NUMBER) {
put(fieldname, n);
}
}
示例8: getColorspace
import com.lowagie.text.pdf.PdfNumber; //导入依赖的package包/类
PdfObject getColorspace() {
if (gamma == 1f && !hasCHRM) {
if ((colorType & 2) == 0)
return PdfName.DEVICEGRAY;
else
return PdfName.DEVICERGB;
}
else {
PdfArray array = new PdfArray();
PdfDictionary dic = new PdfDictionary();
if ((colorType & 2) == 0) {
if (gamma == 1f)
return PdfName.DEVICEGRAY;
array.add(PdfName.CALGRAY);
dic.put(PdfName.GAMMA, new PdfNumber(gamma));
dic.put(PdfName.WHITEPOINT, new PdfLiteral("[1 1 1]"));
array.add(dic);
}
else {
PdfObject wp = new PdfLiteral("[1 1 1]");
array.add(PdfName.CALRGB);
if (gamma != 1f) {
PdfArray gm = new PdfArray();
PdfNumber n = new PdfNumber(gamma);
gm.add(n);
gm.add(n);
gm.add(n);
dic.put(PdfName.GAMMA, gm);
}
if (hasCHRM) {
float z = yW*((xG-xB)*yR-(xR-xB)*yG+(xR-xG)*yB);
float YA = yR*((xG-xB)*yW-(xW-xB)*yG+(xW-xG)*yB)/z;
float XA = YA*xR/yR;
float ZA = YA*((1-xR)/yR-1);
float YB = -yG*((xR-xB)*yW-(xW-xB)*yR+(xW-xR)*yB)/z;
float XB = YB*xG/yG;
float ZB = YB*((1-xG)/yG-1);
float YC = yB*((xR-xG)*yW-(xW-xG)*yW+(xW-xR)*yG)/z;
float XC = YC*xB/yB;
float ZC = YC*((1-xB)/yB-1);
float XW = XA+XB+XC;
float YW = 1;//YA+YB+YC;
float ZW = ZA+ZB+ZC;
PdfArray wpa = new PdfArray();
wpa.add(new PdfNumber(XW));
wpa.add(new PdfNumber(YW));
wpa.add(new PdfNumber(ZW));
wp = wpa;
PdfArray matrix = new PdfArray();
matrix.add(new PdfNumber(XA));
matrix.add(new PdfNumber(YA));
matrix.add(new PdfNumber(ZA));
matrix.add(new PdfNumber(XB));
matrix.add(new PdfNumber(YB));
matrix.add(new PdfNumber(ZB));
matrix.add(new PdfNumber(XC));
matrix.add(new PdfNumber(YC));
matrix.add(new PdfNumber(ZC));
dic.put(PdfName.MATRIX, matrix);
}
dic.put(PdfName.WHITEPOINT, wp);
array.add(dic);
}
return array;
}
}