Drawing
View as MarkdownAdd a tiled watermark to PDF pages
This sample shows how to add a semi-transparent, rotated text watermark to every page of an existing PDF file. It demonstrates copying each source page's content into a new PDF with PdfReader, PdfWriter, and GraphicsContainer, then using TilingBrush to repeat rotated PlainText across the page as a watermark pattern.
Add Alpha Channel
Generates an elliptical alpha channel and applies it to the source image.
Add Alpha Channel (Memory Friendly)
Generates an elliptical alpha channel and applies it to the source image using memory-friendly Pipeline API.
Art text
Shows different types of art texts.
Artistic Frame
Draws artistic frame.
Autofit
Demonstrates how to fit the largest possible text inside a PathBoundedText area.
Bounded Text
Demonstrates how to use bounded text.
Colored Text
Renders formatted, multi-colored text onto a bitmap.
Colored Watermark
Demonstrates how to apply a colored watermark to an image using a tiling brush with text rendering.
Combine shapes with boolean path operations
This sample shows how to build new shapes from existing ones with the boolean operations of the Path class: Path.Union, Path.Intersect, Path.Subtract, and Path.Xor. These static methods leave their arguments unchanged and return a new path, so the same two source shapes can be combined in several ways. The result is real vector geometry, so it can be filled, stroked, written to PDF, or used as a clipping path.
Convert a dashed stroke into filled shapes
This sample shows how to turn the stroke of a path into an outline that can be filled, measured, or combined with other shapes, like "Outline Stroke" in vector editors. Path.Widen takes everything from a Pen: its width, line caps, joins, and dash pattern, so every dash of a dashed line becomes a closed shape of its own. This is what cutting, engraving, and embroidery software needs, as it follows outlines and knows nothing about strokes. Path.GetArea then gives the area the stroke covers.
Convert Clipping Path To Mask
Converts clipping path to alpha channel mask.
Convert Clipping Path To TGA
Reads image in JPEG format, converts clipping path to alpha channel and saves to TARGA 32 format.
Create a die-cut outline around artwork
This sample shows how to build the cut line of a sticker from the transparency of its artwork and write it to a print-ready PDF. Path.GetContour traces the outline of the opaque part of the image with sub-pixel accuracy, Path.Inflate grows it by the bleed and closes the narrow gaps between separate parts, Path.GetOuterContours drops the holes the cutter should not follow, and Path.FitCurves turns the traced polyline into smooth Bezier curves. The outline is stroked with a "CutContour" spot colour, the name cutting plotters and RIPs look for.
Create a PDF/X-4 file with CMYK output intent
This sample shows how to create a PDF/X-4 document with a CMYK output intent using GraphicsMill. It demonstrates how to load a CMYK print profile, configure an OutputIntent, initialize a PdfWriter with that intent, convert an RGB image to CMYK using color management, and draw it onto a PDF page together with a solid CMYK-filled shape.
Create Business Card
Creates business card in PDF format.
Create Clipping Path
Demonstrates how to create Adobe resource block with path from SVG file and save it to JPEG format.
Create Multipage PDF
Creates multipage PDF with personalized wedding invitations.
Create Vignette
Creates a vignette with a specified color.
Double Outline
Demonstrates how to draw a text with double outline.
Double Path Text
Demonstrates how to use double path text.
Draw Lists
Draws formatted text with ordered and unordered lists.
Draw On PDF With Spot Color
Fills a rectangle with a PANTONE color.
Draw Paragraphs
Draws formatted text with several paragraphs.
Draw Path
Draws path on Graphics.
Draw Spot On CMYK
Draws a text and an image on the spot channel, using the existing CMYK image as a background.
Draw text watermark on thumbnail image
This sample shows how to create a thumbnail image and draw a semi-transparent text watermark on top of it using the GraphicsMill transforms and advanced drawing APIs. It demonstrates how to resize the source image with the Resize transform, register a custom font, and render text with Drawer and PlainText. You can read more information about drawing in the documentation.
Draw Using Advanced Graphics
Performs drawing with AdvancedDrawing in the Pipeline API.
Draw With Clipping Path
Draws an image onto a Graphics object using a clipping path.
Fade and shape images with soft masks
This sample shows how to make parts of an item gradually transparent with a soft mask, the PDF way of masking that keeps both the item and the mask vector. A soft mask is a GraphicsContainer assigned to an item through its SoftMask property. With SoftMaskMethod.Luminosity the brightness of the mask sets the opacity: here a white-to-black gradient fades a photo out to the right. With SoftMaskMethod.Alpha only the transparency of the mask counts and its colours are ignored: here the alpha channel of a PNG gives a second photo the shape of a postage stamp.
Font API
Draws text without text objects, only with getting char info + simple metrics.
Font Fallback
Draws multilanguage text with font fallback support.
Font Metrics
Adds font to FontRegistry from file and shows its metrics.
Gradient Color
Demonstrates drawing text with a gradient fill.
Lay out paragraphs, lists, and tab-aligned columns in a PDF
This sample shows how to lay out a page of formatted text directly in a PDF using BoundedText's XML-based markup: regular paragraphs with first-line indentation and paragraph spacing, a bulleted list with custom line leading, and a two-column schedule where each session's title flows from the left and its time is pushed to a right-aligned tab stop by a dot leader, the classic layout of a printed program or table of contents.
Load fonts on demand with the FontMissing event
This sample shows how to start with an empty font registry and add only the fonts a design actually uses, at the moment it asks for them. When a font is requested by a PostScript name that is not registered, CustomFontRegistry raises the FontMissing event; the handler looks the name up in the application's own font catalog and adds the file with CustomFontRegistry.Add, and the request then succeeds. A server with a large font library no longer has to parse every font at startup.
Map template font names with aliases and remove fonts
This sample shows how to keep a font registry in step with a font library that changes while the application runs. CustomFontRegistry.Add reports for every face it reads a FontAddResult with the PostScript name and a status, for example AlreadyPresent when the same file is added twice. CustomFontRegistry.AddFontAlias attaches extra names to a registered font, so templates can refer to fonts by role ("Brand-Heading") rather than by file. CustomFontRegistry.Remove unregisters a font that was deleted from the library without rebuilding the registry, and PostscriptNameCollisionPolicy decides whether a new file with an already registered PostScript name replaces the old one.
Matrix Transform
Applies matrix transformation to graphics.
Overlay an Image onto Another Image
Apply a watermark image onto a base image using advanced graphics drawing features.
Path Bounded Text
Draws text that flows across text frames; a green ellipse serves as a wrapping path that excludes text from its area.
Path Text
Draws text on a path.
PDF Layers
Creates a PDF with layered content.
Plain Text
Demonstrates how to use plain text.
Reflected Text
Exhibits a possible technique for implementing a mirrored text effect.
Replace Process Color
Converts the specified process color into a spot color saving graphics container to the PDF format.
Save Spot Image To PDF
Saves an image with a spot color to PDF.
Show Custom Font Metrics
Adds font to FontRegistry from file and shows its metrics.
Subscript and Superscript
Draws subscript and superscript text.
Text Effects
Demonstrates how to use shadow and glow effects for drawing text.
Text Frames
Render text in multiple columns and along a path using the Frames collection.
TIFF Extra Channels To Spot Color Space
Converts a TIFF file with extra channels to PDF with separation color space.
Vertical Text
Draws different vertical texts.
Visualize Clipping Path
Visualizes clipping path for demonstration purposes.
Wrapping Paths
Illustrates the utilization of wrapping paths for excluding specific regions for text layout.
Write Animated Gif
Writes simple animated image in GIF format.
Write Animated WebP
Writes simple animated image in WebP format.
Write raster and vector graphics to EPS
Saves raster and vector graphics to EPS format.
Write Raster And Vector Graphics To PDF
Saves raster and vector graphics to PDF format.
Write Text To PDF
Demonstrates writing text as PDF text.