Esempio n. 1
0
 public PdfObject Visit(
     PdfDataObject obj,
     object data
     )
 {
     return(obj.Accept(this, data));
 }
        /**
         * <param name="file">Associated file.</param>
         * <param name="dataObject">
         *  <para>Data object associated to the indirect object. It MUST be</para>
         *  <list type="bullet">
         *    <item><code>null</code>, if the indirect object is original or free.</item>
         *    <item>NOT <code>null</code>, if the indirect object is new and in-use.</item>
         *  </list>
         * </param>
         * <param name="xrefEntry">Cross-reference entry associated to the indirect object. If the
         *  indirect object is new, its offset field MUST be set to 0.</param>
         */
        internal PdfIndirectObject(File file, PdfDataObject dataObject, XRefEntry xrefEntry)
        {
            this.file       = file;
            this.dataObject = Include(dataObject);
            this.xrefEntry  = xrefEntry;

            this.original  = (xrefEntry.Offset >= 0);
            this.reference = new PdfReference(this);
        }
Esempio n. 3
0
        public virtual PdfObject Visit(PdfIndirectObject obj, object data)
        {
            PdfDataObject dataObject = obj.DataObject;

            if (dataObject != null)
            {
                dataObject.Accept(this, data);
            }
            return(obj);
        }
Esempio n. 4
0
 public static PdfDictionary TryGetDictionary(PdfDataObject baseDataObject)
 {
     if (baseDataObject is PdfDictionary dictionary)
     {
         return(dictionary);
     }
     else if (baseDataObject is PdfStream stream)
     {
         return(stream.Header);
     }
     else
     {
         return(null);
     }
 }
Esempio n. 5
0
 public override bool Matches(Cloner cloner, PdfObject source)
 {
     if (source is PdfArray)
     {
         PdfArray array = (PdfArray)source;
         if (array.Count > 0)
         {
             PdfDataObject arrayItem = array.Resolve(0);
             if (arrayItem is PdfDictionary arrayItemDictionary)
             {
                 return(arrayItemDictionary.ContainsKey(PdfName.Subtype) &&
                        arrayItemDictionary.ContainsKey(PdfName.Rect));
             }
         }
     }
     return(false);
 }
Esempio n. 6
0
 /**
  * <summary>Ensures a data object to be unresolved into its corresponding indirect reference, if
  * available.</summary>
  * <param name="object">Object to unresolve.</param>
  * <returns><see cref="PdfReference"/>, if available; <code>object</code>, otherwise.</returns>
  */
 public static PdfDirectObject Unresolve(PdfDataObject @object)
 {
     return(@object?.Unresolve());
 }