void Initialize() { Size = RegionInfo.CurrentRegion.IsMetric ? PageSize.A4 : PageSize.Letter; #pragma warning disable 168 // Force creation of MediaBox object by invoking property. PDFRectangle rect = MediaBox; #pragma warning restore 168 }
/// <summary> /// Tests whether the specified object is a PDFRectangle and has equal coordinates. /// </summary> public override bool Equals(object obj) { // ReSharper disable CompareOfFloatsByEqualityOperator PDFRectangle rectangle = obj as PDFRectangle; if (rectangle != null) { PDFRectangle rect = rectangle; return(rect.X1 == X1 && rect.Y1 == Y1 && rect.X2 == X2 && rect.Y2 == Y2); } return(false); // ReSharper restore CompareOfFloatsByEqualityOperator }
internal PDFPage(PDFDictionary dict) : base(dict) { // Set Orientation depending on /Rotate. //!!!modTHHO 2016-06-16 Do not set Orientation here. Setting Orientation is not enough. Other properties must also be changed when setting Orientation. //!!!modTHHO 2018-04-05 Restored the old behavior. Commenting the next three lines out is not enough either. // New approach: remember that Orientation was set based on rotation. int rotate = Elements.GetInteger(InheritablePageKeys.Rotate); if (Math.Abs(rotate / 90) % 2 == 1) { #if true _orientation = PageOrientation.Landscape; // Hacky approach: do not swap width and height on saving when orientation was set here. _orientationSetByCodeForRotatedDocument = true; #else // Cleaner approach: Swap width and height here. But some drawing routines will not draw the XPDFForm correctly, so this needs more testing and more changes. // When saving, width and height will be swapped. So we have to swap them here too. PDFRectangle mediaBox = MediaBox; MediaBox = new PDFRectangle(mediaBox.X1, mediaBox.Y1, mediaBox.Y2, mediaBox.X2); #endif } }
/// <summary> /// Implements cloning this instance. /// </summary> protected override object Copy() { PDFRectangle rect = (PDFRectangle)base.Copy(); return(rect); }