Windowscommunitytoolkit: Add support for page breaks in PrintHelper

Created on 3 Apr 2017  路  9Comments  路  Source: windows-toolkit/WindowsCommunityToolkit

help wanted improvements services

Most helpful comment

  1. What I did for the PrintHelper was to ask the user to provide a canvas to host the rendering. This canvas can be set offscreen or under a panel by the dev.
  2. We could try a first version like this and then work on improving it in a 2nd version

All 9 comments

Is it possible, to add support for the PrintTaskOptionDetails.GetFromPrintTaskOptions, to create own print options?

@deltakosh paging requires measuring, and measuring requires rendering. It's a job that goes beyond the responsibility of a single PrintHelper class. You can get some inspiration here: https://github.com/XamlBrewer/XamlBrewer.Uwp.PrintService.

Why don't you think we could not extend the PrintHelper to do the same?

Or even integrate your brillant work :)

There are two issues that kept me from creating an easier reusable version of this framework:

  • You need read/write/delete access to the Visual Tree to render the controls on the print pages and measure them. This is hard if you don't know how the app's UI is build up. I do think that this can be done programmatically in the current UWP version (e.g. by opening an extra app window out of sight - a window provided by the printing framework), but I never tried this.
  • The entire paging algorithm is based on the capabilities of the RichTextBoxOverflow control. So any page that you want to print must have a RichTextBox as its root. In practice this means that the developer needs to define the pages twice: a version for the screen and a version for the printer. It would be nice to auto-generate a basic version of the RichTextBox-based version automatically and then let the developer fine-tune it, but I'm not sure that this can be done.
  1. What I did for the PrintHelper was to ask the user to provide a canvas to host the rendering. This canvas can be set offscreen or under a panel by the dev.
  2. We could try a first version like this and then work on improving it in a 2nd version

@deltakosh I don't mean to be pushy but can i know if you / someone is working on this? I am using Syncfusion pdf helper but Printing MarkdownTextBlock without Page Breaks is not so good.

We did not get to this for 2.0, we will try again for 2.1. We are also open to contributions if anyone wants to pick this up ;)

Added with #1964

Was this page helpful?
0 / 5 - 0 ratings