c# - WPF Print XAML Control -


I am trying to add print function to a WPF project. The user can add and remove text in the text box or other controls on the runtime so that the size of the XML control is not fixed. If she clicks on the print button then I want to understand the size of the control and print (if necessary multidisciplinary document). This is my code so far

  Public Zero Print (Framework Element Element) {System.Windows.Controls.PrintDialog printDlg = new System.Windows.Controls.PrintDialog (); If (printDlg.ShowDialog () == true) {double height = element.ActualHeight; Double width = element.ActualWidth; Size page size = new size (printDlg.PrintableAreaWidth, printDlg.PrintableAreaHeight); //element.Measure (pageSize); //element.Arrange (new react (5, 5, pg. Wyeth, PageSite High.)); PrintDlg.PrintVisual (element, "this is an exam"); }}   

My idea is to check the actual height and width of the control. If I am larger than one of these pages, then I know that I have to print many pages. I'm pretty sure how to do it, but I think I'll have to use the XPSDocument class. Can someone help me, I do not know how I can divide my documents into many pages and print them and someone can tell me how to make a flawdod with my xaml code.

Thanks in advance!

By default, you can not print control over multiple pages, but you can manually can do. Here's the great article that solves your problem:

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -