Capture HTML before creating a PDF
Flatten a complex browser component into a predictable image for a single-page PDF or PDF-generation pipeline.
Capture the component to PNG or Blob, then pass that image to your PDF library.
Capture the certificate as a PNG
Install @zumer/snapdom, select the rendered element, and capture it:
import { snapdom } from '@zumer/snapdom'
const component = document.querySelector('#certificate')
const blob = await snapdom.toBlob(component, {
format: 'png',
dpr: 2,
embedFonts: true,
backgroundColor: '#ffffff',
})
// Pass blob to the PDF library used by your application.Images fit bounded visual artifacts
Image capture is useful for certificates, receipts or complex visual components where exact browser styling matters more than selectable PDF text.
Create an image ready for PDF
Generate a PNG Blob from this bounded certificate—the artifact a PDF library would receive.
DOM Capture Fundamentals
Awarded to SnapDOM Developer
Browser-rendered artifactLimits and common mistakes
The captured content becomes pixels. If you need selectable text or pagination, use the PDF plugin instead of an image.
Frequently asked questions
Does SnapDOM convert arbitrary HTML into a paginated PDF?
Use the PDF plugin to export a rendered DOM element with pagination, selectable text and links. It shares the browser capture's resource and DOM-access limits. An image-based PDF flattens that content into pixels.
When is image-based PDF appropriate?
For bounded visual artifacts such as certificates, tickets, receipts and shareable cards.