Ejemplo n.º 1
0
        // 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();
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
 public void Render(Page page) {
     this.idReferences = page.getIDReferences();
     this.pdfResources = this.pdfDoc.getResources();
     this.pdfDoc.setIDReferences(idReferences);
     this.RenderPage(page);
     this.pdfDoc.output();
 }
Ejemplo n.º 4
0
        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;
        }
Ejemplo n.º 5
0
        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;
        }
Ejemplo n.º 6
0
 /// <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));
     }
 }