Java Code Examples for org.apache.pdfbox.cos.COSNumber#intValue()

The following examples show how to use org.apache.pdfbox.cos.COSNumber#intValue() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SetTextRenderingMode.java    From gcs with Mozilla Public License 2.0 6 votes vote down vote up
@Override
public void process(Operator operator, List<COSBase> arguments) throws IOException
{
    if (arguments.isEmpty())
    {
        throw new MissingOperandException(operator, arguments);
    }
    COSBase base0 = arguments.get(0);
    if (!(base0 instanceof COSNumber))
    {
        return;
    }
    COSNumber mode = (COSNumber) base0;
    int val = mode.intValue();
    if (val < 0 || val >= RenderingMode.values().length)
    {
        return;
    }
    RenderingMode renderingMode = RenderingMode.fromInt(val);
    context.getGraphicsState().getTextState().setRenderingMode(renderingMode);
}
 
Example 2
Source File: FDFField.java    From gcs with Mozilla Public License 2.0 5 votes vote down vote up
/**
 * This will get the Ff entry of the cos dictionary. If it it not present then this method will return null.
 *
 * @return The field flags.
 */
public Integer getFieldFlags()
{
    Integer retval = null;
    COSNumber ff = (COSNumber) field.getDictionaryObject(COSName.FF);
    if (ff != null)
    {
        retval = ff.intValue();
    }
    return retval;
}
 
Example 3
Source File: FDFField.java    From gcs with Mozilla Public License 2.0 5 votes vote down vote up
/**
 * This will get the SetFf entry of the cos dictionary. If it it not present then this method will return null.
 *
 * @return The field flags.
 */
public Integer getSetFieldFlags()
{
    Integer retval = null;
    COSNumber ff = (COSNumber) field.getDictionaryObject(COSName.SET_FF);
    if (ff != null)
    {
        retval = ff.intValue();
    }
    return retval;
}
 
Example 4
Source File: FDFField.java    From gcs with Mozilla Public License 2.0 5 votes vote down vote up
/**
 * This will get the ClrFf entry of the cos dictionary. If it it not present then this method will return null.
 *
 * @return The field flags.
 */
public Integer getClearFieldFlags()
{
    Integer retval = null;
    COSNumber ff = (COSNumber) field.getDictionaryObject(COSName.CLR_FF);
    if (ff != null)
    {
        retval = ff.intValue();
    }
    return retval;
}
 
Example 5
Source File: FDFField.java    From gcs with Mozilla Public License 2.0 5 votes vote down vote up
/**
 * This will get the F entry of the cos dictionary. If it it not present then this method will return null.
 *
 * @return The widget field flags.
 */
public Integer getWidgetFieldFlags()
{
    Integer retval = null;
    COSNumber f = (COSNumber) field.getDictionaryObject("F");
    if (f != null)
    {
        retval = f.intValue();
    }
    return retval;
}
 
Example 6
Source File: FDFField.java    From gcs with Mozilla Public License 2.0 5 votes vote down vote up
/**
 * This will get the SetF entry of the cos dictionary. If it it not present then this method will return null.
 *
 * @return The field flags.
 */
public Integer getSetWidgetFieldFlags()
{
    Integer retval = null;
    COSNumber ff = (COSNumber) field.getDictionaryObject(COSName.SET_F);
    if (ff != null)
    {
        retval = ff.intValue();
    }
    return retval;
}
 
Example 7
Source File: FDFField.java    From gcs with Mozilla Public License 2.0 5 votes vote down vote up
/**
 * This will get the ClrF entry of the cos dictionary. If it it not present then this method will return null.
 *
 * @return The widget field flags.
 */
public Integer getClearWidgetFieldFlags()
{
    Integer retval = null;
    COSNumber ff = (COSNumber) field.getDictionaryObject(COSName.CLR_F);
    if (ff != null)
    {
        retval = ff.intValue();
    }
    return retval;
}
 
Example 8
Source File: FDFAnnotation.java    From gcs with Mozilla Public License 2.0 5 votes vote down vote up
/**
 * This will get the page number or null if it does not exist.
 *
 * @return The page number.
 */
public Integer getPage()
{
    Integer retval = null;
    COSNumber page = (COSNumber) annot.getDictionaryObject(COSName.PAGE);
    if (page != null)
    {
        retval = page.intValue();
    }
    return retval;
}
 
Example 9
Source File: PDVariableText.java    From gcs with Mozilla Public License 2.0 5 votes vote down vote up
/**
 * This will get the 'quadding' or justification of the text to be displayed.
 * 
 * This is an inheritable attribute.
 * <br>
 * 0 - Left (default)<br>
 * 1 - Centered<br>
 * 2 - Right<br>
 * Please see the QUADDING_CONSTANTS.
 *
 * @return The justification of the text strings.
 */
public int getQ()
{
    int retval = 0;

    COSNumber number = (COSNumber)getInheritableAttribute(COSName.Q);
    
    if (number != null)
    {
        retval = number.intValue();
    }
    return retval;
}
 
Example 10
Source File: NPEfix17_seventeen_s.java    From coming with MIT License 5 votes vote down vote up
/**
 * This will get the 'quadding' or justification of the text to be displayed.
 * 0 - Left(default)<br/>
 * 1 - Centered<br />
 * 2 - Right<br />
 * Please see the QUADDING_CONSTANTS.
 *
 * @return The justification of the text strings.
 */
public int getQ()
{
    int retval = 0;
    COSNumber number = (COSNumber)dictionary.getDictionaryObject(COSName.Q);
    if (number != null)
    {
        retval = number.intValue();
    }
    return retval;
}
 
Example 11
Source File: NPEfix17_seventeen_t.java    From coming with MIT License 5 votes vote down vote up
/**
 * This will get the 'quadding' or justification of the text to be displayed.
 * 0 - Left(default)<br/>
 * 1 - Centered<br />
 * 2 - Right<br />
 * Please see the QUADDING_CONSTANTS.
 *
 * @return The justification of the text strings.
 */
public int getQ()
{
    int retval = 0;
    COSNumber number = (COSNumber)dictionary.getDictionaryObject(COSName.Q);
    if (number != null)
    {
        retval = number.intValue();
    }
    return retval;
}
 
Example 12
Source File: NPEfix18_eigthteen_t.java    From coming with MIT License 5 votes vote down vote up
/**
 * This will get the 'quadding' or justification of the text to be displayed.
 * 0 - Left(default)<br/>
 * 1 - Centered<br />
 * 2 - Right<br />
 * Please see the QUADDING_CONSTANTS.
 *
 * @return The justification of the text strings.
 */
public int getQ()
{
    int retval = 0;
    COSNumber number = (COSNumber)dictionary.getDictionaryObject(COSName.Q);
    if (number != null)
    {
        retval = number.intValue();
    }
    return retval;
}
 
Example 13
Source File: NPEfix18_eigthteen_s.java    From coming with MIT License 5 votes vote down vote up
/**
 * This will get the 'quadding' or justification of the text to be displayed.
 * 0 - Left(default)<br/>
 * 1 - Centered<br />
 * 2 - Right<br />
 * Please see the QUADDING_CONSTANTS.
 *
 * @return The justification of the text strings.
 */
public int getQ()
{
    int retval = 0;
    COSNumber number = (COSNumber)dictionary.getDictionaryObject(COSName.Q);
    if (number != null)
    {
        retval = number.intValue();
    }
    return retval;
}
 
Example 14
Source File: PDAcroForm.java    From gcs with Mozilla Public License 2.0 3 votes vote down vote up
/**
 * This will get the document-wide default value for the quadding/justification of variable text
 * fields. 
 * <p>
 * 0 - Left(default)<br>
 * 1 - Centered<br>
 * 2 - Right<br>
 * See the QUADDING constants of {@link PDVariableText}.
 *
 * @return The justification of the variable text fields.
 */
public int getQ()
{
    int retval = 0;
    COSNumber number = (COSNumber)dictionary.getDictionaryObject(COSName.Q);
    if (number != null)
    {
        retval = number.intValue();
    }
    return retval;
}