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


C# iTextSharp.SetMargins方法代码示例

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


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

示例1: AddPageWithImage

        /// <summary>
        /// Add a page containing a single image.  Set the page size to match the image size.
        /// </summary>
        /// <param name="doc"></param>
        /// <param name="imagePath"></param>
        private void AddPageWithImage(iTextSharp.text.Document doc, String imagePath)
        {
            // Read the image file
            iTextSharp.text.Image image = iTextSharp.text.Image.GetInstance(new Uri(imagePath));

            // Set the page size to the dimensions of the image BEFORE adding a new page to the document.
            // Pad the height a bit to leave room for the page header.
            float imageWidth = image.Width;
            float imageHeight = image.Height;
            doc.SetMargins(0, 0, 0, 0);
            doc.SetPageSize(new iTextSharp.text.Rectangle(imageWidth, imageHeight + 100));

            // Add a new page
            doc.NewPage();

            // The header at the top of the page is an anchor linked to by the table of contents.
            iTextSharp.text.Anchor contentsAnchor = new iTextSharp.text.Anchor("\nGRAPH\n\n", _largeFont);
            contentsAnchor.Name = "graph";

            // Add the anchor and image to the page
            this.AddParagraph(doc, iTextSharp.text.Element.ALIGN_CENTER, _largeFont, contentsAnchor);
            doc.Add(image);
            image = null;
        }
开发者ID:JosefinaAiyar,项目名称:iTextSharpTester,代码行数:29,代码来源:PDFCreator.cs

示例2: SetStandardPageSize

 /// <summary>
 /// Set margins and page size for the document
 /// </summary>
 /// <param name="doc"></param>
 private void SetStandardPageSize(iTextSharp.text.Document doc)
 {
     // Set margins and page size for the document
     doc.SetMargins(50, 50, 50, 50);
     // There are a huge number of possible page sizes, including such sizes as
     // EXECUTIVE, POSTCARD, LEDGER, LEGAL, LETTER_LANDSCAPE, and NOTE
     doc.SetPageSize(new iTextSharp.text.Rectangle(iTextSharp.text.PageSize.LETTER.Width,
         iTextSharp.text.PageSize.LETTER.Height));
 }
开发者ID:JosefinaAiyar,项目名称:iTextSharpTester,代码行数:13,代码来源:PDFCreator.cs

示例3: Settings

        /// <summary>
        /// This method consist settings of pdf file
        /// </summary>
        /// <param name="ms"></param>
        /// <param name="doc"></param>
        public void Settings(MemoryStream ms, iTextSharp.text.Document doc)
        {
            PdfWriter.GetInstance(doc, ms);
            iTextSharp.text.Rectangle rec = new iTextSharp.text.Rectangle(iTextSharp.text.PageSize.A4);

            doc.SetPageSize(rec);

            doc.SetMargins(0, 0, 0, 0);

            doc.Open();

            doc.NewPage();
        }
开发者ID:VladZernov,项目名称:needlework,代码行数:18,代码来源:PDF.cs


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