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); }
internal IndirectObject IndirectObject(BaseObject obj) { IndirectObject ind = new IndirectObject(NextAvailableReference(), obj); _objects.Add(ind); return(ind); }
internal IndirectObject StreamObject(BaseStream stream) { StreamObject obj = new StreamObject(stream); IndirectObject reference = IndirectObject(obj); obj.Length = IndirectObject(new IntegerNumberObject()); return(reference); }
public PageCollectionBuilder(Compositor compositor) { _compositor = compositor; _ref = compositor.IndirectObject(_me = compositor.Dictionary("Pages") .Set("Kids", _kids = new ArrayObject()) .Set("Count", _count = new IntegerNumberObject()) ); }
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; }
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())); }
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); }
internal IndirectReferenceObject ReferenceTo(IndirectObject obj) { return(new IndirectReferenceObject(obj.Reference)); }