Converting strokes to filled paths - IStrokerTransform
📌 Overview
Different rendering engines have different stroking abilities. XPS for example supports several stroking capabilities that PDF or SVG support, such as triangular line caps, using different start and end line caps, and the ability to mark sections of a path as non-stroking.
Further, XPS and most other renderers differ in how miters are treated, with XPS “clipping” miters to the miter limit where PDF and SVG renderers would simply bevel instead.
📗 Instructions
The IStrokerTransform filter provides a method for converting strokes to plain fills in all cases or only in certain circumstances, with the aim of modifying content so that it is reliably reproduced when subject to third-party conversion or rendering.
🪜 Steps
Create the transform: Simply use
IStrokerTransform::create().Apply settings if needed: For example you may want to set the following depending on your use case.
strokerTransform->setupForPDFStyleOutput();
strokerTransform->setConvertAllStrokes(true);
Apply the transform to the page: Simply use
strokerTransform->transformPage(page);
⌨️ Code Examples
Two examples are reproduced here in C++ and C#. You can also find them on our GitHub Gists page. See StrokerTransform.cpp, StrokerTransform.cs.
C++ | C# |
|---|---|
CPP
|
C#
|
☑️ Conclusion
The IStrokerTransform filter is an essential tool for converting strokes to filled paths, ensuring consistent rendering across different platforms. By following the outlined steps and utilizing the provided code examples, users can effectively manage and transform stroke data for reliable reproduction.
📚 Additional Resources
If you need additional help, see our API documentation for detailed information on class/method usage, or raise a support ticket via our customer portal.