Refine search
/** * Set the RGB text color for this node. * * @param textColor The text color for this node. */ public void setTextColor( Color textColor ) { COSArray array = new COSArray(); array.add( new COSFloat( textColor.getRed()/255f)); array.add( new COSFloat( textColor.getGreen()/255f)); array.add( new COSFloat( textColor.getBlue()/255f)); getCOSObject().setItem( COSName.C, array ); }
/** * Constructor. * * @param aFloat The primitive float object that this object wraps. */ public COSFloat( float aFloat ) { // use a BigDecimal as intermediate state to avoid // a floating point string representation of the float value value = new BigDecimal(String.valueOf(aFloat)); valueAsString = removeNullDigits(value.toPlainString()); }
/** * This will set the vertical offset of the caption. * * @param offset vertical offset of the caption */ public final void setCaptionVerticalOffset(float offset) { COSArray array = (COSArray) annot.getDictionaryObject(COSName.CO); if (array == null) { array = new COSArray(); array.setFloatArray(new float[] { 0.f, offset }); annot.setItem(COSName.CO, array); } else { array.set(1, new COSFloat(offset)); } }
((COSFloat)o).writePDF( output ); output.write( SPACE ); for( int i=0; i<array.size(); i++ ) writeObject( array.get( i ) ); output.write( SPACE ); for (Map.Entry<COSName, COSBase> entry : obj.entrySet()) for( COSName key : dic.keySet() ) Object value = dic.getDictionaryObject( key ); key.writePDF( output ); output.write( SPACE );
/** * Get the RGB text color of this node. Default is black and this method * will never return null. * * @return The structure element of this node. */ public PDColor getTextColor() { COSArray csValues = (COSArray) getCOSObject().getDictionaryObject(COSName.C); if( csValues == null ) { csValues = new COSArray(); csValues.growToSize( 3, new COSFloat( 0 ) ); getCOSObject().setItem( COSName.C, csValues ); } return new PDColor(csValues, PDDeviceRGB.INSTANCE); }
if (getCOSObject().getDictionaryObject(COSName.C0) instanceof COSArray) c0 = (COSArray) getCOSObject().getDictionaryObject(COSName.C0); c0 = new COSArray(); if (c0.size() == 0) c0.add(new COSFloat(0)); if (getCOSObject().getDictionaryObject(COSName.C1) instanceof COSArray) c1 = (COSArray) getCOSObject().getDictionaryObject(COSName.C1); if (c1.size() == 0) c1.add(new COSFloat(1));
for( COSName key : map.keySet() ) COSBase cosObj = map.getDictionaryObject( key ); Object actualObject = null; if( cosObj instanceof COSString ) actualObject = ((COSFloat)cosObj).floatValue();
private void setComponentRangeArray(PDRange range, int index) { COSArray rangeArray = (COSArray) dictionary.getDictionaryObject(COSName.RANGE); if (rangeArray == null) { rangeArray = getDefaultRangeArray(); } if (range == null) { // reset to defaults rangeArray.set(index, new COSFloat(-100)); rangeArray.set(index + 1, new COSFloat(100)); } else { rangeArray.set(index, new COSFloat(range.getMin())); rangeArray.set(index + 1, new COSFloat(range.getMax())); } dictionary.setItem(COSName.RANGE, rangeArray); initialColor = null; }
String str = null; for(int j=1, k=0; j<=(quadsArray.size()/8); j++) { COSFloat ULX = (COSFloat) quadsArray.get(0+k); COSFloat ULY = (COSFloat) quadsArray.get(1+k); COSFloat URX = (COSFloat) quadsArray.get(2+k); COSFloat URY = (COSFloat) quadsArray.get(3+k); float ulx = ULX.floatValue() - 1; // upper left x. float uly = ULY.floatValue(); // upper left y. float width = URX.floatValue() - LLX.floatValue(); // calculated by upperRightX - lowerLeftX. float height = URY.floatValue() - LLY.floatValue(); // calculated by upperRightY - lowerLeftY.
/** * Constructor. * * @param array An array of numbers as specified in the PDF Reference for a rectangle type. */ public PDRectangle( COSArray array ) { float[] values = Arrays.copyOf(array.toFloatArray(), 4); rectArray = new COSArray(); // we have to start with the lower left corner rectArray.add( new COSFloat( Math.min(values[0],values[2] )) ); rectArray.add( new COSFloat( Math.min(values[1],values[3] )) ); rectArray.add( new COSFloat( Math.max(values[0],values[2] )) ); rectArray.add( new COSFloat( Math.max(values[1],values[3] )) ); }
result = "" + ((COSFloat) nodeValue).floatValue(); if (COSName.XREF.equals(dict.getCOSName(COSName.TYPE))) result = "(" + dict.size() + ")"; result = "(" + array.size() + ")";
/** * This will set a float object. * * @param key The key to the data that we are setting. * @param value The value that we are setting. */ private void setFloatItem( COSName key, Float value ) { if( value == null ) { dict.removeItem(key); } else { dict.setItem(key, new COSFloat(value)); } }
if (obj instanceof COSFloat) str = Float.toString(((COSFloat) obj).floatValue()); for (Map.Entry<COSName, COSBase> entry : dict.entrySet())
@Override public void process(Operator operator, List<COSBase> arguments) throws IOException { //move to start of next text line List<COSBase> args = new ArrayList<>(); args.add(new COSFloat(0f)); // this must be -leading instead of just leading as written in the // specification (p.369) the acrobat reader seems to implement it the same way args.add(new COSFloat(-1 * context.getGraphicsState().getTextState().getLeading())); // use Td instead of repeating code context.processOperator("Td", args); }
data = "" + ((COSFloat)selectedNode).floatValue();