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


C# Rectangle.Rotate方法代码示例

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


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

示例1: PDFCreator

        /// <summary>
        /// PDF Creator Helper With No Page Base (Don't want to write a page or report (header or footer)
        /// </summary>
        /// <param name="PageSize">Page Size - A4 is a default page size. Use Enum iTextSharp.text.PageSize</param>
        /// <param name="LandscapeMode">Do you want the pdf in landscape</param>
        /// <param name="MarginTop">Top Margin On The Page</param>
        /// <param name="MarginRight">Right Margin On The Page</param>
        /// <param name="MarginBottom">Bottom Margin On The Page</param>
        /// <param name="MarginLeft">Left Margin On The Page</param>
        /// <param name="PageEventHandler">A Page Event Class That Will Raise Any Events You Need</param>
        public PDFCreator(Rectangle PageSize,
                          bool LandscapeMode,
                          float MarginTop,
                          float MarginRight,
                          float MarginBottom,
                          float MarginLeft,
                          PageEventsBase PageEventHandler)
        {
            //create the instance of the ITextSharpDocument
            Doc = new Document(PageSize, MarginLeft, MarginRight, MarginTop, MarginBottom);

            //let's build the memory stream now
            Ms = new MemoryStream();

            //let's create the new writer and attach the document
            Writer = PdfWriter.GetInstance(Doc, Ms);

            //add the page events to my custom class
            if (PageEventHandler != null)
            {
                Writer.PageEvent = PageEventHandler;
            }

            //if you want the pdf in landscape now, then rotate it
            if (LandscapeMode)
            {
                Doc.SetPageSize(PageSize.Rotate());
            }

            //let's open the document so the developer can do whatever they wan't with it
            Doc.Open();
        }
开发者ID:dibiancoj,项目名称:ToracLibrary,代码行数:42,代码来源:PDFCreator.cs

示例2: GuessFormat

 /**
 * This method tries to fit the <code>Rectangle pageSize</code> to one of the predefined PageSize rectangles.
 * If a match is found the pageWidth and pageHeight will be set according to values determined from files
 * generated by MS Word2000 and OpenOffice 641. If no match is found the method will try to match the rotated
 * Rectangle by calling itself with the parameter rotate set to true.
 * 
 * @param pageSize the page size for which to guess the correct format
 * @param rotate Whether we should try to rotate the size befor guessing the format
 * @return <code>True</code> if the format was guessed, <code>false/<code> otherwise
 */
 private bool GuessFormat(Rectangle pageSize, bool rotate) {
     if (rotate) {
         pageSize = pageSize.Rotate();
     }
     if (RectEquals(pageSize, PageSize.A3)) {
         pageWidth = 16837;
         pageHeight = 23811;
         landscape = rotate;
         return true;
     }
     if (RectEquals(pageSize, PageSize.A4)) {
         pageWidth = 11907;
         pageHeight = 16840;
         landscape = rotate;
         return true;
     }
     if (RectEquals(pageSize, PageSize.A5)) {
         pageWidth = 8391;
         pageHeight = 11907;
         landscape = rotate;
         return true;
     }
     if (RectEquals(pageSize, PageSize.A6)) {
         pageWidth = 5959;
         pageHeight = 8420;
         landscape = rotate;
         return true;
     }
     if (RectEquals(pageSize, PageSize.B4)) {
         pageWidth = 14570;
         pageHeight = 20636;
         landscape = rotate;
         return true;
     }
     if (RectEquals(pageSize, PageSize.B5)) {
         pageWidth = 10319;
         pageHeight = 14572;
         landscape = rotate;
         return true;
     }
     if (RectEquals(pageSize, PageSize.HALFLETTER)) {
         pageWidth = 7927;
         pageHeight = 12247;
         landscape = rotate;
         return true;
     }
     if (RectEquals(pageSize, PageSize.LETTER)) {
         pageWidth = 12242;
         pageHeight = 15842;
         landscape = rotate;
         return true;
     }
     if (RectEquals(pageSize, PageSize.LEGAL)) {
         pageWidth = 12252;
         pageHeight = 20163;
         landscape = rotate;
         return true;
     }
     if (!rotate && GuessFormat(pageSize, true)) {
         int x = pageWidth;
         pageWidth = pageHeight;
         pageHeight = x;
         return true;
     }
     return false;
 }
开发者ID:nicecai,项目名称:iTextSharp-4.1.6,代码行数:76,代码来源:RtfPageSetting.cs

示例3: SetPageDefWidthHeight

        /// <summary>
        /// implement for PDFTemplate
        /// this will call when initialize PDFTemplate object!
        /// </summary>
        protected override void SetPageDefWidthHeight()
        {
            // this will call from PDFTemplate._buildPageDef()
            pageSize = PDFDrawItextSharpHelper.PageSize(
                Helper.GetAttributeValue("pagesize", PageDefinition.PageDefAttrs, "A4"));

            if (Helper.GetAttributeValue(
                "pageorientation",
                PageDefinition.PageDefAttrs,
                "landscape").ToUpper() == "LANDSCAPE")
            {
                pageSize = pageSize.Rotate();
            }

            PageDefinition.Width = pageSize.Width;
            PageDefinition.Height = pageSize.Height;
        }
开发者ID:cedricmartel,项目名称:PdfTemplate,代码行数:21,代码来源:PDFTemplateItextSharp.cs


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