Exemplo n.º 1
0
        public void StopRenderer()
        {
            fontSetup.AddToResources(new PdfFontCreator(pdfCreator), pdfCreator.GetResources());
            pdfCreator.OutputTrailer();

            pdfCreator       = 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;
        }
Exemplo n.º 2
0
        /**
         * render page into PDF
         *
         * @param page page to render
         */

        public void RenderPage(Page page)
        {
            BodyAreaContainer body;
            AreaContainer     before, after, start, end;

            currentStream = this.pdfCreator.MakeContentStream();
            body          = page.getBody();
            before        = page.getBefore();
            after         = page.getAfter();
            start         = page.getStart();
            end           = page.getEnd();

            this.currentFontName      = "";
            this.currentFontSize      = 0;
            this.currentLetterSpacing = Single.NaN;

            currentStream.BeginTextObject();

            RenderBodyAreaContainer(body);

            if (before != null)
            {
                RenderAreaContainer(before);
            }

            if (after != null)
            {
                RenderAreaContainer(after);
            }

            if (start != null)
            {
                RenderAreaContainer(start);
            }

            if (end != null)
            {
                RenderAreaContainer(end);
            }
            CloseText();

            // Bug fix for issue 1823
            this.currentLetterSpacing = Single.NaN;

            float w = page.getWidth();
            float h = page.GetHeight();

            currentStream.EndTextObject();

            var idList = new System.Collections.Generic.List <string>();

            foreach (string id in page.getIDList())
            {
                idList.Add(id);
            }

            currentPage = this.pdfCreator.MakePage(
                this.pdfResources, currentStream,
                Convert.ToInt32(Math.Round(w / 1000)),
                Convert.ToInt32(Math.Round(h / 1000)), idList.ToArray());

            if (page.hasLinks() || currentAnnotList != null)
            {
                if (currentAnnotList == null)
                {
                    currentAnnotList = this.pdfCreator.MakeAnnotList();
                }
                currentPage.SetAnnotList(currentAnnotList);

                ArrayList lsets = page.getLinkSets();
                foreach (LinkSet linkSet in lsets)
                {
                    linkSet.align();
                    String    dest     = linkSet.getDest();
                    LinkKind  linkType = linkSet.getLinkType();
                    ArrayList rsets    = linkSet.getRects();
                    foreach (LinkedRectangle lrect in rsets)
                    {
                        currentAnnotList.Add(
                            this.pdfCreator.MakeLink(lrect.getRectangle(),
                                                     dest, linkType).GetReference());
                    }
                }
                currentAnnotList = null;
            }
            else
            {
                // just to be on the safe side
                currentAnnotList = null;
            }

            // ensures that color is properly reset for blocks that carry over pages
            this.currentFill = null;
        }
Exemplo n.º 3
0
 public void SetAnnotList(PdfAnnotList annotList)
 {
     this[PdfName.Names.Annots] = annotList.GetReference();
 }
Exemplo n.º 4
0
 public void SetAnnotList(PdfAnnotList annotList)
 {
     this[PdfName.Names.Annots] = annotList.GetReference();
 }