2

I'd need to create a pdf version of my HTML pages using .NET 4.0. Is there any good free tool I can use?

I've seen some commercial tools but not any good free ones; ITextSharp doesn't seem to be performing well or able to handle table formats, etc.

Bobrovsky
  • 13,789
  • 19
  • 80
  • 130
The Light
  • 26,341
  • 62
  • 176
  • 258

4 Answers4

3

We did extensive research (and testing) on this for a project in September 2011 and concluded that there were no tools that were both good (i.e. consistent, reliable rendering) and free.

avesse
  • 771
  • 1
  • 9
  • 20
2

http://code.google.com/p/wkhtmltopdf/ It's a console utility that'll do it for you.

Fedor Hajdu
  • 4,657
  • 3
  • 32
  • 50
  • You can use Process class from System.Diagnostics to execute it. – Fedor Hajdu Jun 11 '12 at 14:04
  • @TheLight - you can use [Process.Start](http://msdn.microsoft.com/en-us/library/system.diagnostics.process.start%28v=vs.110%29.aspx) to call an external program. – 48klocs Jun 11 '12 at 14:04
  • I'd need to install the tool separately on the server which is not easily possible... I'm looking for a .NET library so that I can add it to my application. thanks – The Light Jun 11 '12 at 14:30
0

Maybe you could try Amyuni WebkitPDF. It is free for personal and commercial use and it provides bindings for C# and C++.

Here is a screen capture of this page using this library: enter image description here

Usual disclaimer applies

yms
  • 10,361
  • 3
  • 38
  • 68
0

Aspose.Words Cloud SDK for .NET is a commercial product but its free trial plan provides 150 free monthly API calls. Maybe it suits your requirement. Its conversion is reliable and consistent.

// Get App Key and App SID from https://dashboard.aspose.cloud/
WordsApi wordsApi = new WordsApi(MyAppSid, MyAppKey);

var request = new ConvertDocumentRequest(
    document: File.OpenRead("C:/Temp/Test.html"),
    format: "pdf"
);

var result = wordsApi.ConvertDocument(request);
var fileStream = System.IO.File.Create("C:/Temp/Test.pdf");
result.CopyTo(fileStream);
fileStream.Close();

P.S: I'm developer evangelist at Aspose.

Tilal Ahmad
  • 940
  • 5
  • 9