html-renderer

Convert HTML to PDF using HtmlRenderer [closed]

妖精的绣舞 提交于 2019-12-12 07:39:33
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 11 months ago . I am looking to use HtmlRenderer to convert an HTML file to a PDF file. I have seen it being mentioned on several sites that it is possible. However, I don't seem to be able to find any basic sample code to do this. I have added the following NuGet package. Install-Package

Images don't display in PDF

旧城冷巷雨未停 提交于 2019-12-10 16:23:06
问题 I have a fairly simple HTML page rendered via asp.net. It looks beautiful in the PDF after running it through HtmlRenderer.PdfSharp EXCEPT that the images don't appear. Just the red X of a missing image in the PDF even though the web page itself does display the image correctly. Here is my HtmlRenderer.PdfSharp code: public void BuildPDF( string url, string pdfPath ) { string html = GetHTML(url); Byte[] res = null; using( MemoryStream ms = new MemoryStream() ) { using( FileStream file = new

How to Page Break HTML Content in HTML Renderer

帅比萌擦擦* 提交于 2019-12-06 06:43:41
问题 I have a project where HTML code is converted to a PDF using HTML Renderer. The HTML code contains a single table. The PDF is displayed but the issue is that the contents of the table are cut off at the end. So is there any solution to the problem? PdfDocument pdf=new PdfDocument(); var config = new PdfGenerateConfig() { MarginBottom = 20, MarginLeft = 20, MarginRight = 20, MarginTop = 20, }; //config.PageOrientation = PageOrientation.Landscape; config.ManualPageSize = new PdfSharp.Drawing

Problem loading images into PDF using HtmlRenderer.PdfSharp

左心房为你撑大大i 提交于 2019-12-02 23:24:27
问题 This is a bit of a longshot, but maybe someone might have some ideas. For reference - see Images don't display in PDF, a similar question. I'm using the Htmlrenderer.PdfSharp library to create PDF files from HTML content. Everything works perfectly, with the sole exception of the images. They simply display a big red box. The PDF works fine when running locally in debug mode, but not when deployed on the server. I've a small bit of extra information that might help - when executing the

HTML to PDF - page break with PdfSharp and HtmlRenderer

拈花ヽ惹草 提交于 2019-11-30 12:50:29
问题 I try to convert HTML to PDF using PdfSharp and HtmlRenderer. This is part of code: private byte[] CreateHtmlContent() { string htmlContent = File.ReadAllText(@"htmlExample.txt"); using (MemoryStream ms = new MemoryStream()) { PdfDocument pdfDocument = new PdfDocument(); PdfDocument pdf = PdfGenerator.GeneratePdf(htmlContent, PdfSharp.PageSize.A4, 60); pdf.Save(ms); res = ms.ToArray(); } return res; } Everything works fine except page break. On some pages I have result like on this image Is