Inheritance: DocWriter, IPdfViewerPreferences, IPdfEncryptionSettings, IPdfVersion, IPdfDocumentActions, IPdfPageActions, IPdfIsoConformance, IPdfRunDirection, IPdfAnnotations
        protected virtual void WriteTOC(List<PdfContentParameter> contents, PdfWriter writer, Document document)
        {
            document.NewPage();
            PdfPTable t = new PdfPTable(2);
            t.WidthPercentage = 100;
            t.SetWidths(new float[] { 98f, 2f });
            t.TotalWidth = document.PageSize.Width - (document.LeftMargin + document.RightMargin);
            t.AddCell(new PdfPCell(
                new Phrase(GlobalStringResource.TableOfContents,
                    FontFactory.GetFont(FontFactory.HELVETICA_BOLD, 16))
                ) { Colspan = 2, Border = Rectangle.NO_BORDER, PaddingBottom = 25 });

            foreach (PdfContentParameter item in contents)
            {
                if (!string.IsNullOrEmpty(item.Header))
                {
                    t.AddCell(
                        new PdfPCell(
                                new Phrase(item.Header,
                                    FontFactory.GetFont(FontFactory.HELVETICA_BOLD, 8)
                                    )
                            ) { Border = Rectangle.NO_BORDER, NoWrap = false, FixedHeight = 15, }
                        );

                    PdfPCell templateCell = new PdfPCell(Image.GetInstance(item.Template));
                    templateCell.HorizontalAlignment = Element.ALIGN_RIGHT;
                    templateCell.Border = Rectangle.NO_BORDER;
                    t.AddCell(templateCell);
                }
            }
            float docHeight = document.PageSize.Height - heightOffset;
            document.Add(t);
        }
Exemple #2
1
 protected internal virtual PdfObject GetSpotObject(PdfWriter writer) {
     PdfArray array = new PdfArray(PdfName.SEPARATION);
     array.Add(name);
     PdfFunction func = null;
     if (altcs is ExtendedColor) {
         int type = ((ExtendedColor)altcs).Type;
         switch (type) {
             case ExtendedColor.TYPE_GRAY:
                 array.Add(PdfName.DEVICEGRAY);
                 func = PdfFunction.Type2(writer, new float[]{0, 1}, null, new float[]{0}, new float[]{((GrayColor)altcs).Gray}, 1);
                 break;
             case ExtendedColor.TYPE_CMYK:
                 array.Add(PdfName.DEVICECMYK);
                 CMYKColor cmyk = (CMYKColor)altcs;
                 func = PdfFunction.Type2(writer, new float[]{0, 1}, null, new float[]{0, 0, 0, 0},
                     new float[]{cmyk.Cyan, cmyk.Magenta, cmyk.Yellow, cmyk.Black}, 1);
                 break;
             default:
                 throw new Exception(MessageLocalization.GetComposedMessage("only.rgb.gray.and.cmyk.are.supported.as.alternative.color.spaces"));
         }
     }
     else {
         array.Add(PdfName.DEVICERGB);
         func = PdfFunction.Type2(writer, new float[]{0, 1}, null, new float[]{1, 1, 1},
             new float[]{(float)altcs.R / 255, (float)altcs.G / 255, (float)altcs.B / 255}, 1);
     }
     array.Add(func.Reference);
     return array;
 }
 // we override the onOpenDocument method
 public override void OnOpenDocument(PdfWriter writer, Document document)
 {
     _bf = _normalFont.GetCalculatedBaseFont(false);
     _cb = writer.DirectContent;
     _ct = new ColumnText(_cb);
     base.OnOpenDocument(writer, document);
 }
