Class HighlightAppearance
Controls the visual appearance of search result highlights.
public sealed class HighlightAppearance
- Inheritance
-
HighlightAppearance
- Inherited Members
Examples
Example 1: Default yellow highlight (no configuration needed).
using LMKit.Document.Search;
// The default appearance uses semi-transparent yellow with no border.
var appearance = new HighlightAppearance();
// appearance.Color => Color32(255, 255, 0, 80)
// appearance.BorderWidth => 0
Example 2: Custom red highlight with a visible border for PDF annotations.
using LMKit.Document.Search;
using LMKit.Graphics.Primitives;
var options = new SearchHighlightOptions
{
Appearance = new HighlightAppearance
{
Color = new Color32(255, 0, 0, 90), // Semi-transparent red
BorderWidth = 2.0f // 2pt border on PDF annotations
}
};
SearchHighlightResult result = await SearchHighlightEngine.HighlightAsync(
"contract.pdf", "penalty clause", options);
File.WriteAllBytes("contract_red_highlights.pdf", result.OutputData);
Example 3: Subtle blue highlight for image output.
using LMKit.Document.Search;
using LMKit.Graphics.Primitives;
var options = new SearchHighlightOptions
{
Appearance = new HighlightAppearance
{
Color = new Color32(100, 149, 237, 60) // Cornflower blue, low opacity
},
RenderZoom = 2.0 // Higher resolution for image output
};
SearchHighlightResult result = await SearchHighlightEngine.HighlightAsync(
"scan.pdf", "signature", options);
File.WriteAllBytes("scan_highlighted.pdf", result.OutputData);
Remarks
For PDF documents, the highlight is rendered as a standard text markup annotation
(subtype Highlight) whose color and border are controlled by this class.
For image documents, the highlight is rendered as a filled semi-transparent quadrilateral drawn on top of the rendered page.
Properties
- BorderWidth
Gets or sets the border width for PDF highlight annotations, in points. Set to 0 for no visible border. Has no effect on image output.
- Color
Gets or sets the highlight fill color including alpha transparency. For PDFs, sets the annotation color. For images, fills the overlay rectangle.