mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2026-10-04 02:33:47 +10:00
The web preview, downloads, template gallery, server export and public PDF render through Forme. react-pdf, react-pdf-html, the react-pdf hyphenation package, the Phosphor react-pdf icons and the four patches are gone. Hyphenation now follows the page language for every language Forme has patterns for. Semantic CSS keeps its language; declarations Forme can't draw raise an ENGINE_UNSUPPORTED warning in the editor. The page map rebuilds blocks Forme leaves out of its layout when they break across pages, and a render that misplaces a box is repeated with nested rows kept whole. Tests move to a small shim with the react-pdf calls they were written against; tests of react-pdf internals are dropped. Forme limits are recorded as expected failures (RTL line order, characters above U+FFFF).
19 lines
836 B
TypeScript
19 lines
836 B
TypeScript
import type { ResumeData } from "@reactive-resume/schema/resume/data";
|
|
import type { Template } from "@reactive-resume/schema/templates";
|
|
import type { SectionTitleResolver } from "./section-title";
|
|
import * as forme from "@formepdf/core";
|
|
import { parseResumeData } from "@reactive-resume/schema/resume/data";
|
|
import { renderResume } from "./forme/render";
|
|
|
|
export type CreateResumePdfFileOptions = {
|
|
data: ResumeData;
|
|
filename: string;
|
|
template?: Template | undefined;
|
|
resolveSectionTitle?: SectionTitleResolver | undefined;
|
|
};
|
|
|
|
export const createResumePdfFile = async ({ filename, ...input }: CreateResumePdfFileOptions): Promise<File> => {
|
|
const { pdf } = await renderResume(forme, { ...input, data: parseResumeData(input.data) });
|
|
return new File([pdf as Uint8Array<ArrayBuffer>], filename, { type: "application/pdf" });
|
|
};
|