- Add Long Term Validation (LTV) data to an existing signature
- How to downscale all images in a PDF
- How to generate and export certificates
- How to downscale all images in a PDF
- Add Stamp to PDF
- How to reduce PDF file size
- Highlight fields in PDF
- Add a note to PDF
- Resize PDF pages
- Extract glyph boxes from PDF
- Use TrueType font collections
- Layout text with MultilineTextShape
- Merge PDF files in C# .NET
- How do I extract page destinations from bookmarks?
- Clip PDF page content in C#
- Fill PDF form
- Extract glyphs and sort by reading order
- Add bookmarks to PDF
- How to scale content of PDF
- Create rectangles with rounded corners
- Create text with decorations
- TIFF to PDF C#
- Crop content on a PDF page
- How to embed files in a PDF document
- Remove graphics from PDF
- Change the color inside a PDF
- Import FDF into PDF
- Flatten PDF form
- Digitally sign a PDF form in C# or VB.NET
- Vector graphics in PDF
- Translate PDF page content
- Extract graphics from PDF
- Determine the content bounding box
- Search text in PDF
- Convert PDF to plain text
- Flatten Markup Annotation
- Add text field to PDF
- Extract embedded files from PDF
- Extract images from PDF
- Add a Diagonal Watermark to PDF in C#
- Fit image to PDF page
- Add simple html text to PDF
- Add multiline text to a PDF document
- Add single-line text to PDF
- Create a new digitally signed PDF document
- PDF Viewer Preferences
- Change page orientation PDF
- Split PDF pages in C# and VB.NET
- Append two or more existing PDF files
- Determine if a PDF only contains images
- Add footer to PDF
- Convert SVG to PDF
- Add hyperlink to PDF
- Rotate a PDF page
- Change the formatting of a numeric field
- How to mirror PDF pages and other shapes
- Fill in a template PDF document
- How to add autosized text to PDF
- Create formfields in PDF documents
- Export FDF from PDF form
- Add a link with an internal destination to PDF
- Remove PDF security settings
- Add a link to PDF with an external destination
- How to sign and verify updates to a PDF document
- Embed TrueType font
- How to create a tiling for shapes in PDF
- EMF to PDF as vector image
- Replace field with image
- Add a rubber stamp annotation with a custom icon
- Create a text annotation in PDF with rich text
- Read and write meta data from PDF
- Create a custom signature handler to sign and verify PDF documents
- Download and convert image to PDF
- Add barcodes to PDF
- Tagged PDF
- PDFKit.NET 5.0 - detailed changes to the API
- Create tagged PDF
- PDFKit.NET 5.0 and .NET Core
- PDFKit.NET 5.0 and Xamarin
- Dynamic XFA
- PDFKit.NET 5.0 .NET Standard API
- .NET Core console app on MacOS
- Add tags to existing PDF
- Read PDF tags
- Merge XDP data with dynamic XFA form
- Fill XFA form and export XDP data
- Fill and save dynamic XFA form
- Use PDFKit.NET 5.0 with a Xamarin.Forms app
- Use multiple licenses
- Licensing and .NET Standard
- Reduce PDF size
- Disable submit button after submitting
- Write Document to HttpResponse
Create text with decorations
Create a document with text with decorations like gradient color, shadow, emboss and glow
Gradients
With CreatePaths of the TALLcomponents PDF kit you can get the paths of any glyph of any font (these paths are the outline information, it is used to draw a glyph). Using these paths, you can use the pen and brush to add some decoration to what normally be just a plain text. In this example a pen and a gradient brush is used to give text a little more color:
Color colorPen = new RgbColor(0, 100, 0);
Color colorTop = new RgbColor(240, 230, 140);
Color colorBottom = new RgbColor(85, 107, 47);
Brush brush = new AxialGradientBrush(colorBottom , colorTop, 0, 0, 0, size);
Pen pen = new Pen(colorPen, 1);
FreeHandShape charAsShape = new FreeHandShape { Pen = pen, Brush = brush };
charAsShape.Paths.AddRange(usedFont.CreatePaths('b', size));
Dim colorPen As Color = New RgbColor(0, 100, 0)
Dim colorTop As Color = New RgbColor(240, 230, 140)
Dim colorBottom As Color = New RgbColor(85, 107, 47)
Dim brush As Brush = New AxialGradientBrush(colorBottom, colorTop, 0, 0, 0, size)
Dim pen As New Pen(colorPen, 1)
Dim charAsShape As New FreeHandShape() With { _
Key .Pen = pen, _
Key .Brush = brush _
}
charAsShape.Paths.AddRange(usedFont.CreatePaths("b"C, size))
Shadow
Of course, these paths can be added twice to the PDF document, so that there are to glyphs on top of each other. If the bottom one is scaled a bit, moved a little to right down and painted with shadow colors the result will be a text with shadows like:
Apply a transformation on the paths of the glyphs this way:
// scale and position the bottom glyph that is the shadow
charAsShape.Transform = new TransformCollection
{
new ScaleTransform(1.04, 1.04),
new TranslateTransform(2, 3)
};
' scale and position the bottom glyph that is the shadow
charAsShape.Transform = New TransformCollection() From { _
New ScaleTransform(1.04, 1.04), _
New TranslateTransform(2, 3) _
}
Emboss
You can create an emboss effect with three glyphs on top of each other:
- First draw a background rectangle around the text using the text color.
- Then oversize the text by using a dark fat pen, this will be the shadow part.
- Next, overwrite parts of the shadow with highlight color, slightly moved down-right.
- Finally draw the actual text on top with solid color.
What you get is:
Glow
With many glyphs on top of each other you can create a glow effect. Draw several layes of the same text, the lower layers are increasingly fattened (using a thicker pensize), and are increasingly more transparent:
ShapeCollection shapes = new ShapeCollection(0, 0, 100, 50);
double[] Opacities = { 255, 128, 64, 32, 16, 8, 4 };
const double overSizeStep = 1.4;
double offsetY = usedFont.BaselineOffset * fontsize;
double offsetX = 4;
foreach (char c in text)
{
FreeHandPathCollection glyphPaths = usedFont.CreatePaths(c, fontsize);
for (int i = 6; i >= 0; i--)
{
FreeHandShape charStack = new FreeHandShape();
if (i == 0) charStack.Brush = new SolidBrush(colorText);
charStack.Opacity = Opacities[i];
charStack.Pen = new Pen(colorGlow, 1 + (i * overSizeStep));
charStack.Pen.MiterLimit = 4;
charStack.Paths.AddRange(glyphPaths);
charStack.Transform = new TranslateTransform(offsetX, offsetY);
shapes.Add(charStack);
}
offsetX += usedFont.CalculateWidth(c.ToString(), fontsize);
}
Dim shapes As New ShapeCollection(0, 0, 100, 50)
Dim Opacities As Double() = {255, 128, 64, 32, 16, 8, _
4}
Const overSizeStep As Double = 1.4
Dim offsetY As Double = usedFont.BaselineOffset * fontsize
Dim offsetX As Double = 4
For Each c As Char In text
Dim glyphPaths As FreeHandPathCollection = usedFont.CreatePaths(c, fontsize)
For i As Integer = 6 To 0 Step -1
Dim charStack As New FreeHandShape()
If i = 0 Then
charStack.Brush = New SolidBrush(colorText)
End If
charStack.Opacity = Opacities(i)
charStack.Pen = New Pen(colorGlow, 1 + (i * overSizeStep))
charStack.Pen.MiterLimit = 4
charStack.Paths.AddRange(glyphPaths)
charStack.Transform = New TranslateTransform(offsetX, offsetY)
shapes.Add(charStack)
Next
offsetX += usedFont.CalculateWidth(c.ToString(), fontsize)
Next
Inverse
Of course it does not have to end here. You can draw a rectangle around the the glyphs and experiment with the FillRule, this way you get a opaque box with transparent text in it:
ShapeCollection shapes = new ShapeCollection(0, 0, 100, 50);
int size = 48;
Font font = Font.HelveticaBold;
Color colorPen = new RgbColor(0, 100, 0);
Color colorTop = new RgbColor(240, 230, 140);
Color colorBottom = new RgbColor(85, 107, 47);
Pen pen = new Pen(colorPen, 1);
Brush brush = new AxialGradientBrush(colorBottom, colorTop, 0, 0, 0, Size);
double offsetX = 0;
double offsetY = font.BaselineOffset * size;
RectangleShape outline = new RectangleShape(0, 0, width, height);
outline.Pen = new Pen(colorPen);
foreach (char c in "seethrough")
{
double width = font.CalculateWidth(c.ToString(), size);
double height = font.CalculateHeight(c.ToString(), size, width);
FreeHandShape charAsShape = new FreeHandShape { Brush = brush };
FreeHandPath glyphbox = new FreeHandPath(true);
glyphbox.Segments.Add(new FreeHandStartSegment(0, -offsetY));
glyphbox.Segments.Add(new FreeHandLineSegment(width + 0.5, -offsetY));
glyphbox.Segments.Add(new FreeHandLineSegment(width + 0.5, size));
glyphbox.Segments.Add(new FreeHandLineSegment(0, size));
charAsShape.Paths.Add(glyphbox);
charAsShape.Paths.AddRange(font.CreatePaths(c, size));
charAsShape.Transform = new TransformCollection() { new TranslateTransform(offsetX, offsetY)};
charAsShape.FillRule = FillRule.EvenOdd;
shapes.Add(charAsShape);
offsetX += width;
}
shapes.Add(outline);
Dim shapes As New ShapeCollection(0, 0, 100, 50)
Dim size__1 As Integer = 48
Dim font__2 As Font = Font.HelveticaBold
Dim colorPen As Color = New RgbColor(0, 100, 0)
Dim colorTop As Color = New RgbColor(240, 230, 140)
Dim colorBottom As Color = New RgbColor(85, 107, 47)
Dim pen As New Pen(colorPen, 1)
Dim brush As Brush = New AxialGradientBrush(colorBottom, colorTop, 0, 0, 0, Size)
Dim offsetX As Double = 0
Dim offsetY As Double = font__2.BaselineOffset * size__1
Dim outline As New RectangleShape(0, 0, width, height)
outline.Pen = New Pen(colorPen)
For Each c As Char In "seethrough"
Dim width As Double = font__2.CalculateWidth(c.ToString(), size__1)
Dim height As Double = font__2.CalculateHeight(c.ToString(), size__1, width)
Dim charAsShape As New FreeHandShape() With { _
Key .Brush = brush _
}
Dim glyphbox As New FreeHandPath(True)
glyphbox.Segments.Add(New FreeHandStartSegment(0, -offsetY))
glyphbox.Segments.Add(New FreeHandLineSegment(width + 0.5, -offsetY))
glyphbox.Segments.Add(New FreeHandLineSegment(width + 0.5, size__1))
glyphbox.Segments.Add(New FreeHandLineSegment(0, size__1))
charAsShape.Paths.Add(glyphbox)
charAsShape.Paths.AddRange(font__2.CreatePaths(c, size__1))
charAsShape.Transform = New TransformCollection() From { _
New TranslateTransform(offsetX, offsetY) _
}
charAsShape.FillRule = FillRule.EvenOdd
shapes.Add(charAsShape)
offsetX += width
Next
shapes.Add(outline)

We have sent an email with a download link.