public RegisterContentOperator ( String operatorString, IContentOperator oper ) : IContentOperator | ||
operatorString | String | |
oper | IContentOperator | |
return | IContentOperator |
public static void PopulateOperators(PdfContentStreamProcessor contentProcessor, PdfCleanUpRenderListener pdfCleanUpRenderListener) { foreach (String oper in contentProcessor.RegisteredOperatorStrings) { PdfCleanUpContentOperator contentOperator = new PdfCleanUpContentOperator(pdfCleanUpRenderListener); contentOperator.originalContentOperator = contentProcessor.RegisterContentOperator(oper, contentOperator); } }
/** * Processes content from the specified page number using the specified listener. * Also allows registration of custom ContentOperators * @param <E> the type of the renderListener - this makes it easy to chain calls * @param pageNumber the page number to process * @param renderListener the listener that will receive render callbacks * @param additionalContentOperators an optional dictionary of custom IContentOperators for rendering instructions * @return the provided renderListener * @throws IOException if operations on the reader fail */ public virtual E ProcessContent <E>(int pageNumber, E renderListener, IDictionary <string, IContentOperator> additionalContentOperators) where E : IRenderListener { PdfDictionary pageDic = reader.GetPageN(pageNumber); PdfDictionary resourcesDic = pageDic.GetAsDict(PdfName.RESOURCES); PdfContentStreamProcessor processor = new PdfContentStreamProcessor(renderListener); foreach (KeyValuePair <string, IContentOperator> entry in additionalContentOperators) { processor.RegisterContentOperator(entry.Key, entry.Value); } processor.ProcessContent(ContentByteUtils.GetContentBytesForPage(reader, pageNumber), resourcesDic); return(renderListener); }