当前位置: 首页>>代码示例>>C#>>正文


C# pdf.PdfDocument类代码示例

本文整理汇总了C#中iTextSharp.text.pdf.PdfDocument的典型用法代码示例。如果您正苦于以下问题:C# PdfDocument类的具体用法?C# PdfDocument怎么用?C# PdfDocument使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


PdfDocument类属于iTextSharp.text.pdf命名空间,在下文中一共展示了PdfDocument类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetInstance

 /**
  * Use this method to get an instance of the <CODE>PdfWriter</CODE>.
  * @param	document	The <CODE>Document</CODE> that has to be written
  * @param	os	The <CODE>Stream</CODE> the writer has to write to.
  * @param conformanceLevel PDF/A conformance level of a new PDF document
  * @return	a new <CODE>PdfWriter</CODE>
  * @throws	DocumentException on error
  */
 public static PdfAWriter GetInstance(Document document, Stream os, PdfAConformanceLevel conformanceLevel) {
     PdfDocument pdf = new PdfDocument();
     document.AddDocListener(pdf);
     PdfAWriter writer = new PdfAWriter(pdf, os, conformanceLevel);
     pdf.AddWriter(writer);
     return writer;
 }
开发者ID:,项目名称:,代码行数:15,代码来源:

示例2: WriteToPdf

        public override void WriteToPdf(PdfDocument doc)
        {
            doc.GetWriter.SetCMYKColorStroke(0, 0, 0, 255);
            doc.GetWriter.SetCMYKColorFill(0, 0, 0, 255);
            doc.GetWriter.BeginText();
            doc.GetWriter.SetTextMatrix(PosX+2, PosY+2);

            while ((customfont.GetWidthPointKerned(Text, FontSize) > Width) || (FontSize == 2)) FontSize--;
            doc.GetWriter.SetFontAndSize(customfont, FontSize);
            doc.GetWriter.ShowText(Text);
            doc.GetWriter.EndText();
            doc.Flush();
        }
开发者ID:Jazzuell,项目名称:parser,代码行数:13,代码来源:Label.cs

示例3: PdfWriter

 /**
 * Constructs a <CODE>PdfWriter</CODE>.
 * <P>
 * Remark: a PdfWriter can only be constructed by calling the method
 * <CODE>getInstance(Document document, Stream os)</CODE>.
 *
 * @param    document    The <CODE>PdfDocument</CODE> that has to be written
 * @param    os          The <CODE>Stream</CODE> the writer has to write to.
 */
 
 protected PdfWriter(PdfDocument document, Stream os) : base(document, os) {
     pdfIsoConformance = GetPdfIsoConformance();
     root = new PdfPages(this);
     pdf = document;
     directContentUnder = new PdfContentByte(this);
     directContent = directContentUnder.Duplicate;
 }
开发者ID:,项目名称:,代码行数:17,代码来源:

示例4: PdfContentByte

 // constructors
 /**
  * Constructs a new <CODE>PdfContentByte</CODE>-object.
  *
  * @param wr the writer associated to this content
  */
 public PdfContentByte(PdfWriter wr)
 {
     if (wr != null) {
         writer = wr;
         pdf = writer.PdfDocument;
         autoControlTextBlocks = !pdf.UseSeparateCanvasesForTextAndGraphics;
     }
 }
开发者ID:HardcoreSoftware,项目名称:iSecretary,代码行数:14,代码来源:PdfContentByte.cs

示例5: PdfContentByte

     // constructors
 
     /**
      * Constructs a new <CODE>PdfContentByte</CODE>-object.
      *
      * @param wr the writer associated to this content
      */
 
     public PdfContentByte(PdfWriter wr) {
         if (wr != null) {
             writer = wr;
             pdf = writer.PdfDocument;
         }
     }
开发者ID:NelsonSantos,项目名称:fyiReporting-Android,代码行数:14,代码来源:PdfContentByte.cs

