3

I'm working on the task to convert HTML to PDF. Our site is hosted on a Linux Docker container.

I tried many NuGet packages, from last week, but could not find a proper solution.

I tried all these packages:

  • Itextsharp
  • Select.Htmltopdf
  • wkhtmltopdf
  • hiqpdf

Can anyone suggest or show an example for a cross platform HTML to PDF conversion library?

Thanks in advance.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Kiran Joshi
  • 1,758
  • 2
  • 11
  • 34
  • 1
    "didn't work" is not a good problem description. There are some libraries available (but asking for libraries is not a good question for stackoverflow). There are commercial products available and you could invoice an external app (e.g. headless browser). Note that many of those libs depend on Ghostscript which may be a problem due to its AGLP license. – Christoph Lütjen Jun 21 '21 at 08:30
  • I asked ghostscript sales for a commercial license and they recommended: https://www.activepdf.com/. Nice overview in the web: https://www.paperplane.app/blog/modern-html-to-pdf-conversion-2019/ – Christoph Lütjen Jun 21 '21 at 08:39
  • @ChristophLütjen I don't found any solution which was working on both platform. Windows as well as linux docker. If you any reference for same please share so I can implement in my task. – Kiran Joshi Jun 22 '21 at 06:37
  • 1
    You mentioned some options and afaik they should work on linux (and so inside your docker container) too. I already gave you two more options. You'll need to evaluate those options and if you have problems implementing one of them, come back and post a new question with all problem details that help others to understand your problem. – Christoph Lütjen Jun 22 '21 at 08:21
  • @KiranJoshi Have you found any solution for this, I'm also facing the same issue – Sachith Wickramaarachchi Feb 28 '22 at 03:25
  • @SachithWickramaarachchi no not yet. – Kiran Joshi Apr 01 '22 at 12:14
  • @KiranJoshi Is there some progress? – David Krásný Jul 16 '22 at 02:01
  • @DavidKrásný no buddy I have move to js for that. – Kiran Joshi Jul 18 '22 at 03:57

1 Answers1

1

I had the same problem and I used HakanL/WkHtmlToPdf-DotNet which is a wrapper for the wkhtmltopdf tool. The package includes all necessary binaries for running on Windows, Linux, MacOSX and Docker. I tested it on Windows and Linux with .NET 6 and it worked without any problems.

David Krásný
  • 112
  • 3
  • 10