PDF Generation Template Editor
Open-source visual PDF generation engine with customizable templates and developer-friendly APIs.
Open-source visual PDF generation engine with customizable templates and developer-friendly APIs.
You can set the default properties of annotations in the Web PDF Viewer. The following code shows you how to set the default properties of annotations:
// You can get all tools
const toolNames = Object.keys(documentViewer.getToolModeMap());
// You can also get the styles of a specific tool, for example, the free text tool.
const freeTextTool = documentViewer.getTool(Tools.ToolNames.FREETEXT);
const textToolStyles = { ...freeTextTool.defaults };
// Set the default properties of free text annotations.
freeTextTool.setStyles({
Font: 'Helvetica',
RichTextStyle: { 0: { 'font-style': 'normal', 'font-weight': 'normal' } },
FontSize: '14pt',
TextAlign: 'left',
TextColor: new Annotations.Color(0, 0, 0),
StrokeThickness: 0,
StrokeColor: new Annotations.Color(0, 0, 0),
StrokeStyle: 'solid',
FillColor: null, // No fill.
Opacity: 1
});