示例6: PdfAWriter

        /**
         * Constructs a <CODE>PdfAWriter</CODE>.
         * <P>
         * Remark: a PdfAWriter can only be constructed by calling the method <CODE>getInstance(Document document, Stream os, PdfAconformanceLevel conformanceLevel)</CODE>.
         * @param document the <CODE>PdfDocument</CODE> that has to be written
         * @param os the <CODE>Stream</CODE> the writer has to write to
         * @param conformanceLevel PDF/A conformance level of a new PDF document
         */

        protected internal PdfAWriter(PdfDocument document, Stream os, PdfAConformanceLevel conformanceLevel)
            : base(document, os) {
            ((IPdfAConformance) pdfIsoConformance).SetConformanceLevel(conformanceLevel);
            SetPdfVersion(this, conformanceLevel);
        }
开发者ID:,项目名称:,代码行数:14,代码来源:

示例7: Write

        /**
        * Write out the columns.  After writing, use
        * {@link #isOverflow()} to see if all text was written.
        * @param canvas PdfContentByte to write with
        * @param document document to write to (only used to get page limit info)
        * @param documentY starting y position to begin writing at
        * @return the current height (y position) after writing the columns
        * @throws DocumentException on error
        */
        public float Write(PdfContentByte canvas, PdfDocument document, float documentY)
        {
            this.document = document;
            columnText.Canvas = canvas;
            if (columnDefs.Count == 0) {
                throw new DocumentException(MessageLocalization.GetComposedMessage("multicolumntext.has.no.columns"));
            }
            overflow = false;
            float currentHeight = 0;
            bool done = false;
            while (!done) {
                if (top == AUTOMATIC) {
                    top = document.GetVerticalPosition(true);
                }
                else if (nextY == AUTOMATIC) {
                    nextY = document.GetVerticalPosition(true); // RS - 07/07/2005 - - Get current doc writing position for top of columns on new page.
                }

                ColumnDef currentDef = columnDefs[CurrentColumn];
                columnText.YLine = top;

                float[] left = currentDef.ResolvePositions(Rectangle.LEFT_BORDER);
                float[] right = currentDef.ResolvePositions(Rectangle.RIGHT_BORDER);
                if (document.IsMarginMirroring() && document.PageNumber % 2 == 0){
                    float delta = document.RightMargin - document.Left;
                    left = (float[])left.Clone();
                    right = (float[])right.Clone();
                    for (int i = 0; i < left.Length; i += 2) {
                        left[i] -= delta;
                    }
                    for (int i = 0; i < right.Length; i += 2) {
                        right[i] -= delta;
                    }
                }
                currentHeight = Math.Max(currentHeight, GetHeight(left, right));

                if (currentDef.IsSimple()) {
                    columnText.SetSimpleColumn(left[2], left[3], right[0], right[1]);
                } else {
                    columnText.SetColumns(left, right);
                }

                int result = columnText.Go();
                if ((result & ColumnText.NO_MORE_TEXT) != 0) {
                    done = true;
                    top = columnText.YLine;
                } else if (ShiftCurrentColumn()) {
                    top = nextY;
                } else {  // check if we are done because of height
                    totalHeight += currentHeight;

                    if ((desiredHeight != AUTOMATIC) && (totalHeight >= desiredHeight)) {
                        overflow = true;
                        break;
                    } else {  // need to start new page and reset the columns
                        documentY = nextY;
                        NewPage();
                        currentHeight = 0;
                    }
                }
            }
            if (desiredHeight == AUTOMATIC && columnDefs.Count == 1) {
                currentHeight = documentY - columnText.YLine;
            }
            return currentHeight;
        }
开发者ID:boecko,项目名称:iTextSharp,代码行数:75,代码来源:MultiColumnText.cs

示例8: PdfWriter

 /**
 * Constructs a <CODE>PdfWriter</CODE>.
 * <P>
 * Remark: a PdfWriter can only be constructed by calling the method
 * <CODE>getInstance(Document document, Stream os)</CODE>.
 *
 * @param    document    The <CODE>PdfDocument</CODE> that has to be written
 * @param    os          The <CODE>Stream</CODE> the writer has to write to.
 */
 protected PdfWriter(PdfDocument document, Stream os)
     : base(document, os)
 {
     root = new PdfPages(this);
     pdf = document;
     directContent = new PdfContentByte(this);
     directContentUnder = new PdfContentByte(this);
 }
开发者ID:karino2,项目名称:wikipediaconv,代码行数:17,代码来源:PdfWriter.cs

示例9: GetXmpWriter

 protected internal virtual XmpWriter GetXmpWriter(MemoryStream baos, PdfDocument.PdfInfo info)
 {
     if (xmpWriter == null)
         xmpWriter = new XmpWriter(baos, info);
     return xmpWriter;
 }
开发者ID:HardcoreSoftware,项目名称:iSecretary,代码行数:6,代码来源:PdfWriter.cs

示例10: PDFFromTemplateHelper

 private PDFFromTemplateHelper( PdfDocument pdfDocument )
 {
     _pdfDocument = pdfDocument;
 }
开发者ID:BernhardPosselt,项目名称:itp-bif3,代码行数:4,代码来源:PDFFromTemplateHelper.cs

示例11: GetXmpWriter

 /**
  * @see PdfWriter#getXmpWriter(java.io.MemoryStream, com.itextpdf.text.pdf.PdfDocument.PdfInfo)
  */
 override protected XmpWriter GetXmpWriter(MemoryStream baos, PdfDocument.PdfInfo info)
 {
     if (xmpWriter == null)
         xmpWriter = new PdfAXmpWriter(baos, info, ((IPdfAConformance)pdfIsoConformance).GetConformanceLevel());
     return xmpWriter;
 }
开发者ID:,项目名称:,代码行数:9,代码来源:

示例12: Initialize

 public override void Initialize()
 {
     // instantiate document
     pdfDocument = new PdfDocument();
     pdfDocument.Info.Title = title;
     pdfDocument.Info.Author = author;
     // add a page
     PdfPage page = pdfDocument.AddPage();
     page.Orientation = PageOrientation.Portrait;
     // set page size
     page.Width = XUnit.FromMillimeter(bbox.Width);
     page.Height = XUnit.FromMillimeter(bbox.Height);
     // get graphics
     this.pdfGfx = XGraphics.FromPdfPage(page);
     // draw a bounding box
     XRect rect = new XRect(0.5, 0.5, page.Width - 1, page.Height - 1);
     this.pdfGfx.DrawRectangle(XBrushes.White, rect);
     // initialize cotation
     PicCotation._globalCotationProperties._arrowLength = XUnit.FromMillimeter(bbox.Height) / 50.0;
 }
开发者ID:minrogi,项目名称:PLMPack,代码行数:20,代码来源:PicGraphicsPdf.cs

示例13: WriteToPdf

        public override void WriteToPdf(PdfDocument doc)
        {
            //  LABEL
            //  ---------------
            // | Hodnota(Text) |
            //  ---------------

            // biely stvorec obsahujuci hodnotu elementu  (ulozenu v Text)
            // sirka bieleho pola je priamoumerna dlzke textu ktory v nej bude vykresleny
            if (FieldWidth == -1)
                FieldWidth = 15 + (int)customfont.GetWidthPointKerned(Text, FieldFontSize);
            if (FieldHeight == -1)
                FieldHeight = FieldFontSize + 2;
            RectArea r = new RectArea(PosX + 1, PosY +2, FieldWidth+2, FieldHeight);
            r.SetFillColor(0, 0, 0, 0);
            r.AddToDocument(doc);

            if (Label.Text != "")
            {
                // vykreslenie labelu, ktory popisuje hodnoty nizsie
                Label.PosX = this.PosX + 3;
                Label.PosY = this.PosY + FieldHeight + 3;
                Label.WriteToPdf(doc);
            }

            // vpisanie hodnoty elementu do bieleho pola
            Label l = new Label();
            l.Width = FieldWidth-10;
            l.Height = FieldHeight;
            l.Text = this.Text;
            l.PosX = PosX ;
            l.PosY = PosY + 4;
            l.FontSize = FieldFontSize;
            if (FieldWidth > -1)
                l.Width = FieldWidth;
            if (FieldHeight >= -1)
                l.Height = FieldHeight;
            l.WriteToPdf(doc);
        }
开发者ID:Jazzuell,项目名称:parser,代码行数:39,代码来源:NamedField.cs


注:本文中的iTextSharp.text.pdf.PdfDocument类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。