示例#1
0
            public ResourceBuilder <T> AddSimpeType1Font(string baseFont, out FontIdentifier identifier)
            {
                string name = "F" + _parent.Compositor.FontID.ToString();

                identifier = new FontIdentifier {
                    Name = name
                };

                IndirectObject reference = _parent.Compositor.IndirectObject(
                    _parent.Compositor.Dictionary("Font")
                    .Set("Subtype", new NameObject("Type1"))
                    .Set("BaseFont", new NameObject(baseFont))
                    );

                if (_fonts == null)
                {
                    _fonts = new DictionaryObject();
                    _me.Set("Font", _fonts);
                }

                _fonts.Set(name, reference);
                _parent.Compositor.FontID += 1;

                return(this);
            }
示例#2
0
        internal IndirectObject IndirectObject(BaseObject obj)
        {
            IndirectObject ind = new IndirectObject(NextAvailableReference(), obj);

            _objects.Add(ind);
            return(ind);
        }
示例#3
0
        internal IndirectObject StreamObject(BaseStream stream)
        {
            StreamObject   obj       = new StreamObject(stream);
            IndirectObject reference = IndirectObject(obj);

            obj.Length = IndirectObject(new IntegerNumberObject());
            return(reference);
        }
示例#4
0
 public PageCollectionBuilder(Compositor compositor)
 {
     _compositor = compositor;
     _ref        = compositor.IndirectObject(_me = compositor.Dictionary("Pages")
                                                   .Set("Kids", _kids   = new ArrayObject())
                                                   .Set("Count", _count = new IntegerNumberObject())
                                             );
 }
示例#5
0
        private Compositor(int generation, int startingID)
        {
            _generation = generation;
            _startID    = _id = startingID;

            _catalogReference = IndirectObject(_catalog = Dictionary("Catalog"));
            _rootCollection   = new PageCollectionBuilder(this);
            _catalog.Set("Pages", _rootCollection.Reference);

            FontID = 1;
        }
示例#6
0
            public PageBuilder(PageCollectionBuilder parent)
            {
                _parent = parent;

                IndirectObject pageRef = _parent.Compositor.IndirectObject(
                    _dictionary = parent.Compositor.Dictionary("Page")
                                  .Set("Parent", parent.Reference)
                    );

                parent.Kids.Add(pageRef);

                _dictionary.Set("Contents", parent.Compositor.StreamObject(_stream = new TextCommandStream()));
            }
示例#7
0
        private bool WriteObject(IndirectObject obj)
        {
            if (obj == null)
            {
                return(false);
            }

            WriteIndent()
            .Write(obj.Reference.Id.ToString())
            .Write(" ")
            .Write(obj.Reference.Generation.ToString())
            .WriteLine(" obj").Indent();
            WriteIndent().WriteObject(obj.Value);
            WriteLine().Outdent().WriteIndent().WriteLine("endobj");

            return(true);
        }
示例#8
0
 internal IndirectReferenceObject ReferenceTo(IndirectObject obj)
 {
     return(new IndirectReferenceObject(obj.Reference));
 }