Exemple #4
0
 /**
 * Creates a title layer. A title layer is not really a layer but a collection of layers
 * under the same title heading.
 * @param title the title text
 * @param writer the <CODE>PdfWriter</CODE>
 * @return the title layer
 */    
 public static PdfLayer CreateTitle(String title, PdfWriter writer) {
     if (title == null)
         throw new ArgumentNullException("Title cannot be null.");
     PdfLayer layer = new PdfLayer(title);
     writer.RegisterLayer(layer);
     return layer;
 }
 public override void OnOpenDocument(PdfWriter writer, Document document)
 {
     base.OnOpenDocument(writer, document);
     font = BaseFont.CreateFont(BaseFont.HELVETICA, BaseFont.CP1252, BaseFont.NOT_EMBEDDED);
     dc = writer.DirectContent;
     tpl = dc.CreateTemplate(50, 50);
 }
Exemple #6
0
 /**
 * Creates a title layer. A title layer is not really a layer but a collection of layers
 * under the same title heading.
 * @param title the title text
 * @param writer the <CODE>PdfWriter</CODE>
 * @return the title layer
 */    
 public static PdfLayer CreateTitle(String title, PdfWriter writer) {
     if (title == null)
         throw new ArgumentNullException(MessageLocalization.GetComposedMessage("title.cannot.be.null"));
     PdfLayer layer = new PdfLayer(title);
     writer.RegisterLayer(layer);
     return layer;
 }
Exemple #7
0
 /**
  *
  * @param writer
  * @param key
  * @param obj1
  */
 static public void CheckPdfAConformance(PdfWriter writer, int key, Object obj1) {
     if (writer == null || !writer.IsPdfIso())
         return;
     switch (key) {
         case PdfIsoKeys.PDFISOKEY_FONT:
             if (!((BaseFont)obj1).IsEmbedded())
                 throw new PdfAConformanceException(MessageLocalization.GetComposedMessage("all.the.fonts.must.be.embedded.this.one.isn.t.1", ((BaseFont) obj1).PostscriptFontName));
             break;
         case PdfIsoKeys.PDFISOKEY_IMAGE:
             PdfImage image = (PdfImage)obj1;
             if (image.Get(PdfName.SMASK) != null)
                 throw new PdfAConformanceException(MessageLocalization.GetComposedMessage("the.smask.key.is.not.allowed.in.images"));
             break;
         case PdfIsoKeys.PDFISOKEY_GSTATE:
             PdfDictionary gs = (PdfDictionary)obj1;
             PdfObject obj = gs.Get(PdfName.BM);
             if (obj != null && !PdfGState.BM_NORMAL.Equals(obj) && !PdfGState.BM_COMPATIBLE.Equals(obj))
                 throw new PdfAConformanceException(MessageLocalization.GetComposedMessage("blend.mode.1.not.allowed", obj.ToString()));
             obj = gs.Get(PdfName.CA);
             double v = 0.0;
             if (obj != null && (v = ((PdfNumber)obj).DoubleValue) != 1.0)
                 throw new PdfAConformanceException(MessageLocalization.GetComposedMessage("transparency.is.not.allowed.ca.eq.1", v));
             obj = gs.Get(PdfName.ca_);
             v = 0.0;
             if (obj != null && (v = ((PdfNumber)obj).DoubleValue) != 1.0)
                 throw new PdfAConformanceException(MessageLocalization.GetComposedMessage("transparency.is.not.allowed.ca.eq.1", v));
             break;
         case PdfIsoKeys.PDFISOKEY_LAYER:
             throw new PdfAConformanceException(MessageLocalization.GetComposedMessage("layers.are.not.allowed"));
         default:
             break;
     }
 }
 public virtual ColorDetails[] GetColorantDetails(PdfWriter writer) {
     if (altColorDetails == null && this.altcs is ExtendedColor &&
         ((ExtendedColor) this.altcs).Type == ExtendedColor.TYPE_LAB) {
         altColorDetails = writer.AddSimple(((LabColor) altcs).LabColorSpace);
     }
     return new ColorDetails[] {altColorDetails};
 }
 /**
  * Adds the header and the footer.
  * @see com.itextpdf.text.pdf.PdfPageEventHelper#onEndPage(
  *      com.itextpdf.text.pdf.PdfWriter, com.itextpdf.text.Document)
  */
 public override void OnEndPage(PdfWriter writer, Document document)
 {
     Rectangle rect = writer.GetBoxSize("art");
     switch (writer.PageNumber % 2)
     {
         case 0:
             ColumnText.ShowTextAligned(writer.DirectContent,
               Element.ALIGN_RIGHT,
               header[0],
               rect.Right, rect.Top, 0
             );
             break;
         case 1:
             ColumnText.ShowTextAligned(
               writer.DirectContent,
               Element.ALIGN_LEFT,
               header[1],
               rect.Left, rect.Top, 0
             );
             break;
     }
     ColumnText.ShowTextAligned(
       writer.DirectContent,
       Element.ALIGN_CENTER,
       new Phrase(String.Format("page {0}", pagenumber)),
       (rect.Left + rect.Right) / 2,
       rect.Bottom - 18, 0
     );
 }
