We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to Apply Default PageSetting to Diagram

Thread ID:





38120 Dec 6,2005 11:53 AM UTC Dec 7,2005 11:33 PM UTC WinForms 1
Tags: Diagram
Asked On December 6, 2005 11:53 AM UTC

Hello Support, I want to apply my default page setting to the diagram on the application load. I tried this as given blow : PageSettings pageSetting = new PageSettings(); pageSetting.Landscape = true; pageSetting.PaperSize.PaperName = "A6"; activeDiagram.View.PageSettings = pageSetting; activeDiagram.View.Update(true); But when i run this code its giving me run time error saying "Can''t change the paper size unless its kind is custom" and when i cannot change the PaperSize.Kind property to custom as it is readonly property. pageSetting.PaperSize.Kind = PaperKind.Custom; Can u suggest me how to apply the these custom page setting properties to the diagram /Ratan

Administrator [Syncfusion]
Replied On December 7, 2005 11:33 PM UTC

Hello Ratan, This is the expected behavior of the .NET Printing infrastructure. You can change the paper size attributes (width/height/papername) only if the PaperSize is a custom type that you created. To specify any of the standard PaperSizes, you will have to get the supported sizes from the PrinterSetting''s PaperSizes collection, and choose the appropriate one. The following code should give you an idea on how to go about this issue, PageSettings pagesetting = new PageSettings(); if(pagesetting.PrinterSettings.IsValid) { PaperSize selectedsize = null; for (int i = 0; i < pagesetting.PrinterSettings.PaperSizes.Count; i++) { PaperSize currentsize = pagesetting.PrinterSettings.PaperSizes[i]; if(currentsize.PaperName == "A6") { selectedsize = currentsize; break; } } if(selectedsize != null) { pagesetting.Landscape = true; activeDiagram.View.PageSettings = pagesetting; activeDiagram.View.RefreshPageSettings(); activeDiagram.View.Update(true); } } This is purely a .NET issue, and you should be able to get more detailed information by referring to the MSDN documentation on the relevant classes. Thanks, Prakash Surendra Syncfusion Inc.,


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon