QuestPDF / QuestPDF

QuestPDF is a modern open-source .NET library for PDF document generation. Offering comprehensive layout engine powered by concise and discoverable C# Fluent API. Easily generate PDF reports, invoices, exports, etc.
https://www.questpdf.com
Other
11.67k stars 608 forks source link

International characters and catching rendering errors #684

Open davidkdb opened 11 months ago

davidkdb commented 11 months ago

Hi,

We have an issue with for example Chinese characters.

We have solved it for this specific scenario by using font fallback: .Fallback(x => x.FontFamily("Microsoft YaHei"))

Of course now the file will be 10MB if there are any Chinese chars in it. Is there a way to find a font that is smaller for Chinese? (Available or downloadable for Windows)

And the default now I guess is the Lato font. Does it support for example Cyrillic, and Arabic?

What is the best practice to support all (major) languages under the sun?

And is there a way to avoid 0 size PDF if rendering of something fails. Now if something fails, the file size is 0. Maybe skipping what is causing the rendering error....

Some more info: We are rendering on a Windows computer/server. So we stand quite freely with fonts.

user-named-void commented 11 months ago

There is already an issue about this, see #31, also there is a little writeup about font management in the documentation here and here

MarcinZiabek commented 11 months ago

And is there a way to avoid 0 size PDF if rendering of something fails. Now if something fails, the file size is 0. Maybe skipping what is causing the rendering error....

You can set the QuestPDF.Settings.CheckIfAllTextGlyphsAreAvailable setting to false on production environments. Link