Exemple #10
0
 internal PdfPatternPainter(PdfWriter wr, BaseColor defaultColor) : this(wr) {
     stencil = true;
     if (defaultColor == null)
         this.defaultColor = BaseColor.GRAY;
     else
         this.defaultColor = defaultColor;
 }
Exemple #11
0
        public override void OnEndPage(PdfWriter writer, Document document)
        {
            if (writer == null) throw new ArgumentNullException("writer");
            if (document == null) throw new ArgumentNullException("document");

            ColumnText.ShowTextAligned(writer.DirectContent, Element.ALIGN_CENTER, new Phrase(this.config.Header1, new Font(Font.FontFamily.HELVETICA, 14, Font.BOLD)), document.PageSize.Width / 2, document.PageSize.Height - 36, 0);
            ColumnText.ShowTextAligned(writer.DirectContent, Element.ALIGN_CENTER, new Phrase(this.config.Header2, new Font(Font.FontFamily.HELVETICA, 14, Font.NORMAL, BaseColor.GRAY)), document.PageSize.Width / 2, document.PageSize.Height - 56, 0);

            writer.DirectContent.SetLineWidth(1);
            writer.DirectContent.SetColorFill(BaseColor.BLACK);
            writer.DirectContent.SetColorStroke(BaseColor.BLACK);
            writer.DirectContent.MoveTo(document.LeftMargin, document.PageSize.Height - document.TopMargin + 15);
            writer.DirectContent.LineTo(document.PageSize.Width - document.RightMargin, document.PageSize.Height - document.TopMargin + 15);
            writer.DirectContent.Stroke();

            writer.DirectContent.MoveTo(document.LeftMargin, document.BottomMargin - 15);
            writer.DirectContent.LineTo(document.PageSize.Width - document.RightMargin, document.BottomMargin - 15);
            writer.DirectContent.Stroke();

            // footer left 1
            ColumnText.ShowTextAligned(writer.DirectContent, Element.ALIGN_LEFT, new Phrase(this.config.FooterLeft1, new Font(Font.FontFamily.HELVETICA, 10, Font.BOLD)), document.LeftMargin, document.BottomMargin - 30, 0);

            // footer left 2
            ColumnText.ShowTextAligned(writer.DirectContent, Element.ALIGN_LEFT, new Phrase(this.config.FooterLeft2, new Font(Font.FontFamily.HELVETICA, 10, Font.BOLD)), document.LeftMargin, document.BottomMargin - 42, 0);

            // footer right 1
            ColumnText.ShowTextAligned(writer.DirectContent, Element.ALIGN_RIGHT, new Phrase(this.config.FooterRight1, new Font(Font.FontFamily.HELVETICA, 10, Font.BOLD)), document.PageSize.Width - document.RightMargin, document.BottomMargin - 30, 0);

            // footer right 2
            ColumnText.ShowTextAligned(writer.DirectContent, Element.ALIGN_RIGHT, new Phrase(this.config.FooterRight2, new Font(Font.FontFamily.HELVETICA, 10, Font.BOLD)), document.PageSize.Width - document.RightMargin, document.BottomMargin - 42, 0);

            base.OnEndPage(writer, document);
        }
        public override void OnOpenDocument(PdfWriter writer, Document document)
        {
            total = writer.DirectContent.CreateTemplate(100, 100);
            total.BoundingBox = new Rectangle(-20, -20, 100, 100);

            helv = BaseFont.CreateFont(BaseFont.HELVETICA, BaseFont.WINANSI, BaseFont.NOT_EMBEDDED);
        }
        public override void OnEndPage(PdfWriter writer, Document document)
        {
            base.OnEndPage(writer, document);
            Rectangle pageSize = document.PageSize;

            int pageN = writer.PageNumber;
            String text = "Page " + pageN + "/";
            float len = bf.GetWidthPoint(text, 8);

            cb.SetRGBColorFill(0, 0, 0);

            // Line separated fotter from rest of sheet
            cb.MoveTo(50, pageSize.Bottom + 60);
            cb.LineTo(pageSize.Right - 50, pageSize.Bottom + 60);
            cb.SetLineWidth(0.75f);
            cb.Fill();
            cb.Stroke();

            cb.BeginText();
            cb.SetFontAndSize(gf, 8);
            cb.SetTextMatrix(pageSize.GetLeft(((pageSize.Width - 80) / 2) + len), pageSize.GetBottom(50));
            cb.ShowText(text);
            cb.EndText();

            cb.AddTemplate(template, pageSize.GetLeft(((pageSize.Width - 80) / 2) + len + len - 2), pageSize.GetBottom(50));

            cb.BeginText();
            cb.SetFontAndSize(gf, 8);
            cb.ShowTextAligned(PdfContentByte.ALIGN_RIGHT, "generated on Ticketing System", pageSize.GetRight(50), pageSize.GetBottom(50), 0);
            cb.EndText();
        }
 public override void OnEndPage(PdfWriter writer, Document document)
 {
     PdfContentByte cb = writer.DirectContent;
     cb.SaveState();
     string text = "Page " + writer.PageNumber + " of ";
     float textBase = document.Bottom - 20;
     float textSize = 12; //helv.GetWidthPoint(text, 12);
     cb.BeginText();
     cb.SetFontAndSize(helv, 12);
     if ((writer.PageNumber % 2) == 1)
     {
         cb.SetTextMatrix(document.Left, textBase);
         cb.ShowText(text);
         cb.EndText();
         cb.AddTemplate(total, document.Left + textSize, textBase);
     }
     else
     {
         float adjust = helv.GetWidthPoint("0", 12);
         cb.SetTextMatrix(document.Right - textSize - adjust, textBase);
         cb.ShowText(text);
         cb.EndText();
         cb.AddTemplate(total, document.Right - adjust, textBase);
     }
     cb.RestoreState();
 }
 public override void Close(PdfWriter writer) {
     base.Close(writer);
     bool ok = false;
     IXmpMeta xmpMeta = writer.XmpWriter.XmpMeta;
     try {
         String docFileName = xmpMeta.GetPropertyString(PdfAXmpWriter.zugferdSchemaNS,
             PdfAXmpWriter.zugferdDocumentFileName);
         foreach (PdfFileSpecification attachment in attachments) {
             if (docFileName.Equals(attachment.GetAsString(PdfName.UF).ToString())) {
                 PdfName relationship = attachment.GetAsName(PdfName.AFRELATIONSHIP);
                 if (!AFRelationshipValue.Alternative.Equals(relationship)) {
                     attachments.Clear();
                     throw new PdfAConformanceException(attachment,
                         MessageLocalization.GetComposedMessage("afrelationship.value.shall.be.alternative"));
                 }
                 ok = true;
                 break;
             }
         }
     } catch (Exception e) {
         attachments.Clear();
         throw e;
     }
     attachments.Clear();
     if (!ok) {
         throw new PdfAConformanceException(xmpMeta,
             MessageLocalization.GetComposedMessage("zugferd.xmp.schema.shall.contain.attachment.name"));
     }
 }
        public override void OnStartPage(PdfWriter writer, Document document) {
            PdfPTable headerTable = new PdfPTable(1);
            headerTable.AddCell(new Phrase("Header"));

            WriteTable(writer.DirectContent, headerTable,
                new Rectangle(0, document.PageSize.Height - 50f, document.PageSize.Width, document.PageSize.Height));
        }
        protected void initFile(bool bBlackAndWhite = false)
        {
            m_doc = new Document();
            string folder = Settings.Default["pdffolder"].ToString() + m_strFolder;
            System.IO.Directory.CreateDirectory(folder );
            string fileName = folder + "/"+m_strTitle;
            if (bBlackAndWhite)
                fileName += "BW.pdf";
            else
                fileName += ".pdf";

            m_writer = PdfWriter.GetInstance(m_doc, new System.IO.FileStream(fileName, System.IO.FileMode.Create));
            m_doc.Open();
            m_fSmall = new iTextSharp.text.Font();
            m_fSmall.Size = 10;

            m_fBig = new iTextSharp.text.Font();
            m_fBig.Size = 40;
            m_fBig.Color = bBlackAndWhite ? BaseColor.BLACK : getNextColor();
            //            m_fBig.SetStyle("bold");

            m_fNorm = new iTextSharp.text.Font();
            m_fNorm.Size = 20;
            m_fNorm.Color = new BaseColor(m_colorText);

            m_doc.Add(new Paragraph("Name:____________________________________________  Date:______________"/*, fSmall*/));
            m_doc.Add(new Paragraph(m_strTitle, m_fBig));
            m_doc.Add(new Paragraph("   "));
        }
        public override void OnEndPage(PdfWriter writer, Document document)
        {
            PdfPTable footer = new PdfPTable(3);
            footer.SetWidths(new float[] { 88f, 7f, 5f });
            footer.WidthPercentage = 100;
            footer.TotalWidth = document.PageSize.Width - (document.LeftMargin + document.RightMargin);

            PdfPCell emptycell = new PdfPCell();
            emptycell.Border = 0;
            footer.AddCell(emptycell);

            Chunk text = new Chunk(string.Format(GlobalStringResource.PageOfFooter,
                document.PageNumber), FontFactory.GetFont(FontFactory.HELVETICA, 8));

            PdfPCell footerCell = new PdfPCell(new Phrase(text));
            footerCell.Border = 0;
            footerCell.HorizontalAlignment = Element.ALIGN_RIGHT;
            footer.AddCell(footerCell);

            PdfPCell cell = new PdfPCell(iTextSharp.text.Image.GetInstance(total));
            cell.Border = 0;
            cell.HorizontalAlignment = Element.ALIGN_LEFT;
            footer.AddCell(cell);
            footer.WriteSelectedRows(0, -1, 50, (document.BottomMargin - 10), writer.DirectContent);
        }
        /// <summary>
        /// Fires when a page is finished, just before being written to the document.
        /// </summary>
        /// <param name="writer">PdfWriter</param>
        /// <param name="document">PDF Document</param>
        /// <param name="columnCellsSummaryData">List of all rows summaries data</param>
        public void PageFinished(PdfWriter writer, Document document, IList<SummaryCellData> columnCellsSummaryData)
        {
            var footerTable = AddPageFooter(new FooterData
            {
                PdfDoc = document,
                PdfWriter = writer,
                SummaryData = columnCellsSummaryData,
                CurrentPageNumber = writer.PageNumber,
                TotalPagesCountImage = _totalPageCountImage
            });

            var table = new PdfGrid(1)
            {
                RunDirection = (int)FooterProperties.RunDirection,
                WidthPercentage = FooterProperties.TableWidthPercentage
            };
            var tableCell = new PdfPCell(footerTable) { Border = 0 };
            table.AddCell(tableCell);

            var page = document.PageSize;
            table.SetTotalWidth(new[] { page.Width - document.LeftMargin - document.RightMargin });
            table.WriteSelectedRows(
                    rowStart: 0,
                    rowEnd: -1,
                    xPos: document.LeftMargin,
                    yPos: document.BottomMargin - FooterProperties.SpacingBeforeTable,
                    canvas: writer.DirectContent);
        }
 internal PdfPatternPainter(PdfWriter wr, Color defaultColor) : this(wr) {
     stencil = true;
     if (defaultColor == null)
         this.defaultColor = new Color(System.Drawing.Color.Gray);
     else
         this.defaultColor = defaultColor;
 }
 /**
  * Initialize one of the headers, based on the chapter title;
  * reset the page number.
  * @see com.itextpdf.text.pdf.PdfPageEventHelper#onChapter(
  *      com.itextpdf.text.pdf.PdfWriter, com.itextpdf.text.Document, float,
  *      com.itextpdf.text.Paragraph)
  */
 public override void OnChapter(
   PdfWriter writer, Document document,
   float paragraphPosition, Paragraph title)
 {
     header[1] = new Phrase(title.Content);
     pagenumber = 1;
 }
 private void InitializeDocument()
 {
     MemoryStream baos = new MemoryStream();
     document = new Document();
     writer = PdfWriter.GetInstance(document, baos);
     document.Open();
 }
 /**
 * Creates a file specification of type URL.
 * @param writer the <CODE>PdfWriter</CODE>
 * @param url the URL
 * @return the file specification
 */    
 public static PdfFileSpecification Url(PdfWriter writer, String url) {
     PdfFileSpecification fs = new PdfFileSpecification();
     fs.writer = writer;
     fs.Put(PdfName.FS, PdfName.URL);
     fs.Put(PdfName.F, new PdfString(url));
     return fs;
 }
