Ejemplo n.º 1
0
        /// <summary>
        /// Replaces the token in an internal cache that will be returned instead of
        /// scanning the source PDF data for future requests.
        /// </summary>
        /// <param name="reference">The object number for the object to replace.</param>
        /// <param name="replacer">Func that takes existing token as input and return new token.</param>
        public void ReplaceIndirectObject(IndirectReference reference, Func <IToken, IToken> replacer)
        {
            var obj         = pdfScanner.Get(reference);
            var replacement = replacer(obj.Data);

            pdfScanner.ReplaceToken(reference, replacement);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Retrieve the tokenized object with the specified object reference number.
 /// </summary>
 /// <param name="reference">The object reference number.</param>
 /// <returns>The tokenized PDF object from the file.</returns>
 public ObjectToken GetObject(IndirectReference reference)
 {
     return(TokenScanner.Get(reference));
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Replaces the token in an internal cache that will be returned instead of
 /// scanning the source PDF data for future requests.
 /// </summary>
 /// <param name="reference">The object number for the object to replace.</param>
 /// <param name="replacement">Replacement token to use.</param>
 public void ReplaceIndirectObject(IndirectReference reference, IToken replacement)
 {
     pdfScanner.ReplaceToken(reference, replacement);
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Retrieve the tokenized object with the specified object reference number.
 /// </summary>
 /// <param name="reference">The object reference number.</param>
 /// <returns>The tokenized PDF object from the file.</returns>
 public ObjectToken GetObject(IndirectReference reference)
 {
     return(TokenScanner.Get(reference) ?? throw new InvalidOperationException($"Could not find the object with reference: {reference}."));
 }