Reputation: 35
I'm generating PDF from HTML using HTML Renderer, but the letter-spacing HTML is not working:
h1 {
text-align: center;
font-size: 2.2em;
letter-spacing: 3px;
}
Generating PDF like below:
var config = new PdfGenerateConfig();
config.PageOrientation = PageOrientation.Landscape;
config.PageSize = PdfSharpPageSize.A4;
string cssStr = File.ReadAllText(folderPath + "1.css");
CssData css = PdfGenerator.ParseStyleSheet(cssStr);
PdfSharp.Pdf.PdfDocument pdf = PdfGenerator.GeneratePdf(html, config, css);
MemoryStream stream = new MemoryStream();
pdf.Save(stream, false);
byte[] bytes = stream.ToArray();
File.WriteAllBytes(folderPath + "document.pdf", bytes);
Also tried inline CSS style, also not working:
<h1 style="letter-spacing:3px;">
Upvotes: 0
Views: 491
Reputation: 1
Maybe one of these links could be useful?
It seems as if you have to use the 'XTextFormatter' class to adjust word spacing in PDFsharp
I haven't tested it, but it seems the solution to your problem.
Upvotes: -1