PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Tue Apr 13, 2021 2:33 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Tue Dec 29, 2020 10:56 pm 
Offline

Joined: Tue Dec 29, 2020 10:45 pm
Posts: 2
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!!


Top
 Profile  
Reply with quote  
PostPosted: Mon Jan 04, 2021 9:11 am 
Offline
PDFsharp Expert
User avatar

Joined: Wed Dec 09, 2009 8:59 am
Posts: 323
Read this: http://forum.pdfsharp.net/viewtopic.php?f=2&t=832

_________________
Ă–hmesh Volta ("() => true")
PDFsharp Team Holiday Substitute


Top
 Profile  
Reply with quote  
PostPosted: Mon Jan 04, 2021 9:16 am 
Offline
PDFsharp Expert
User avatar

Joined: Sat Mar 14, 2015 10:15 am
Posts: 631
Location: CCAA
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.

_________________
Best regards
Thomas
(Freelance Software Developer with several years of MigraDoc/PDFsharp experience)


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 15 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group