Ejemplo n.º 1
0
        internal PdfWriterReference      AddObj(PdfValue obj)
        {
            if (!_referenceTable.TryGetValue(obj, out var reference))
            {
                obj.pdfAddToDocument(this);

                reference = new PdfWriterReference(_xrefTable.Count);
                _xrefTable.Add(reference);
                _referenceTable.Add(obj, reference);

                if (obj is PdfPage)
                {
                    _pages.Add((PdfPage)obj);
                }

                if (obj.hasStream)
                {
                    reference.Position = _writer.PdfPosition;
                    _writer.WriteObj(this, reference, obj);
                }
                else
                {
                    _objToWrite.Add(obj);
                }
            }

            return(reference);
        }