[英]ABCpdf AddImageHtml text stretches without administrator rights
Problem: 问题:
When I run the same program admin vs. non-admin they produce different results. 当我以管理员和非管理员运行同一程序时,它们会产生不同的结果。
Example: 例:
As you can see without administrator rights the text gets stretched vertically. 如您所见,没有管理员权限,文本会垂直拉伸。
Code to reproduce: 复制代码:
var html = File.ReadAllText( "htmldata.txt" );
using( var doc = new Doc() )
{
doc.HtmlOptions.Engine = EngineType.Chrome;
doc.Page = doc.AddPage();
doc.AddImageHtml( html );
doc.Save( "testPDF.pdf" );
Console.WriteLine( $"DPI: {doc.Rendering.DotsPerInch}" );
Console.WriteLine( $"LOG: {doc.Rendering.Log}" );
Console.WriteLine( $"OPTIONS: {string.Join(Environment.NewLine, doc.Options)}" );
float dpiX, dpiY;
using( Graphics graphics = Graphics.FromHwnd( IntPtr.Zero ) )
{
dpiX = graphics.DpiX;
dpiY = graphics.DpiY;
}
Console.WriteLine( $"Transform: {doc.Transform.String}" );
Console.WriteLine($"DPI X:{dpiX}{Environment.NewLine}DPI Y:{dpiY}");
}
Process.Start( "testPDF.pdf" );
Console.ReadKey();
The contents of htmldata.txt is: htmldata.txt的内容为:
<body style='font-family:"Source Sans Pro"'>
some text on the page
</body>
Note 注意
I have done this without the style and it gives the same issue 我没有样式就这样做了,它也带来了同样的问题
What I've already tried: 我已经尝试过的:
Spotting differences in events (between Admin vs. Non-Admin) using: Process monitor , I could not spot an obvious difference besides paths. 使用以下方法发现事件(管理员与非管理员之间)的差异: 过程监视器 ,除了路径之外,我无法发现明显的差异。
Checking if the correct DLL is being used using: listDLLs , the correct DLL's are being used. 使用以下命令检查是否正在使用正确的DLL: listDLLs ,正在使用正确的DLL。
Checking the access to the %temp%
directory as the docs indicate that AddImageHtml
uses it to store HTML renders 检查对
%temp%
目录的访问,因为docs指示AddImageHtml
使用它来存储HTML渲染
As can be seen in the code I've tried comparing DPI and certain settings but they are all the same. 从代码中可以看出,我尝试比较DPI和某些设置,但它们都是相同的。
Note 注意
The reason I'm using AddImageHtml
instead of AddTextStyled
is because it supports more HTML (tables and such), so I can't use a different method (if it doesn't support most HTML). 我使用
AddImageHtml
而不是AddTextStyled
的原因是因为它支持更多的HTML(表等),所以我不能使用其他方法(如果它不支持大多数HTML)。 The users that use this can't get administrator rights either, this would compromise the system. 使用此功能的用户也无法获得管理员权限,这将损害系统。
I know that this is an old question but I've had a similar stretching issue using AbcPdf11 with Chrome Engine on some Windows 2012 R2 systems (under VMWARE) and I've fixed it by disabling Javascript: 我知道这是一个古老的问题,但是在某些Windows 2012 R2系统(在VMWARE下)上使用带有Chrome引擎的AbcPdf11时,我遇到了类似的问题,并且通过禁用Javascript进行了修复:
doc.HtmlOptions.UseScript = false;
I think that with JS enabled it tries to calculate automatically the BrowserWidth
based on some system settings. 我认为启用JS会尝试根据某些系统设置自动计算
BrowserWidth
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.