// Links wiating for internal document references //private ArrayList pendingLinks; public PdfCreator(Stream stream) { // Create the underlying PDF document. doc = new PdfDocument(stream); doc.Version = PdfVersion.V13; resources = new PdfResources(doc.NextObjectId()); addTrailerObject(resources); this.xrefTable = new XRefTable(); }
public PdfPage MakePage(PdfResources resources, PdfContentStream contents, int pagewidth, int pageheight, string[] currentPageIdList) { PdfPage page = new PdfPage( resources, contents, pagewidth, pageheight, doc.NextObjectId()); if (currentPageIdList != null) { foreach (string id in currentPageIdList) { idReferences.setInternalGoToPageReference(id, page.GetReference()); } } /* add it to the list of objects */ this.objects.Add(page); page.SetParent(doc.Pages); doc.Pages.Kids.Add(page.GetReference()); return(page); }
public void Render(Page page) { this.idReferences = page.getIDReferences(); this.pdfResources = this.pdfDoc.getResources(); this.pdfDoc.setIDReferences(idReferences); this.RenderPage(page); this.pdfDoc.output(); }
public void StopRenderer() { fontSetup.AddToResources(new PdfFontCreator(pdfDoc), pdfDoc.getResources()); pdfDoc.outputTrailer(); pdfDoc = null; pdfResources = null; currentStream = null; currentAnnotList = null; currentPage = null; idReferences = null; currentFontName = String.Empty; currentFill = null; prevUnderlineColor = null; prevOverlineColor = null; prevLineThroughColor = null; fontSetup = null; fontInfo = null; }
public PdfPage makePage(PdfResources resources, PdfContentStream contents, int pagewidth, int pageheight, Page currentPage) { PdfPage page = new PdfPage( resources, contents, pagewidth, pageheight, doc.NextObjectId()); if (currentPage != null) { foreach (string id in currentPage.getIDList()) { idReferences.setInternalGoToPageReference(id, page.GetReference()); } } /* add it to the list of objects */ this.objects.Add(page); page.SetParent(doc.Pages); doc.Pages.Kids.Add(page.GetReference()); return page; }
/// <summary> /// Add the fonts in the font info to the PDF document. /// </summary> /// <param name="fontCreator">Object that creates PdfFont objects.</param> /// <param name="resources">Resources object to add fonts too.</param> internal void AddToResources(PdfFontCreator fontCreator, PdfResources resources) { Hashtable fonts = fontInfo.GetUsedFonts(); foreach (string fontName in fonts.Keys) { Font font = (Font) fonts[fontName]; resources.AddFont(fontCreator.MakeFont(fontName, font)); } }