npm i @piro0919/image-to-pdf
Turn a photo of a paper document into a clean PDF. The page is read by an AI model and typeset again as real text, with its tables and boxes laid out like the original. It is not the photo pasted into a PDF.
Your key goes from this browser straight to Claude. It is not stored.
import { openPrint, rebuild } from "@piro0919/image-to-pdf";
const { html, unclear, usage } = await rebuild(file, {
provider: "openai", // "anthropic" | "openai" | "google"
apiKey, // the user's own key
model: "gpt-6.2-sol", // optional; defaults to DEFAULT_MODELS[provider]
});
await openPrint(html); // opens the print dialog; choose "Save as PDF"import { createOpenAI } from "@ai-sdk/openai";
// Your own key stays on your server: point the provider at your proxy
const openai = createOpenAI({ baseURL: "/api/openai", apiKey: "unused" });
const { html } = await rebuild(file, { model: openai.responses("gpt-6.2-sol") });