PdfBlendMode

16 Dec 20251 minute to read

Public enum to define blend mode of the PDF page.

// Load an existing PDF document
let document: PdfDocument = new PdfDocument(data, password);
// Access first page
let page: PdfPage = document.getPage(0);
// Gets the graphics of the PDF page
let graphics: PdfGraphics = page.graphics;
// Create a new font
let font: PdfStandardFont = document.embedFont(PdfFontFamily.symbol, 10, PdfFontStyle.regular);
// Set the blend mode
graphics.setTransparency(0.5, 0.5, PdfBlendMode.hardLight);
// Draw the text
graphics.drawString('Hello World', font, {x: 10, y: 10, width: 100, height: 40}, new PdfBrush({r: 255, g: 0, b: 0}));
// Save the document
document.save('output.pdf');
// Destroy the document
document.destroy();
  • color - Specifies the type of color.
  • colorBurn - Specifies the type of colorBurn.
  • colorDodge - Specifies the type of colorDodge.
  • darken - Specifies the type of darken.
  • difference - Specifies the type of difference.
  • exclusion - Specifies the type of exclusion.
  • hardLight - Specifies the type of hardLight.
  • hue - Specifies the type of hue.
  • lighten - Specifies the type of lighten.
  • luminosity - Specifies the type of luminosity.
  • multiply - Specifies the type of multiply.
  • normal - Specifies the type of normal.
  • overlay - Specifies the type of overlay.
  • saturation - Specifies the type of saturation.
  • screen - Specifies the type of screen.
  • softLight - Specifies the type of softLight.