/** * Creates new PdfTemplate * * @param wr the <CODE>PdfWriter</CODE> */ internal PdfTemplate(PdfWriter wr) : base(wr) { type = TYPE_TEMPLATE; pageResources = new PageResources(); pageResources.AddDefaultColor(wr.DefaultColorspace); thisReference = writer.PdfIndirectReference; }
/** * Set the font and the size for the subsequent text writing. * * @param bf the font * @param size the font size in points */ public override void SetFontAndSize(BaseFont bf, float size) { CheckWriter(); state.size = size; if (bf.FontType == BaseFont.FONT_TYPE_DOCUMENT) { state.fontDetails = new FontDetails(null, ((DocumentFont)bf).IndirectReference, bf); } else { state.fontDetails = writer.AddSimple(bf); } PdfName psn = (PdfName)stdFieldFontNames[bf.PostscriptFontName]; if (psn == null) { if (bf.Subset && bf.FontType == BaseFont.FONT_TYPE_TTUNI) { psn = state.fontDetails.FontName; } else { psn = new PdfName(bf.PostscriptFontName); state.fontDetails.Subset = false; } } PageResources prs = PageResources; prs.AddFont(psn, state.fontDetails.IndirectReference); content.Append(psn.GetBytes()).Append(' ').Append(size).Append(" Tf").Append_i(separator); }
/** * Adds a blank page. * @param rect The page dimension * @param rotation The rotation angle in degrees * @since 2.1.5 */ public void AddPage(Rectangle rect, int rotation) { PdfRectangle mediabox = new PdfRectangle(rect, rotation); PageResources resources = new PageResources(); PdfPage page = new PdfPage(mediabox, new Hashtable(), resources.Resources, 0); page.Put(PdfName.TABS, Tabs); root.AddPage(page); ++currentPageNumber; }
internal Type3Glyph(PdfWriter writer, PageResources pageResources, float wx, float llx, float lly, float urx, float ury, bool colorized) : base(writer) { this.pageResources = pageResources; this.colorized = colorized; if (colorized) { content.Append(wx).Append(" 0 d0\n"); } else { content.Append(wx).Append(" 0 ").Append(llx).Append(' ').Append(lly).Append(' ').Append(urx).Append(' ').Append(ury).Append(" d1\n"); } }
public PdfContentByte GetOverContent() { if (over == null) { if (pageResources == null) { pageResources = new PageResources(); PdfDictionary resources = pageN.GetAsDict(PdfName.RESOURCES); pageResources.SetOriginalResources(resources, cstp.namePtr); } over = new PdfCopy.StampContent(cstp, pageResources); } return(over); }
/** Creates a new instance of StampContent */ internal StampContent(PdfWriter writer, PageResources pageResources) : base(writer) { this.pageResources = pageResources; }
public PdfContentByte GetUnderContent() { if (under == null) { if (pageResources == null) { pageResources = new PageResources(); PdfDictionary resources = pageN.GetAsDict(PdfName.RESOURCES); pageResources.SetOriginalResources(resources, cstp.namePtr); } under = new PdfCopy.StampContent(cstp, pageResources); } return under; }
internal PageStamp(PdfStamperImp stamper, PdfReader reader, PdfDictionary pageN) { this.pageN = pageN; pageResources = new PageResources(); PdfDictionary resources = pageN.GetAsDict(PdfName.RESOURCES); pageResources.SetOriginalResources(resources, stamper.namePtr); }
/** Creates a new instance of StampContent */ internal StampContent(PdfStamperImp stamper, PdfStamperImp.PageStamp ps) : base(stamper) { this.ps = ps; pageResources = ps.pageResources; }
/** * Initializes a page. * <P> * If the footer/header is set, it is printed. * @throws DocumentException on error */ protected internal void InitPage() { // the pagenumber is incremented pageN++; // initialisation of some page objects annotationsImp.ResetAnnotations(); pageResources = new PageResources(); writer.ResetContent(); graphics = new PdfContentByte(writer); text = new PdfContentByte(writer); text.Reset(); text.BeginText(); textEmptySize = text.Size; markPoint = 0; SetNewPageSizeAndMargins(); imageEnd = -1; indentation.imageIndentRight = 0; indentation.imageIndentLeft = 0; indentation.indentBottom = 0; indentation.indentTop = 0; currentHeight = 0; // backgroundcolors, etc... thisBoxSize = new Hashtable(boxSize); if (pageSize.BackgroundColor != null || pageSize.HasBorders() || pageSize.BorderColor != null) { Add(pageSize); } float oldleading = leading; int oldAlignment = alignment; // if there is a footer, the footer is added DoFooter(); // we move to the left/top position of the page text.MoveText(Left, Top); DoHeader(); pageEmpty = true; // if there is an image waiting to be drawn, draw it if (imageWait != null) { Add(imageWait); imageWait = null; } leading = oldleading; alignment = oldAlignment; CarriageReturn(); IPdfPageEvent pageEvent = writer.PageEvent; if (pageEvent != null) { if (firstPageEvent) { pageEvent.OnOpenDocument(writer, this); } pageEvent.OnStartPage(writer, this); } firstPageEvent = false; }