Quantcast
Channel: dev.Bratched [en] » .NET
Viewing all articles
Browse latest Browse all 28

How to convert XHTML to PDF in C#

$
0
0

 

In this blog post I will illustrate how you could convert an XHTML page into PDF using the flying-saucer library. This is a Java library so we need to first step would be to convert it to a .NET assembly.

I will use the IKVM.NET Bytecode Compiler (ikvmc.exe) for this purpose. So go ahead and download both the flying-saucer library and the IKVM project. Then run the following command:

ikvmc.exe -target:library -out:CoreRenderer.dll iText-2.0.8.jar core-renderer.jar

This will generate the CoreRenderer.dll assembly which could be used. And finally we would create an application which would use it inside a console application:sourcecode395858614

 

One last step is to ensure that you have referenced the following assemblies:

 todelka1267959470

Those assemblies are part of the IKVM project and have dependencies on many other assemblies that are included with it. So the final folder should contain all those:

todelka21971161995

And that’s pretty much all. When you run the console application it should generate the output PDF file.


Viewing all articles
Browse latest Browse all 28

Trending Articles