org.apache.pdfbox.contentstream.operator.Operator类的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(7.5k)|赞(0)|评价(0)|浏览(323)

本文整理了Java中org.apache.pdfbox.contentstream.operator.Operator类的一些代码示例,展示了Operator类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Operator类的具体详情如下:
包路径:org.apache.pdfbox.contentstream.operator.Operator
类名称:Operator

Operator介绍

[英]An Operator in a PDF content stream.
[中]PDF内容流中的运算符。

代码示例

代码示例来源:origin: apache/pdfbox

public MissingOperandException(Operator operator, List<COSBase> operands)
  {
    super("Operator " + operator.getName() + " has too few operands: " + operands);
  }
}

代码示例来源:origin: apache/pdfbox

if (op.getName().equals(END_TEXT_OBJECT)
    || op.getName().equals(RESTORE_GRAPHICS_STATE)
    || op.getName().equals(END_MARKED_CONTENT))
if (op.getName().equals(INLINE_IMAGE_BEGIN))
  COSDictionary dic = op.getImageParameters();
  for (COSName key : dic.keySet())
    docu.insertString(docu.getLength(), "\n", null);
  String imageString = new String(op.getImageData(), Charsets.ISO_8859_1);
  docu.insertString(docu.getLength(), IMAGE_DATA + "\n", INLINE_IMAGE_STYLE);
  docu.insertString(docu.getLength(), imageString, null);
  String operator = ((Operator) obj).getName();
  docu.insertString(docu.getLength(), operator + "\n", OPERATOR_STYLE);
  if (op.getName().equals(BEGIN_TEXT_OBJECT) ||
    op.getName().equals(SAVE_GRAPHICS_STATE) ||
    op.getName().equals(BEGIN_MARKED_CONTENT1) ||
    op.getName().equals(BEGIN_MARKED_CONTENT2))

代码示例来源:origin: apache/pdfbox

retval = Operator.getOperator(nullString);
  retval = Operator.getOperator(next);
  retval = Operator.getOperator(line);
retval = Operator.getOperator(next);
if( next.equals( "BI" ) )
  beginImageOP.setImageParameters( imageParams );
  Object nextToken = null;
  while( (nextToken = parseNextToken()) instanceof COSName )
    if (imageData.getImageData() == null || imageData.getImageData().length == 0)
    beginImageOP.setImageData(imageData.getImageData());
retval = Operator.getOperator("ID");
((Operator)retval).setImageData( imageData.toByteArray() );
break;
  retval = Operator.getOperator(operator);

代码示例来源:origin: apache/pdfbox

@Override
public void process(Operator operator, List<COSBase> operands) throws IOException
{
  if (operator.getImageData() == null || operator.getImageData().length == 0)
  {
    return;
  }
  PDImage image = new PDInlineImage(operator.getImageParameters(),
                   operator.getImageData(),
                   context.getResources());
  context.drawImage(image);
}

代码示例来源:origin: apache/pdfbox

/**
 * Throw a ContentStreamException if the LZW filter is used in a InlinedImage.
 * 
 * @param operator the InlinedImage object (BI to EI)
 * @throws ContentStreamException
 */
protected void validateInlineImageFilter(Operator operator) throws ContentStreamException
{
  COSDictionary dict = operator.getImageParameters();
  /*
   * Search a Filter declaration in the InlinedImage dictionary. The LZWDecode Filter is forbidden.
   */
  COSBase filter = dict.getDictionaryObject(COSName.F, COSName.FILTER);
  FilterHelper
      .isAuthorizedFilter(context, COSUtils.getAsString(filter, this.context.getDocument().getDocument()));
}

代码示例来源:origin: apache/pdfbox

/**
 * This is used to handle an operation.
 * 
 * @param operation The operation to perform.
 * @param arguments The list of arguments.
 * @throws IOException If there is an error processing the operation.
 */
public void processOperator(String operation, List<COSBase> arguments) throws IOException
{
  Operator operator = Operator.getOperator(operation);
  processOperator(operator, arguments);
}

代码示例来源:origin: apache/pdfbox

operation = new Operator( operator );
  operation = operators.putIfAbsent( operator, new Operator( operator ) );
  if ( operation == null )

代码示例来源:origin: org.apache.pdfbox/pdfbox

@Override
public void process(Operator operator, List<COSBase> operands) throws IOException
{
  if (operator.getImageData() == null || operator.getImageData().length == 0)
  {
    return;
  }
  PDImage image = new PDInlineImage(operator.getImageParameters(),
                   operator.getImageData(),
                   context.getResources());
  context.drawImage(image);
}

