PDFsharp & MigraDoc Foundation
http://forum.pdfsharp.com/

PDFSharp - letter-spacing CSS not working
http://forum.pdfsharp.com/viewtopic.php?f=2&t=4216
Page 1 of 1

Author:  kris [ Tue Dec 29, 2020 10:56 pm ]
Post subject:  PDFSharp - letter-spacing CSS not working

Hi, I'm generating PDF from HTML using PDFSharp, but the letter-spacing HTML is not working:

Code:
h1 {
  text-align: center;
  font-size: 2.2em;
  letter-spacing: 3px;
}


Generating PDF like below:

Code:
    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:

Code:
<h1 style="letter-spacing:3px;">


If letter-spacing css is not supported, is there an alternative way for generate PDF from HTML? Thanks!!

Author:  () => true [ Mon Jan 04, 2021 9:11 am ]
Post subject:  Re: PDFSharp - letter-spacing CSS not working

Read this: http://forum.pdfsharp.net/viewtopic.php?f=2&t=832

Author:  TH-Soft [ Mon Jan 04, 2021 9:16 am ]
Post subject:  Re: PDFSharp - letter-spacing CSS not working

kris wrote:
Hi, I'm generating PDF from HTML using PDFSharp, but the letter-spacing HTML is not working
You do not use PDFsharp, you use HTML Renderer. Not our product, but maybe someone here can help.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/