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
分享到:
相关推荐
Key.Metric.Software.FolderSizes.v4.8.1.72.Incl.Keymaker.and.Patch-ROGUE
信息及其特征”是教育科学出版社的高一《信息技术基础》第一章第一节的内容。由于这个内容理论性较强,如果只是由教师来讲,学生可能会觉得枯燥,所以我准备在教师的引导下,举出现象,让学生进行探讨,然后归纳获得...
资源分类:Python库 所属语言:Python 资源全名:qc-metric-aggregator-0.1.3.tar.gz 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
Software Testing and Continuous Quality Improvement <br>SECTION I SOFTWARE QUALITY IN PERSPECTIVE . . . . . . . . . . . . . . . 1 1 Quality Assurance Framework. . . . . . . . . . . . . . . . . ....
资源分类:Python库 所属语言:Python 资源全名:metric_visualizer-0.3.19-py3-none-any.whl 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
ANSI B18.16.3M - Property Class 5 and 10 - Metric M12 x 1.75 金属类型.prt
资源分类: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
1 Time—The Zeroth Performance Metric.................... 3 1.1 Introduction.......................................... 3 1.2 WhatIsTime?........................................ 4 1.2.1 PhysicalTime......
Bluetooth Secure Simple Pairing Usability Metric Whitepaper (1).pdf
Intelligent and Evolutionary Systems: The 20th Asia Pacific Symposium, IES 2016, Canberra, Australia, November 2016, Proceedings (Proceedings in Adaptation, Learning and Optimization) Over the last ...
1.9.4 Thousand Astronomical Unit (TAU) Mission and Interstellar Mission Studies............................................................................. 40 1.10 System-Level Demonstrations ..........
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), *...
Sensu-插件-Windows 功能性 这些文件为Windows系统提供了基本的检查和指标。 档案 Ruby bin / check-windows-cpu-load.rb bin / check-windows-disk.rb bin / check-windows-process.rb bin / check-windows-...
A system simulation model was used to create scene-dependent noise masks that reflect current performance of mobile phone cameras. Stimuli with different overall magnitudes of noise and with varying ...
Metricbeat是elastic下的项目,在5.1及之后的版本中支持对Docker的监控,需与EK配合使用能在界面上显示,也可直接将数据导入kafka中。
资源来自pypi官网。 资源全名:pytorch-metric-learning-0.9.89.dev0.tar.gz
UP BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) ...