PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Sat Nov 09, 2024 1:58 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Tue Aug 20, 2024 3:04 pm 
Offline

Joined: Fri Aug 09, 2024 6:21 pm
Posts: 4
Hi all,

Currently using PDFSarp 1.50 (and would like to stick to it...)

Is there a way to combine string format values when creating a PDF text? My application allows to display texts that can be bold, italic, underlined and strikethrough all at the same time. But the current XFontStyle enum seems to only allow bold and italic at the same time.

Is there a way to create a text which would be, for example, bold and underlined at the same time?

Thanks in advance.


Top
 Profile  
Reply with quote  
PostPosted: Wed Aug 21, 2024 5:42 am 
Offline
PDFsharp Guru
User avatar

Joined: Sat Mar 14, 2015 10:15 am
Posts: 1007
Location: CCAA
Hi!
AlainM wrote:
But the current XFontStyle enum seems to only allow bold and italic at the same time.
No, that enum uses the magic keyword "[Flags]" and you can use the magic operator "|" to combine values to get what you want.

Two lines from the current PDFsharp version:
Code:
            var fontAnsi = new XFont("Arial", 15, XFontStyleEx.Regular | XFontStyleEx.Underline, XPdfFontOptions.WinAnsiDefault);
            var fontAnsiBold = new XFont("Arial", 15, XFontStyleEx.Bold | XFontStyleEx.Underline, XPdfFontOptions.WinAnsiDefault);


Note that "XFontStyle" was renamed to "XFontStyleEx".

With PDFsharp 1.50, you miss out all the bug fixes from the last 5 and a half years.

_________________
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  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: Bing [Bot] and 40 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