Exemple #24
0
 public override void OnEndPage(PdfWriter writer, Document document) {
   ColumnText.ShowTextAligned(
     writer.DirectContentUnder,
     Element.ALIGN_CENTER, new Phrase("FOOBAR FILM FESTIVAL", FONT),
     297.5f, 421, writer.PageNumber % 2 == 1 ? 45 : -45
   );
 }
 internal PdfReaderInstance(PdfReader reader, PdfWriter writer)
 {
     this.reader = reader;
     this.writer = writer;
     file = reader.SafeFile;
     myXref = new int[reader.XrefSize];
 }
        //重写 关闭一个页面时
        public override void OnEndPage(PdfWriter writer, Document document)
        {
            try
            {
                Font font = new Font(basefont, defaultFontSize);
                Phrase head = new Phrase(header, font);
                PdfContentByte cb = writer.DirectContent;
               
                //页眉显示的位置
                ColumnText.ShowTextAligned(cb, Element.ALIGN_RIGHT, head,
                        document.Right - 10 + document.LeftMargin, document.Top + 10, 0);
                if (PAGE_NUMBER)
                {
                    Phrase footer = new Phrase("第 " + writer.PageNumber + " / " + "   "+" 頁", font);
                    cb = writer.DirectContent;
                    //tpl = cb.CreateTemplate(100, 100);
                    //模版 显示总共页数
                    cb.AddTemplate(tpl, document.Left / 2 + document.Right / 2 , document.Bottom - 10);//调节模版显示的位置
                    //页脚显示的位置
                    ColumnText.ShowTextAligned(cb, Element.ALIGN_RIGHT, footer,
                            document.Left / 2+document.Right/ 2+23, document.Bottom - 10, 0);
                    

                }
            }
            catch (Exception ex)
            {
                throw new Exception("HeaderAndFooterEvent-->OnEndPage-->" + ex.Message);
            }
        }
 public override void OnOpenDocument(PdfWriter writer, Document document)
 {
     printTime = DateTime.Now;
     baseFont = BaseFont.CreateFont(BaseFont.HELVETICA, BaseFont.CP1252, BaseFont.NOT_EMBEDDED);
     pdfContent = writer.DirectContent;
     pageNumberTemplate = pdfContent.CreateTemplate(50, 50);
 }
        public override void OnEndPage(PdfWriter writer, Document document)
        {
            base.OnEndPage(writer, document);

                int pageN = writer.PageNumber;
                String text = "Page " + pageN + " of ";
                float len = _bf.GetWidthPoint(text, 8);

                Rectangle pageSize = document.PageSize;

                _cb.SetRGBColorFill(100, 100, 100);

                _cb.BeginText();
                _cb.SetFontAndSize(_bf, 8);
                _cb.SetTextMatrix(pageSize.GetLeft(40), pageSize.GetBottom(30));
                _cb.ShowText(text);
                _cb.EndText();

                _cb.AddTemplate(_template, pageSize.GetLeft(40) + len, pageSize.GetBottom(30));

                _cb.BeginText();
                _cb.SetFontAndSize(_bf, 8);
                _cb.ShowTextAligned(PdfContentByte.ALIGN_RIGHT,
                    "Printed On " + _printTime.ToString(),
                    pageSize.GetRight(40),
                    pageSize.GetBottom(30), 0);
                _cb.EndText();
        }
        public override void OnEndPage(PdfWriter writer, Document document)
        {
            base.OnEndPage(writer, document);

            int pageN = writer.PageNumber;
            string text = pageN + " - ";
            float len = baseFont.GetWidthPoint(text, 8);

            Rectangle pageSize = document.PageSize;
            pdfContent = writer.DirectContent;
            pdfContent.SetRGBColorFill(100, 100, 100);

            pdfContent.BeginText();
            pdfContent.SetFontAndSize(baseFont, 8);
            pdfContent.SetTextMatrix(pageSize.Width / 2, pageSize.GetBottom(30));
            pdfContent.ShowText(text);
            pdfContent.EndText();

            pdfContent.AddTemplate(pageNumberTemplate, (pageSize.Width / 2) + len, pageSize.GetBottom(30));

            pdfContent.BeginText();
            pdfContent.SetFontAndSize(baseFont, 8);
            pdfContent.ShowTextAligned(PdfContentByte.ALIGN_RIGHT, printTime.ToString(), pageSize.GetRight(40), pageSize.GetBottom(30), 0);
            pdfContent.EndText();
        }
        public override void OnStartPage(PdfWriter writer, iTextSharp.text.Document document)
        {
            iTextSharp.text.Image header = iTextSharp.text.Image.GetInstance(PathResolver.MapPath("images/ADB_Logo.gif"));

            PdfPTable tableHeader = new PdfPTable(2);
            tableHeader.WidthPercentage = 100;

            PdfPCell imageHeaderCell = new PdfPCell(header);
            imageHeaderCell.Rowspan = 2;
            imageHeaderCell.HorizontalAlignment = 0; //0=Left, 1=Centre, 2=Right
            imageHeaderCell.Border = 0;
            imageHeaderCell.PaddingBottom = 3;
            tableHeader.AddCell(imageHeaderCell);

            Font helvetica20 = FontFactory.GetFont(FontFactory.HELVETICA, 16);
            PdfPCell typeNameCell = new PdfPCell(new Phrase(TypesReader.GetDiagramName(this.type), helvetica20));
            typeNameCell.HorizontalAlignment = 2;
            typeNameCell.Border = 0;
            tableHeader.AddCell(typeNameCell);

            PdfPCell adbCell = new PdfPCell(new Phrase(GlobalStringResource.ADB, helvetica20));
            adbCell.HorizontalAlignment = 2;
            adbCell.Border = 0;
            tableHeader.AddCell(adbCell);

            PdfPCell lineCell = new PdfPCell();
            lineCell.Colspan = 2;
            lineCell.Border = 1;
            lineCell.PaddingBottom = 5;
            tableHeader.AddCell(lineCell);

            document.Add(tableHeader);
        }