Jacob
Jacob

Reputation: 75

WKHTMLTOPDF configuration in a .NET 5 project

I am using a wkhtmltopdf plugin in my .NET 5 MVC project and can't seem to find where to input the configuration.

In the docu it reads that I need to put the params into a command line, however I do not have the program installed and simply just use it in my project via dependency injection.

Here is the Solution Explorer in VS: Project tree

I use the plugin this way: Services config in Startup.cs

Inserting the commands into the cmd line in VS does nothing. Aside from this, the plugin works like a charm!

Thank you for any hints. Cheers!

Upvotes: 1

Views: 516

Answers (1)

Jacob
Jacob

Reputation: 75

In .NET, you just need to do for example:

 ConvertOptions option = new();
 option.PageMargins.Bottom = 0;
 option.PageMargins.Top = 0;
 option.PageMargins.Left = 0;
 option.PageMargins.Right = 0;
 _generatePdf.SetConvertOptions(option);

To set the options.

Upvotes: 1

Related Questions