I'm trying to print a WPF canvas over multiple pages.
I'm perfectly happy with scaling it to fit on the page width, then clipping and translating the canvas for each page; all pretty simple maths.
What I don't understand is how I get the dimensions of the printable area, and how to tell the printer where to print to. Whatever I try it appears the values I'm using are the size of the paper, and i therefore get cropping occurring as the printer cant print right to the edge of the paper.
var capabilities = printDialog.GetPrintCapabilities(dialog.PrintTicket);
capabilities has the following properties:
capabilities.PageImageableArea.ExtentWidth
// "Gets the width of the imageable area"
What is the "imageable" area? is that the area on the paper in which I can put content? I guess so because:
capabilities.PageImageableArea.OriginWidth
// Gets the distance from the left edge of the page to the imageable area.
However what about the bottom and right margins? Where do I find this information?
What should the PageSize
property of the DocumentPaginator
be set to? Should I set this from capabilities.PageImageableArea
? Or does the dialog.Print()
function set this, and i just need to read from it in GetPage()
?
Finally, when I return a DocumentPage
, what do I pass to the three geometry arguments pageSize
, bleedBox
and contentBox
?
Thanks :)