Tag: wkhtmltopdf

C#html到pdf转换器使用wkhtmltopdf或任何其他免费工具

什么是在C#中将html转换为pdf的完美工具? 我通过stackoverflow.com找到了wkhtmltopdf。 但它不起作用。 在命令行中转换“www.google.com”时显示此消息。 C:\ Program Files \ wkhtmltopdf> wkhtmltoimage.exe www.google.com go.pdf 载入页面(1/2) 渲染(2/2) 错误:无法保存图像 完成 我还下载了EO.pdf,但不确定如何通过C#或命令行使用它。 只需要一个C#中的简单工具和指南,它可以将url或html soruce中的html转换为pdf。 提前致谢

带有重定向输入/输出流的HTML中的wkhtmltopdf相对路径将不起作用

我正在使用wkhtmltopdf.exe(版本0.12.0 final)从html文件生成pdf文件,我使用.NET C# 我的问题是只通过在html中指定相对路径来使javascript,样式表和图像工作。 现在,如果我使用绝对路径,我可以使用它。 但它不适用于相对路径,这使得整个html生成有点复杂。 我把我做的事情煮成了下面的例子: string CMDPATH = @”C:\Program Files\wkhtmltopdf\bin\wkhtmltopdf.exe”; string HTML = string.Format( “{2}”, “./sohlogo.png”, “./ACLASS.jpg”, DateTime.Now.ToString()); WriteFile(HTML, “test.html”); Process p; ProcessStartInfo psi = new ProcessStartInfo(); psi.FileName = CMDPATH; psi.UseShellExecute = false; psi.WorkingDirectory = AppDomain.CurrentDomain.BaseDirectory; psi.CreateNoWindow = true; psi.RedirectStandardInput = true; psi.RedirectStandardOutput = true; psi.RedirectStandardError = true; psi.Arguments = “-q – -“; […]

无法以pdf格式打印复选框

我们正在使用WkHtmlToPdf从html转换为pdf。 现在我也可以根据要求编辑所有表单字段。 由于WkHtmlToPdf在将Html转换为Pdf时存在错误,因此将所有表单字段的属性设置为Visible Not Printable。 为了解决这个问题,我们使用ITextSharp来读取由WkHtmlToPdf生成的现有pdf,并为每个表单字段将该属性设置为Visible。 这就是我这样做的方式 var pdfReader = new PdfReader(inputFilename); using (var outputStream = new FileStream(outputFilename, FileMode.OpenOrCreate)) { var stamper = new PdfStamper(pdfReader, outputStream); // Regenarating all the fileds using itextSharp. // Since wkHtmltoPdf has differnt default settings for pdf form fields (Visible and not Printable) var formFields = stamper.AcroFields; var filedNames = […]

云网络服务器上的wkhtmltopdf.exe System.Security.SecurityException。 如何覆盖服务器安全策略

我希望我的网站有一个function,可以打印PDF格式的页面内容。 我尝试了一些选项,但最好的匹配是wkhtmltopdf,因为它也处理多语言字符。 我让它在我的本地服务器上工作,但当我将它上传到云服务器上进行托管时,它给了我以下错误 Security Exception Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application’s trust level in the configuration file. Exception Details: System.Security.SecurityException: Request failed. 我将安全策略更改为web.config 但它仍然无法正常工作 测试url为http://www.noor.com.asp1-20.dfw1-2.websitetestlink.com/ArticleDetails.aspx?Language=en-US&PageID=19&ArticleID=4 您可以单击背面的下载链接,此下载链接将网页的特定部分转换为PDF。 它在本地服务器上运行正常,但由于Web服务器上的安全原因而无法正常工作。 我已经找了几天让PDF工作,现在它不能在Web服务器上运行。 我尝试了其他选项,但他们iText由于某种原因它没有转换阿拉伯语它只是为阿拉伯语版本的页面打印垃圾字符。 请告知我应该改变什么以使其正确。 我使用c#开发了这个网站使用c# […]

TuesPechkin无法加载DLL’wkhtmltox.dll’

我一直在使用TuesPechkin已经有一段时间了今天我将nuget包更新到新版本2.0.0+并注意到Factory.Create()不再解决了,所以我去了GitHub阅读所做的更改并注意到它现在期望到dll的路径? IConverter converter = new ThreadSafeConverter( new PdfToolset( new StaticDeployment(DLL_FOLDER_PATH))); 在过去的几个小时里,我已经尝试了几乎所有我能想到的路径,“\ bin”,“\ app_data”,“\ app_start”等,我似乎无法找到或弄清楚它想要什么路径和什么DLL? 我可以在我的bin文件夹中看到TuesPechkin dll,这是我尝试的第一条路径,但是我收到以下错误: 其他信息:无法加载DLL’wkhtmltox.dll’:找不到指定的模块。 (HRESULTexception:0x8007007E) 那个dll在哪里,现在我可以得到它,因为库似乎不包含它,我尝试安装TuesPechkin.Wkhtmltox.Win32包,但dll仍然无处可寻。 另外我在asp.net网站项目中使用它,所以我假设使用以下内容应该可以用于获取路径,对吧? var path = HttpContext.Current.Server.MapPath(@”~\bin\TuesPechkin.dll”); 更多信息: https : //github.com/tuespetre/TuesPechkin/issues/57

如何使用wkhtmltopdf将html作为字符串传递?

如何使用asp.net,c#将wtml作为字符串而不是wltmltopdf中的url传递?