The Syncfusion native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
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
ADAdministrator Syncfusion Team 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.,