public override int GetHashCode() { int hash = 1; if (Type != global::Google.Ads.GoogleAds.V10.Enums.TrackingCodeTypeEnum.Types.TrackingCodeType.Unspecified) { hash ^= Type.GetHashCode(); } if (PageFormat != global::Google.Ads.GoogleAds.V10.Enums.TrackingCodePageFormatEnum.Types.TrackingCodePageFormat.Unspecified) { hash ^= PageFormat.GetHashCode(); } if (HasGlobalSiteTag) { hash ^= GlobalSiteTag.GetHashCode(); } if (HasEventSnippet) { hash ^= EventSnippet.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
// Add a section to the document public static Section AddSection(this Document document, PageFormat pageFormat, ObjectSetup setup = null) { Section section = document.AddSection(); section.PageSetup = document.DefaultPageSetup.Clone(); section.PageSetup.PageFormat = pageFormat; if (setup != null) { if (setup.Width != null) { section.PageSetup.PageWidth = setup.Width.Value; } if (setup.Height != null) { section.PageSetup.PageHeight = setup.Height.Value; } if (setup.Margin != null) { section.PageSetup.TopMargin = string.Format("{0}cm", setup.Margin.Top); section.PageSetup.LeftMargin = string.Format("{0}cm", setup.Margin.Left); section.PageSetup.RightMargin = string.Format("{0}cm", setup.Margin.Right); section.PageSetup.BottomMargin = string.Format("{0}cm", setup.Margin.Bottom); } } return(section); }
private void Populate(Document document) { PdfType1Font bodyFont = PdfType1Font.Load(document, PdfType1Font.FamilyEnum.Courier, true, false); Pages pages = document.Pages; PageFormat.SizeEnum[] pageFormats = (PageFormat.SizeEnum[])Enum.GetValues(typeof(PageFormat.SizeEnum)); PageFormat.OrientationEnum[] pageOrientations = (PageFormat.OrientationEnum[])Enum.GetValues(typeof(PageFormat.OrientationEnum)); foreach (PageFormat.SizeEnum pageFormat in pageFormats) { foreach (PageFormat.OrientationEnum pageOrientation in pageOrientations) { // Add a page to the document! Page page = new Page(document, PageFormat.GetSize(pageFormat, pageOrientation)); // Instantiates the page inside the document context. pages.Add(page); // Puts the page in the pages collection. // Drawing the text label on the page... SKSize pageSize = page.Size; PrimitiveComposer composer = new PrimitiveComposer(page); composer.SetFont(bodyFont, 32); composer.ShowText( pageFormat + " (" + pageOrientation + ")", // Text. new SKPoint( pageSize.Width / 2, pageSize.Height / 2 ), // Location: page center. XAlignmentEnum.Center, // Places the text on horizontal center of the location. YAlignmentEnum.Middle, // Places the text on vertical middle of the location. 45 // Rotates the text 45 degrees counterclockwise. ); composer.Flush(); } } }
private void BuildContent(Document document) { // Set default page size (A4)! document.PageSize = PageFormat.GetSize(); // Add a font to the fonts collection! document.Resources.Fonts[ResourceName_DefaultFont] = new StandardType1Font( document, StandardType1Font.FamilyEnum.Courier, true, false ); // Add a page to the document! Page page = new Page(document); // Instantiates the page inside the document context. document.Pages.Add(page); // Puts the page in the pages collection. // Create a content composer for the page content stream! PrimitiveComposer composer = new PrimitiveComposer(page); string[] steps = new string[5]; colorSpaces::Color[] colors = new colorSpaces::Color[5]; SKSize pageSize = page.Size; BuildSteps(composer, steps, colors, pageSize); BuildLegend(composer, steps, colors, pageSize); composer.Flush(); }
public NewDocumentDialog(InkControl control, KDocument doc, MainWindow window) { InitializeComponent(); this.control = control; this.doc = doc; this.window = window; this.BackColor = Style.Default.MenuBackground; this.ForeColor = Style.Default.MenuForeground; this.Width = 5 * Util.GetGUISize(); this.Dock = DockStyle.Left; formats = PageFormat.GetFormats(); foreach (var f in formats) { cbPageFormat.Items.Add(f.Key); } foreach (ColorFilter filter in Enum.GetValues(typeof(ColorFilter))) { cbFilters.Items.Add(Language.GetText($"Newdoc.filter.{filter}")); } cbFilters.Text = Language.GetText($"Newdoc.filter.{ColorFilter.Normal}"); if (formats.ContainsKey(Configuration.DefaultFormat)) { cbPageFormat.Text = Configuration.DefaultFormat; } else { cbPageFormat.Text = cbPageFormat.Items[0].ToString(); } Translator.Translate(this); }
public override void Run( ) { // 1. PDF file instantiation. files::File file = new files::File(); Document document = file.Document; // Set default page size (A4)! document.PageSize = PageFormat.GetSize(); // 2. Content creation. DateTime creationDate = DateTime.Now; // 2.1. Template. FormXObject template = BuildTemplate(document, creationDate); // 2.2. Welcome page. BuildWelcomePage(document, template); // 2.3. Free Software definition. BuildFreeSoftwareDefinitionPages(document, template); // 2.4. Bookmarks. BuildBookmarks(document); // 3. Serialization. Serialize(file, "Complex Typesetting", "complex typesetting", "typesetting, bookmarks, hyphenation, block composer, primitive composer, text alignment, image insertion, article threads"); }
public override int GetHashCode() { int hash = 1; if (Type != 0) { hash ^= Type.GetHashCode(); } if (PageFormat != 0) { hash ^= PageFormat.GetHashCode(); } if (globalSiteTag_ != null) { hash ^= GlobalSiteTag.GetHashCode(); } if (eventSnippet_ != null) { hash ^= EventSnippet.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public override void Draw(BaseRenderer r, PageFormat format, float border, Color mainColor, Color secondaryColor) { float borderpx = Util.MmToPoint(border); SizeF bsize = format.GetPixelSize(); RectangleF bounds = new RectangleF(borderpx, borderpx, bsize.Width - 2 * borderpx, bsize.Height - 2 * borderpx); r.DrawRect(secondaryColor, 1, bounds); }
public Section AddSection(PageFormat format = PageFormat.A4) { Document.AddSection(); // Magic: make sure we have a PageSetup without null values. Section.PageSetup = Document.DefaultPageSetup.Clone(); Section.PageSetup.PageFormat = format; return(Section); }
public ActionResult DeleteConfirmed(int id) { PageFormat pageFormat = db.PageFormat.Find(id); db.PageFormat.Remove(pageFormat); db.SaveChanges(); return(RedirectToAction("Index")); }
public async Task SendPages(IMessageChannel channel, PageFormat pageFormat) { var channelObj = await _messageChannelRepository.FindAsync(channel.Id); if (channelObj == null) { channelObj = (channel is IDMChannel dmChannel) ? _messageChannelFactory.CreateNewDM(channel.Id, dmChannel.Recipient.Id) : null; channelObj = (channel is IGuildChannel guildChannel) ? _messageChannelFactory.CreateNewServerMessage(channel.Id, guildChannel.GuildId) : channelObj; if (channelObj == null) { return; } await _messageChannelRepository.PostAsync(channelObj); } var paginatedMessage = new PaginatedMessage() { Pages = BuildPages(pageFormat), HasHiddenContent = pageFormat.HasHiddenColumns }; if (paginatedMessage.Pages.Count == 0) { return; } if (paginatedMessage.HasHiddenContent) { var revealedPages = BuildPages(pageFormat.RevealedPageFormat); revealedPages.ForEach(p => p.IsHidden = true); paginatedMessage.Pages.AddRange(revealedPages); } var message = await channel.SendMessageAsync(paginatedMessage.Pages.First().Content); paginatedMessage.Id = message.Id; paginatedMessage.MessageChannelId = channelObj.Id; if (paginatedMessage.Pages.Count != 1) { if (paginatedMessage.StandardPages.Count > 1) { await message.AddReactionAsync(new Emoji(ArrowBackward)); await message.AddReactionAsync(new Emoji(ArrowForward)); } if (pageFormat.HasHiddenColumns) { await message.AddReactionAsync(pageFormat.RevealEmote); } } await _paginatedMessageRepository.PostAsync(paginatedMessage); await _messageChannelRepository.SaveAllChangesAsync(); }
public ActionResult Edit([Bind(Include = "Id,GroupId,Name,MarginLeft,MarginRight,MarginTop,MarginBottom,PaperType,FontFamily")] PageFormat pageFormat) { if (ModelState.IsValid) { db.Entry(pageFormat).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(pageFormat)); }
public PageAdder(InkControl control, KDocument document) { InitializeComponent(); isPosition = new ItemSelector(); isPosition.Dock = DockStyle.Top; Controls.Add(isPosition); isPosition.SendToBack(); this.control = control; this.document = document; this.Width = 5 * Util.GetGUISize(); this.Dock = DockStyle.Left; comboBox1.Height = Util.GetGUISize(); comboBox1.Font = new Font(comboBox1.Font.FontFamily, Util.GetGUISize() / 2, GraphicsUnit.Pixel); panelBottom.Height = Util.GetGUISize(); btnAdd.Width = 3 * Util.GetGUISize(); isPosition.Height = 3 * Util.GetGUISize(); this.ClientSize = new Size(8 * Util.GetGUISize(), 6 * Util.GetGUISize()); var padding = this.Padding; padding.Top = Util.GetGUISize() / 2; this.Padding = padding; this.BackColor = Style.Default.MenuBackground; panelBottom.BackColor = Style.Default.MenuContrast; this.ForeColor = Style.Default.MenuForeground; comboBox1.BackColor = Style.Default.MenuContrast; comboBox1.ForeColor = Style.Default.MenuForeground; isPosition.ForeColor = Style.Default.MenuForeground; formats = PageFormat.GetFormats(); foreach (var f in formats) { comboBox1.Items.Add(f.Key); } if (formats.ContainsKey(document.DefaultFormat)) { comboBox1.Text = document.DefaultFormat; } else { comboBox1.Text = comboBox1.Items[0].ToString(); } Dialogues.Translator.Translate(this); isPosition.Items = new string[] { Language.GetText("Newpage.beforeCurrent"), Language.GetText("Newpage.afterCurrent"), Language.GetText("Newpage.atEnd") }; isPosition.SelectedIndex = 1; }
public ActionResult Create([Bind(Include = "Id,GroupId,Name,MarginLeft,MarginRight,MarginTop,MarginBottom,PaperType,FontFamily")] PageFormat pageFormat) { if (ModelState.IsValid) { db.PageFormat.Add(pageFormat); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(pageFormat)); }
public override void Draw(BaseRenderer r, PageFormat format, float border, Color mainColor, Color secondaryColor) { float borderpx = Util.MmToPoint(border); float x2 = format.GetPixelSize().Width - borderpx; for (float y = border; y < format.Height - border; y += 15) { float pt = Util.MmToPoint(y); r.DrawLine(mainColor, 1, new PointF(borderpx, pt), new PointF(x2, pt)); } }
public override void Run( ) { // 1. Instantiate the source PDF file! string filePath = PromptFileChoice("Please select a PDF file to use as source"); using (var sourceFile = new File(filePath)) { // 2. Instantiate a new PDF file! File file = new File(); // 3. Source page combination into target file. Document document = file.Document; Pages pages = document.Pages; int pageIndex = -1; PrimitiveComposer composer = null; SizeF targetPageSize = PageFormat.GetSize(PageFormat.SizeEnum.A4); foreach (Page sourcePage in sourceFile.Document.Pages) { pageIndex++; int pageMod = pageIndex % 2; if (pageMod == 0) { if (composer != null) { composer.Flush(); } // Add a page to the target document! Page page = new Page( document, PageFormat.GetSize(PageFormat.SizeEnum.A3, PageFormat.OrientationEnum.Landscape) ); // Instantiates the page inside the document context. pages.Add(page); // Puts the page in the pages collection. // Create a composer for the target content stream! composer = new PrimitiveComposer(page); } // Add the form to the target page! composer.ShowXObject( sourcePage.ToXObject(document), // Converts the source page into a form inside the target document. new PointF(targetPageSize.Width * pageMod, 0), targetPageSize, XAlignmentEnum.Left, YAlignmentEnum.Top, 0 ); } composer.Flush(); // 4. Serialize the PDF file! Serialize(file, "Page combination", "combining multiple pages into single bigger ones", "page combination"); } }
public Sizes() { InitializeComponent(); foreach (var format in PageFormat.GetFormats()) { ListViewItem itm = new ListViewItem(format.Key); itm.SubItems.Add("" + format.Value.Width + "mm"); itm.SubItems.Add("" + format.Value.Height + "mm"); listView1.Items.Add(itm); } }
private static PaperKind MapPageFormat(PageFormat format) { switch (format) { case PageFormat.A4: return(PaperKind.A4); case PageFormat.Letter: return(PaperKind.Letter); } throw new ArgumentOutOfRangeException(nameof(format)); }
// GET: PageFormat/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } PageFormat pageFormat = db.PageFormat.Find(id); if (pageFormat == null) { return(HttpNotFound()); } return(View(pageFormat)); }
/// <summary> /// デフォルトコンストラクタ(Serialize用) /// </summary> private Page() { path = null; index = ""; locked = false; rotate = PageRotate.Rotate0; format = PageFormat.Undefined; clipLeft = 0; clipTop = 0; clipRight = 100; clipBottom = 100; bold = 0.0f; contrast = 0.0f; }
public async Task SendPages(IMessageChannel channel, PageFormat pageFormat) { var pagedContent = new PagedContent(_id++) { Pages = BuildPages(pageFormat), HasHiddenContent = pageFormat.HasHiddenColumns }; if (pagedContent.TotalPages == 0) { return; } if (pagedContent.HasHiddenContent) { pagedContent.RevealedPages = BuildPages(pageFormat.RevealedPageFormat); _revealEmoteDictionary.AddOrUpdate(pageFormat.RevealEmote, emote => new HashSet <int>(new[] { pagedContent.Id }), (emote, set) => { set.Add(pagedContent.Id); return(set); }); } var message = await channel.SendMessageAsync(pagedContent.Pages.First().Content); if (pagedContent.TotalPages == 1 && !pageFormat.HasHiddenColumns) { return; } if (!_pagedContentDictionary.TryAdd(message.Id, pagedContent)) { return; } //TODO This design will need to revisited if this bot is scaled up. //Right now, memory is being managed by preventing more than 100 concurrent page processes from being stored in RAM if (_pagedContentDictionary.Count > 100) { _pagedContentDictionary.Remove(_pagedContentDictionary.Keys.First(), out _); } if (pagedContent.TotalPages > 1) { await message.AddReactionAsync(new Emoji(ArrowBackward)); await message.AddReactionAsync(new Emoji(ArrowForward)); } if (pageFormat.HasHiddenColumns) { await message.AddReactionAsync(pageFormat.RevealEmote); } }
void createBackgroundList(Type current) { Assembly asm = Assembly.GetCallingAssembly(); List <Type> bgrTypes = new List <Type>(); List <string> names = new List <string>(); List <Bitmap> icons = new List <Bitmap>(); bgrTypes.Add(typeof(Backgrounds.BackgroundNull)); names.Add("None"); icons.Add(new Bitmap(PSIZE, PSIZE)); float iconFactor = 1.5f; foreach (Type t in asm.GetTypes()) { if (t.IsSubclassOf(typeof(Backgrounds.Background)) && t.GetCustomAttribute <Backgrounds.BName>() != null) { bgrTypes.Add(t); names.Add(t.GetCustomAttribute <Backgrounds.BName>().Name); PageFormat format = new PageFormat(Util.PointToMm(PSIZE) * iconFactor, Util.PointToMm(PSIZE) * iconFactor); Backgrounds.Background bgr = (Backgrounds.Background)t.GetConstructor(new Type[0]).Invoke(new object[0]); Bitmap bmp = new Bitmap(PSIZE, PSIZE); using (Graphics g = Graphics.FromImage(bmp)) { g.ScaleTransform(1 / iconFactor, 1 / iconFactor); bgr.Draw(g.GetRenderer(), format, 2, Color.LightGray, Color.Red); } icons.Add(bmp); } } iconlist.ImageSize = new Size(PSIZE, PSIZE); iconlist.Images.Clear(); lvBackgrounds.Items.Clear(); for (int i = 0; i < names.Count; i++) { iconlist.Images.Add(icons[i]); ListViewItem itm = new ListViewItem(names[i], i); itm.Tag = bgrTypes[i]; lvBackgrounds.Items.Add(itm); if (current == bgrTypes[i]) { lvBackgrounds.FocusedItem = itm; } } }
public override void Draw(BaseRenderer r, PageFormat format, float border, Color mainColor, Color secondaryColor) { PBrush brush = PBrush.CreateSolid(mainColor); r.BeginCircles(brush); for (float x = border; x < format.Width - border; x += 5) { float xpx = Util.MmToPoint(x); for (float y = border; y < format.Height - border; y += 5) { float ypx = Util.MmToPoint(y); r.Circle(xpx, ypx, 1); } } r.EndCircle(); }
/// <summary> /// Initializes a new instance of the <see cref="PdfStyling"/> class. /// </summary> /// <param name="fontName">Name of the font.</param> /// <param name="fontSize">Size of the font.</param> /// <param name="fontColor">Color of the font.</param> /// <param name="headerTitleFontSize">Size of the header title font.</param> /// <param name="headerTitleColor">Color of the header title.</param> /// <param name="paragraphSmallFontSize">Size of the paragraph small font.</param> /// <param name="paragraphSmallColor">Color of the paragraph small.</param> /// <param name="horizontalRuleColor">Color of the horizontal rule.</param> /// <param name="pageFormat">The page format.</param> /// <param name="orientation">The orientation.</param> /// <param name="margin">The margin.</param> /// <param name="showPageNumber">if set to <c>true</c> [show page number].</param> /// <param name="pageNumberAlignment">The page number alignment.</param> /// <param name="pageNumberMarginTop">The page number margin top.</param> /// <param name="tableStyling">The PDF table styling.</param> /// <exception cref="System.IndexOutOfRangeException">You have to define all 4 sites [top, right, bottom, left]</exception> public PdfStyling( string fontName = "Trebuchet MS", int fontSize = 10, Color?fontColor = null, int headerTitleFontSize = 18, Color?headerTitleColor = null, int paragraphSmallFontSize = 8, Color?paragraphSmallColor = null, Color?horizontalRuleColor = null, PageFormat pageFormat = PageFormat.A4, Orientation orientation = Orientation.Portrait, Unit[] margin = null, bool showPageNumber = true, ParagraphAlignment pageNumberAlignment = ParagraphAlignment.Right, int pageNumberMarginTop = 8, IPdfTableStyling tableStyling = null) { if (margin != null && margin.Length < 4) { throw new IndexOutOfRangeException("You have to define all 4 sites [top, right, bottom, left]"); } this.FontName = fontName; this.FontSize = fontSize; this.FontColor = fontColor.HasValue ? fontColor.Value : Colors.Black; this.HeaderTitleFontSize = headerTitleFontSize; this.HeaderTitleColor = headerTitleColor.HasValue ? headerTitleColor.Value : new Color((byte)255, (byte)96, (byte)96, (byte)96); this.ParagraphSmallFontSize = paragraphSmallFontSize; this.ParagraphSmallColor = paragraphSmallColor.HasValue ? paragraphSmallColor.Value : new Color((byte)255, (byte)166, (byte)166, (byte)166); this.HorizontalRuleColor = horizontalRuleColor.HasValue ? horizontalRuleColor.Value : Colors.Black; this.PageFormat = pageFormat; this.Orientation = orientation; this.Margin = margin == null ? new Unit[4] { Unit.FromCentimeter(2.5), Unit.FromCentimeter(2.5), Unit.FromCentimeter(2), Unit.FromCentimeter(2.5) } : margin; this.ShowPageNumber = showPageNumber; this.PageNumberAlignment = pageNumberAlignment; this.PageNumberMarginTop = pageNumberMarginTop; this.TableStyling = tableStyling == null ? new PdfTableStyling() : tableStyling; }
// GET: PageFormat/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ViewBag.GroupFormatList = GroupFormatList(); PageFormat pageFormat = db.PageFormat.Find(id); if (pageFormat == null) { return(HttpNotFound()); } return(View(pageFormat)); }
void render(string selected) { PageFormat format = PageFormat.GetFormats()[selected]; this.Format = format; SizeF s = format.GetPixelSize(); Bitmap bmp = new Bitmap((int)s.Width, (int)s.Height); Graphics g = Graphics.FromImage(bmp); g.Clear(Color.White); SizeF sX = new SizeF(s.Width, original.Height / (float)original.Width * s.Width); SizeF sY = new SizeF(original.Width / (float)original.Height * s.Height, s.Width); SizeF sS = (sX.Width < sY.Width) ? sX : sY; g.DrawImage(original, (s.Width - sS.Width) / 2f, (s.Height - sS.Height) / 2f, sS.Width, sS.Height); EditetImage = bmp; pbPreview.Image = bmp; }
public override void Draw(BaseRenderer r, PageFormat format, float border, Color mainColor, Color secondaryColor) { float borderpx = Util.MmToPoint(border); float lineHeight = 32; int numLines = (int)((format.Height - 2 * border) / lineHeight); float offset = 10; float lineDist = 3; for (int i = 0; i < numLines; i++) { for (int b = 0; b < 5; b++) { float pos = border + i * lineHeight + offset + b * lineDist; float pt = Util.MmToPoint(pos); r.DrawLine(mainColor, 1, new PointF(borderpx, pt), new PointF(format.GetPixelSize().Width - borderpx, pt)); } } }
private void btnCreate_Click(object sender, EventArgs e) { PageFormat pf = formats[cbPageFormat.Text]; KDocument doc = new KDocument(); KPage page = new KPage(doc); page.Format = pf; doc.DefaultFormat = cbPageFormat.Text; doc.Pages.Add(page); doc.SetCurrentStateAsSaved(); try { page.Filter = (ColorFilter)Enum.GetValues(typeof(ColorFilter)).GetValue(cbFilters.SelectedIndex); } catch (Exception) { } window.SetDocument(doc); Close?.Invoke(); }
private void method_1(CellSet cellSet_1, int int_1, int int_2, int int_3, float float_0) { this.cellSet_0 = cellSet_1; Parser parser = new Parser(cellSet_1); if (int_3 == 0) { int_3 = parser.Columns; } PageFormat pageFormat = parser.PageFormat; if (int_1 == 0) { int_1 = pageFormat.paperImageableWidth; } if (int_2 == 0) { int_2 = pageFormat.paperImageableHeight; } if (int_1 < 0) { int_1 = 999999999; } if (int_2 < 0) { int_2 = 999999999; } if (int_1 != 999999999) { int_1 = (int)(((float)int_1) / float_0); } if (int_2 != 999999999) { int_2 = (int)(((float)int_2) / float_0); } this.class8_0 = new Class9(cellSet_1, int_1, int_2, this.bool_1); this.class8_0.Int32_1 = int_3; this.int_0 = int_3; this.class8_0.isInEditor = this.bool_0; ((Class9)this.class8_0).bool_1 = this.bool_2; this.class8_0.vmethod_0(); }
/// <summary> /// Returns a page format object using all of the parameters set up by the builder /// </summary> /// <returns></returns> public PageFormat Build() { var formatBase = Build(false); var format = new PageFormat { HeaderLine = formatBase.HeaderLine, ContentLines = formatBase.ContentLines, HorizontalRule = formatBase.HorizontalRule, LinesPerPage = formatBase.LinesPerPage, RevealEmote = _revealEmote }; if (!_columnData.Any(cd => cd.IsHidden)) { return(format); } format.HasHiddenColumns = true; format.RevealedPageFormat = Build(true); return(format); }
void UpdatePageFormat(PageFormat value) { rbA4.Checked = value == PageFormat.A4; rbA5.Checked = value == PageFormat.A5; rbLetter.Checked = value == PageFormat.Letter; rbCustom.Checked = value == PageFormat.Custom; nudWidthMM.Enabled = rbCustom.Checked; nudHeightMM.Enabled = rbCustom.Checked; }
/// <summary> /// Gets the page's size and height for the given PageFormat. /// </summary> public static void GetPageSize(PageFormat pageFormat, out Unit pageWidth, out Unit pageHeight) { //Sizes in mm: pageWidth = 0; pageHeight = 0; int A0Height = 1189; int A0Width = 841; int height = 0; int width = 0; switch (pageFormat) { case PageFormat.A0: height = A0Height; width = A0Width; break; case PageFormat.A1: height = A0Width; width = A0Height / 2; break; case PageFormat.A2: height = A0Height / 2; width = A0Width / 2; break; case PageFormat.A3: height = A0Width / 2; width = A0Height / 4; break; case PageFormat.A4: height = A0Height / 4; width = A0Width / 4; break; case PageFormat.A5: height = A0Width / 4; width = A0Height / 8; break; case PageFormat.A6: height = A0Height / 8; width = A0Width / 8; break; case PageFormat.B5: height = 257; width = 182; break; case PageFormat.Letter: pageWidth = Unit.FromPoint(612); pageHeight = Unit.FromPoint(792); break; case PageFormat.Legal: pageWidth = Unit.FromPoint(612); pageHeight = Unit.FromPoint(1008); break; case PageFormat.Ledger: pageWidth = Unit.FromPoint(1224); pageHeight = Unit.FromPoint(792); break; case PageFormat.P11x17: pageWidth = Unit.FromPoint(792); pageHeight = Unit.FromPoint(1224); break; } if (height > 0) pageHeight = Unit.FromMillimeter(height); if (width > 0) pageWidth = Unit.FromMillimeter(width); }