本文整理汇总了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();
}
示例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;
}
示例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;
}