代码示例来源:origin: apache/pdfbox

COSDictionary dict = operator.getImageParameters();

代码示例来源:origin: org.apache.pdfbox/pdfbox

/**
 * This is used to handle an operation.
 * 
 * @param operation The operation to perform.
 * @param arguments The list of arguments.
 * @throws IOException If there is an error processing the operation.
 */
public void processOperator(String operation, List<COSBase> arguments) throws IOException
{
  Operator operator = Operator.getOperator(operation);
  processOperator(operator, arguments);
}

代码示例来源:origin: org.apache.pdfbox/pdfbox

operation = new Operator( operator );
  operation = operators.putIfAbsent( operator, new Operator( operator ) );
  if ( operation == null )

代码示例来源:origin: apache/pdfbox

@Override
protected void unsupportedOperator(Operator operator, List<COSBase> arguments)
{
  registerError("The operator \"" + operator.getName() + "\" isn't supported.",
      ERROR_SYNTAX_CONTENT_STREAM_UNSUPPORTED_OP);
}

代码示例来源:origin: apache/pdfbox

if( op.getName().equals( "BI" ) )
  COSDictionary dic = op.getImageParameters();
  for( COSName key : dic.keySet() )
  output.write( op.getImageData() );
  output.write( EOL );
  output.write( "EI".getBytes(Charsets.ISO_8859_1) );
  output.write( op.getName().getBytes(Charsets.ISO_8859_1) );
  output.write( EOL );

代码示例来源:origin: com.github.lafa.pdfbox/pdfbox

@Override
public void process(Operator operator, List<COSBase> operands) throws IOException
{
  if (operator.getImageData() == null || operator.getImageData().length == 0)
  {
    return;
  }
  PDImage image = new PDInlineImage(operator.getImageParameters(),
                   operator.getImageData(),
                   context.getResources());
  context.drawImage(image);
}

代码示例来源:origin: org.apache.pdfbox/pdfbox

retval = Operator.getOperator(nullString);
  retval = Operator.getOperator(next);
  retval = Operator.getOperator(line);
retval = Operator.getOperator(next);
if( next.equals( "BI" ) )
  beginImageOP.setImageParameters( imageParams );
  Object nextToken = null;
  while( (nextToken = parseNextToken()) instanceof COSName )
    if (imageData.getImageData() == null || imageData.getImageData().length == 0)
    beginImageOP.setImageData(imageData.getImageData());
retval = Operator.getOperator("ID");
((Operator)retval).setImageData( imageData.toByteArray() );
break;
  retval = Operator.getOperator(operator);

代码示例来源:origin: org.apache.pdfbox/preflight

/**
 * Throw a ContentStreamException if the LZW filter is used in a InlinedImage.
 * 
 * @param operator the InlinedImage object (BI to EI)
 * @throws ContentStreamException
 */
protected void validateInlineImageFilter(Operator operator) throws ContentStreamException
{
  COSDictionary dict = operator.getImageParameters();
  /*
   * Search a Filter declaration in the InlinedImage dictionary. The LZWDecode Filter is forbidden.
   */
  COSBase filter = dict.getDictionaryObject(COSName.F, COSName.FILTER);
  FilterHelper
      .isAuthorizedFilter(context, COSUtils.getAsString(filter, this.context.getDocument().getDocument()));
}

代码示例来源:origin: stackoverflow.com

final String OP_PLUS = "+";
final String OP_MINUS = "-";

List<Operator> listOperator = new List<>(){ new Plus(), new Minus() };

Operator getOperator(String inputOperator) throws NotSupportedException
{
  for(Operator op : listOperator)
    if(op.getOperator().equals(inputOperator))
      return op;
  throw new NotSupportedException();
}

代码示例来源:origin: com.github.lafa.pdfbox/pdfbox

operation = new Operator( operator );
  operation = operators.putIfAbsent( operator, new Operator( operator ) );
  if ( operation == null )

代码示例来源:origin: apache/pdfbox

private float parseWidth(Operator operator, List<COSBase> arguments) throws IOException
  {
    if (operator.getName().equals("d0") || operator.getName().equals("d1"))
    {
      COSBase obj = arguments.get(0);
      if (obj instanceof COSNumber)
      {
        return ((COSNumber) obj).floatValue();
      }
      throw new IOException("Unexpected argument type: " + obj.getClass().getName());
    }
    else
    {
      throw new IOException("First operator must be d0 or d1");
    }
  }
}

代码示例来源:origin: apache/pdfbox

String operation = operator.getName();
  image = new PDInlineImage(operator.getImageParameters(),
               operator.getImageData(),
               getResources());

相关文章