PDF Converter Library

Interactive Demo

Try out the PDF converter library below. Upload PDF, EPS, or SVG files to see it in action.

Features

Installation

npm install vector-pdf-converter

Usage

import { PDFConverter } from 'vector-pdf-converter';

// Convert a PDF file
const result = await PDFConverter.convertFile(file, {
 quality: 'ebook',
 downscaleImages: true,
 optimizeForWeb: true,
 colorConversionStrategy: 'sRGB',
 compatibilityLevel: '1.4'
});

// Convert an SVG file
const svgResult = await PDFConverter.convertSVG(svgFile, {
 backend: 'resvg',
 scale: 1,
 backgroundColor: 'white',
 preserveAspectRatio: true
});

// Convert SVG with all engines for comparison
const allResults = await PDFConverter.convertSVG(svgFile, {
 backend: 'all',
 scale: 1,
 backgroundColor: 'white'
});

// Convert an EPS file
const epsResult = await PDFConverter.convertFile(epsFile, {
 cropToEPS: true,
 fitToPage: true,
 pageSize: 'a4',
 resolution: 300
});

// Batch convert multiple files
const batchResults = await Promise.all(
 files.map(file => PDFConverter.convertFile(file, options))
);

// Download the result
const link = document.createElement('a');
link.href = result.url;
link.download = 'converted.pdf';
link.click();