Skip to main content
 首页 » 编程设计

c#之如何在不通过 PrintDialog 的情况下获取给定 PrintQueue 的 PrintDocumentImageableArea

2024年02月24日20cmt

来自 MSDN(link):

The type PrintDocumentImageableArea has no public constructor. Hence, the variable documentImageableArea must be declared and assigned to Nothing and only then passed to the method. This method displays a PrintDialog requiring input from the user. After the user has selected a printer, paper size, and orientation and closed the dialog, documentImageableArea points to an actual object and its properties are initialized.

我有自定义打印对话框,需要获取给定 PrintQueue 和 PrintTicket 的 PrintDocumentImageableArea! (我需要 margin 我需要申请)

据我所知,除了最基本的应用程序之外,其他任何应用程序都使用自己的自定义打印对话框是很常见的。一定有办法获取这些信息!?

感谢任何意见!

请您参考如下方法:

使用PrintQueue的GetPrintCapabilities()方法,然后查询PageImageableArea。

更多信息在这里: http://msdn.microsoft.com/en-us/library/system.printing.printcapabilities.pageimageablearea(v=VS.90).aspx

这里: http://msdn.microsoft.com/en-us/library/ms552920.aspx