There are two worlds in the windows priting system.
One is the metric/unit system in the GDI system, in which visuals, text, pictures are managed, manipulated, transformed in memory and rendered by the Video card.
With advent of WPF, a device independant visual system is unified. with this system, unit/metrics are measure in terms of physical unit, such as inch, millimeter.... The namespace which is related to printing in WPF world is System.Drawing.Printing;
While the other system is the printer device system, on which resolution, quality, fidelity varies across device to device. On this system, it is more often used that the system of pixels. The namespace is System.Printing;
So given a PageMediaSize (from System.Printing), and PaperSize (from System.Drawing.Printing), there is no wonder that you may do the following transformation if you want to find a match PaperSize for a given PagemediaSize.
//@Comment: find a matching PageSize given a list of PageSize and one System.Drawing.Print.PageMediaSize
//PrintQueue.UserTicket.PageMediaSize --> PaperSize -- consumed by --> VisualPaginator
//@param rotated: this is set to true if the PaperSize returned is a rotated one of the param pagemediaSize;
public static PaperSize FindMatchingPageMediaSize(PageMediaSize pageMediaSize, IList<PaperSize> paperSizes, out bool rotated)
{
if (pageMediaSize == null) throw new ArgumentNullException("pageMediaSize");
if (paperSizes == null) throw new ArgumentNullException("paperSizes");
rotated = false;
var widthInInch = Math.Round(pageMediaSize.Width.Value / 96 * 100);
var heightInInch = Math.Round(pageMediaSize.Height.Value / 96 * 100);
var paperSize = paperSizes.FirstOrDefault(p => p.Width == widthInInch && p.Height == heightInInch);
if (paperSize == null)
{
paperSize = paperSizes.FirstOrDefault(p => p.Width == heightInInch && p.Height == widthInInch);
if (paperSize != null) rotated = true;
}
if (paperSize != null)
return paperSize;
return null;
}
You may wonder why there is 96 in the code, it is just the DPI value that is standard in WPF or Printing?. Dived by 96 then multiple 100 will give you the width that Device Indepedant width (screen width) in WPF.
there is a good reading on the blog about "Where does 96 DPI come from in Windows?"
Glossary/Acronyms
DPI: Dots per inch
PPI: Pixels per inch
Em: unit of measurement
分享到:
相关推荐
信息及其特征”是教育科学出版社的高一《信息技术基础》第一章第一节的内容。由于这个内容理论性较强,如果只是由教师来讲,学生可能会觉得枯燥,所以我准备在教师的引导下,举出现象,让学生进行探讨,然后归纳获得...
资源分类:Python库 所属语言:Python 资源全名:qc-metric-aggregator-0.1.3.tar.gz 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
《全面解析:Key Metric Software FolderSizes v4.8.1.72——高效磁盘空间管理工具》 在数字化时代,计算机硬盘空间的管理和优化变得至关重要。Key Metric Software的FolderSizes是一款专业且实用的磁盘空间分析...
Software Testing and Continuous Quality Improvement <br>SECTION I SOFTWARE QUALITY IN PERSPECTIVE . . . . . . . . . . . . . . . 1 1 Quality Assurance Framework. . . . . . . . . . . . . . . . . ....
ANSI B18.16.3M - Property Class 5 and 10 - Metric M12 x 1.75 金属类型.prt
资源分类:Python库 所属语言:Python 资源全名:metric_visualizer-0.3.19-py3-none-any.whl 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
资源分类:Python库 所属语言:Python 资源全名:pytorch_metric_learning-1.1.1.dev0-py3-none-any.whl 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
TMT批量数据报告滑梯怎么跑./activator run./activator "backend/runMain tmt.app...metric1 dev"./activator "backend/runMain tmt.app.Main rotator rotator1 dev"./activator "backend/runMain tmt.app.Main science...
metrics-server/metrics-server:v0.5.0 已打包 docker load -i metric-serverv0.5.0.tar && docker image ls
3. 在路由器上配置静态路由条目,包括目标网络的IP地址、子网掩码、网关IP地址和Metric值。 4. 验证静态路由的配置是否正确,可以通过ping命令或traceroute命令来测试网络连接。 RIP(Routing Information Protocol...
为了监控Elasticsearch的运行状态,可以使用Metricbeat的Prometheus模块,它能够收集Elasticsearch的性能指标,并通过Prometheus联合API或直接连接到Prometheus服务器获取数据。Elasticsearch版本7以后,集群安全...
sudo nano /etc/systemd/system/metricbeat.service ``` 在这个文件中,添加类似以下内容: ``` [Unit] Description=metricbeat service After=network.target [Service] Type=simple User=root ...
Call it with `./deploy/customization path_to_graph path_to_overlay_graph metric_output_directory metric_type`. We currently support the following metric types: *hop* (number of edges traversed), *...
1.9.4 Thousand Astronomical Unit (TAU) Mission and Interstellar Mission Studies............................................................................. 40 1.10 System-Level Demonstrations ..........
Sensu-插件-Windows 功能性 这些文件为Windows系统提供了基本的检查和指标。 档案 Ruby bin / check-windows-cpu-load.rb bin / check-windows-disk.rb bin / check-windows-process.rb bin / check-windows-...
这个特定的版本"metricbeat-6.2.2-windows-x86_64.zip"是针对Windows 64位操作系统的 Metricbeat 实现。 在Elastic Stack中,Metricbeat的主要任务是定期采集系统、应用和服务的度量数据,如CPU利用率、内存使用...
Metricbeat是elastic下的项目,在5.1及之后的版本中支持对Docker的监控,需与EK配合使用能在界面上显示,也可直接将数据导入kafka中。