PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

Drawing Text, Transparent brush is not Transparent PDFSharp
https://forum.pdfsharp.net/viewtopic.php?f=2&t=3774
Page 1 of 1

Author:  prw56 [ Wed Apr 25, 2018 4:22 pm ]
Post subject:  Drawing Text, Transparent brush is not Transparent PDFSharp

I am using the WPF build of PDFSharp, version 1.32.2608.0.

I am trying to draw transparent text over the top of an image (over the top of an image of text, so that the user can select the text).

I tried this:

Code:
gfx.DrawString(text, font, XBrushes.Transparent, x, y);


but the drawn text was white and clearly visible over the text in the image.

I tried creating my own brush with full transparency:

Code:
new XSolidBrush(XColor.FromArgb(0,255,255,255)


same result, if I changed the custom brush to a color other than white, it just draws the color and ignores the transparency value. I also tried using 255 as the transparency value just in case, same result.

How do I draw ACTUAL transparent text? Or some workaround that accomplishes what I said at the beginning?

Any help is appreciated.

Author:  Thomas Hoevel [ Wed Apr 25, 2018 4:29 pm ]
Post subject:  Re: Drawing Text, Transparent brush is not Transparent

Hi!

Welcome to the forum.

See also:
viewtopic.php?f=2&t=832

Author:  prw56 [ Wed Apr 25, 2018 4:35 pm ]
Post subject:  Re: Drawing Text, Transparent brush is not Transparent PDFSh

Sorry about that, I added some more details, let me know if anything else is missing or if my question needs more explaining.

Author:  TH-Soft [ Wed Apr 25, 2018 8:27 pm ]
Post subject:  Re: Drawing Text, Transparent brush is not Transparent PDFSh

Does the problem still exist with PDFsharp 1.50 RC2a?

Author:  TH-Soft [ Wed Apr 25, 2018 8:36 pm ]
Post subject:  Re: Drawing Text, Transparent brush is not Transparent PDFSh

Did you set the PDF version to 1.4 or higher?
Code:
if (document.Version < 14)
    document.Version = 14;

Source:
http://pdfsharp.net/wiki/ColorsCMYK-sample.ashx

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