Sukanya
Sukanya

Reputation: 1061

How to increase the font size in a pdf using c# with wkhtmltopdf?

A have created a pdf file from an .aspx page using the wkhtmltopdf converter. It's showing a smaller font size than the actual font shown on the page. So when I take the print out of the pdf file, it looks as if it has been compressed to a smaller size. Do any of you have any idea how can I set/increase the font size by number (14 or 15) or percentage using C# code? I'm using the string switches to fix the margin, page etc. as follows:

string switches = "";
switches += "--print-media-type ";
switches += "--margin-top 5mm --margin-bottom 5mm --margin-right 10mm --margin-left 30mm ";
switches += "--page-size A4 ";

Can you suggest how I can incorporate font size here? My page has different font types and sizes for different controls. I want to increase the font size for ALL elements (if possible, by some percentage).

Upvotes: 1

Views: 3777

Answers (2)

Sukanya
Sukanya

Reputation: 1061

The problem above can be solved by the following code:-- I added this line of code and the newly created pdf file has exactly the font size what I want.

switches +="--disable-smart-shrinking";

It'll stop font shrinking.

Upvotes: 2

thatwasbrilliant
thatwasbrilliant

Reputation: 521

If you can't edit the html/css before sending it to wkhtmltopdf, try the --minimum-font-size option. If that doesn't work, and you don't mind making everything bigger, there is also --zoom.

Upvotes: 1

Related Questions