How the PDF to SVG Converter Works
AnyTool PDF to SVG renders a PDF entirely in the browser with pdf.js, whose worker is bundled into the app and served from the same origin — never loaded from a CDN — so the tool stays fully offline-capable and uploads nothing. For each selected page the converter measures the page’s true size from a scale-1 viewport (1 unit = 1 PDF point), then renders the page to a high-DPI canvas at 1×–4× and reads it back as a base64 PNG or JPEG. It writes a standalone SVG whose width, height and viewBox are the page’s real point dimensions and embeds that raster as a single <image>, so the file scales without blurring and prints at the correct physical size. When the selectable-text option is on, it also calls getTextContent() and, for every text run, emits an SVG <text> element positioned by a matrix derived from the run’s transform (mapped from PDF space into the SVG’s top-left point space and flipped on Y), with textLength/lengthAdjust set from the run’s measured width so selection lines up with the image beneath. Multiple pages are bundled into a .zip with JSZip in the browser.
- Each page rendered to a high-DPI canvas with pdf.js (1×–4×)
- pdf.js worker bundled locally (pdf.worker.min.mjs?url) — no CDN
- SVG viewBox set to the page’s true PDF point size for clean scaling
- Optional selectable <text> layer from getTextContent(), matrix-positioned
- Single .svg for one page; JSZip .zip for many — all in the browser
