你需要的信息从结合PrintDocumentImageableArea与Measure和Arrange成员对您UIElement:
// I could not find another way to change the margins other than the dialog
var result = printDialog.ShowDialog();
if (result.HasValue && result.Value)
{
var queue = printDialog.PrintQueue;
// Contains extents and offsets
var area = queue.GetPrintCapabilities(printDialog.PrintTicket)
.PageImageableArea;
// scale = area.ExtentWidth and area.ExtentHeight and your UIElement's bounds
// margin = area.OriginWidth and area.OriginHeight
// 1. Use the scale in your ScaleTransform
// 2. Use the margin and extent information to Measure and Arrange
// 3. Print the visual
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4356 次 |
| 最近记录: |