當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。