Now Available: Notion-like editor templateNotion-style editor for Tiptap Cloud

inchToPixels utility

The inchToPixels helper lets you easily convert inches to pixels, which is useful if you want to define your page or margin sizes in inches and need to convert them to pixels for the pageFormat option or custom layouts in the Tiptap Pages extension.

Import

import { inchToPixels } from '@tiptap-pro/extension-pages'

API

inchToPixels(inches: number, dpi?: number): number
  • inches: The value in inches to convert.
  • dpi (optional): Dots per inch. If not provided, the utility will auto-detect the DPI of the current environment.
  • Returns: The equivalent value in pixels (rounded).