简体   繁体   English

ABCpdf AddImageHtml文本拉伸没有管理员权限

[英]ABCpdf AddImageHtml text stretches without administrator rights

Problem: 问题:
When I run the same program admin vs. non-admin they produce different results. 当我以管理员和非管理员运行同一程序时,它们会产生不同的结果。

Example: 例:

PDF问题

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: 我已经尝试过的:

  1. Spotting differences in events (between Admin vs. Non-Admin) using: Process monitor , I could not spot an obvious difference besides paths. 使用以下方法发现事件(管理员与非管理员之间)的差异: 过程监视器 ,除了路径之外,我无法发现明显的差异。

  2. Checking if the correct DLL is being used using: listDLLs , the correct DLL's are being used. 使用以下命令检查是否正在使用正确的DLL: listDLLs ,正在使用正确的DLL。

  3. Checking the access to the %temp% directory as the docs indicate that AddImageHtml uses it to store HTML renders 检查对%temp%目录的访问,因为docs指示AddImageHtml使用它来存储HTML渲染

  4. 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.

相关问题 AbcPdf不透明度AddImageHtml - AbcPdf Opacity AddImageHtml 在没有管理员权限的情况下终止父进程 - Kill parent process without administrator rights 在没有管理员权限的情况下运行WinForms应用程序? - Run WinForms application without administrator rights? 没有管理员权限的VSTO插件和运行时 - VSTO addin and runtime without administrator rights 是否可以安装将程序集放入GAC而无需管理员权限的程序? - Is it possible to install a program that puts assemblies into the GAC without administrator rights? Visual Studio 安装项目:在没有管理员权限的情况下运行 msi 安装程序 - Visual Studio Setup Project: Run the msi installer without administrator rights 如何在Windows 7操作系统中获得没有管理员权限的注册表项 - how to get registry key without having administrator rights in windows 7 OS 在运行时请求管理员权限 - Request Administrator Rights at Runtime 在C#中是否可以在没有管理员权限的情况下以只读方式打开另一台计算机的注册表? - Is it possible in C# to open the registry of another computer as read-only without administrator rights? 如何在Visual Studio 2022中创建C#应用程序安装程序,无需管理员权限即可安装? - How to create C# application installer in Visual Studio 2022, which can be installed without administrator rights?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM