How to get shadow text in PDF?

Dear Team,

How to get shadow text in PDF? Please refer the attached screenshot.

Thanks & regards,


Hi, this is certainly possible to do using our ElementBuilder class.

The easiest is to create the text twice. This is for example how MS Word will export drop shadow text to PDF. The first instance of the character would be the shadow, and then the second time the foreground. However this complicates PDF text extraction, as the same text is in twice. Fortunately PDFNet is really good at detecting this and returns just the one instance; “25” in this case. However other PDF readers can very well return “2255” instead. This means searching for “25” will find nothing.

The other option is to add the shadow as vector paths, using Font.GetGlyphPath to get the raw paths. This requires more complicated positioning, though it is covered in other forum posts. The other downside to this is it will bloat the file size if there is lots of drop shadow text. In which case you would want to put each shadow text character into a Form Xobject so that the paths can be reused through out the document. However this adds even more coding that is required.

The other option is to create the drop shadow text in some other program, such as Word, and import to PDF.

You might want to explain what you are doing now, what you want to do, and why, and I can offer more advice.