Documentation Index
Fetch the complete documentation index at: https://mintlify.com/ragaeeb/kokokor/llms.txt
Use this file to discover all available pages before exploring further.
Calculate DPI based on image dimensions and original PDF size
Documentation Index
Fetch the complete documentation index at: https://mintlify.com/ragaeeb/kokokor/llms.txt
Use this file to discover all available pages before exploring further.
calculateDPI(imageSize: Size, pdfSize: Size): { x: number; y: number }
import { calculateDPI } from 'kokokor';
// A4 page dimensions
const imageSize = { width: 2480, height: 3508 };
const pdfSize = { width: 595, height: 842 }; // A4 page in points
const dpi = calculateDPI(imageSize, pdfSize);
console.log(`DPI: ${dpi.x} x ${dpi.y}`);
// Result: DPI: 300 x 300 for a 300 DPI scan
// Use DPI for scaling tolerances
const pixelTolerance = 5;
const scaledTolerance = pixelTolerance * (dpi.x / 72);