/**
* Processes PDF syntax.
* <b>Note:</b> If you re-use a given {@link PdfContentStreamProcessor}, you must call {@link PdfContentStreamProcessor#reset()}
* @param contentBytes the bytes of a content stream
* @param resources the resources that come with the content stream
*/
virtual public void ProcessContent(byte[] contentBytes, PdfDictionary resources)
{
this.resources.Push(resources);
PRTokeniser tokeniser = new PRTokeniser(new RandomAccessFileOrArray(new RandomAccessSourceFactory().CreateSource(contentBytes)));
PdfContentParser ps = new PdfContentParser(tokeniser);
List <PdfObject> operands = new List <PdfObject>();
while (ps.Parse(operands).Count > 0)
{
PdfLiteral oper = (PdfLiteral)operands[operands.Count - 1];
if ("BI".Equals(oper.ToString()))
{
// we don't call invokeOperator for embedded images - this is one area of the PDF spec that is particularly nasty and inconsistent
PdfDictionary colorSpaceDic = resources != null?resources.GetAsDict(PdfName.COLORSPACE) : null;
HandleInlineImage(InlineImageUtils.ParseInlineImage(ps, colorSpaceDic), colorSpaceDic);
}
else
{
InvokeOperator(oper, operands);
}
}
this.resources.Pop();
}