feat(pdf): R4.6 app export on the core's session: export.ts drives ExportSession (rasters one by one, warnings in the engine's order, abort on unmount), labels moved to the app, EditorRoute downloads the Blob of the parts; suites read the file's content streams (pdfRead helper), app-path bytes = R4 digests, hex strings upper-case as pdf-lib

This commit is contained in:
bchanot committed 2026-10-19 01:26:13 +02:00
1 parent 9e688b6801
commit d492bf7112
29 files changed
+507 -131

No files matched your search

+12 -12
View File
@@ -37,12 +37,12 @@ import {
FIXTURES_DIR,
ONE_PX_PNG,
readLinks,
recordDrawing,
snapshotViews,
type ImageEntry,
type LinkEntry,
type TextEntry,
} from '../helpers/goldens'
import { bytesOf, readDrawing } from '../helpers/pdfRead'
// Same fixed raster for every view and logo: images then depend on the
// branding and the layout only.
@@ -84,18 +84,18 @@ interface Facts {
links: LinkEntry[]
}
/** Runs an export under the drawing recorder and reads the links back. */
async function recorded<T extends { pdf: Uint8Array }>(
/**
* Runs an export and reads its facts back from the file (R4.6: the app export is the
* core's, the re-export the engine's; both files are read the same way).
*/
async function recorded<T extends { pdf: Uint8Array | Blob }>(
run: () => Promise<T>,
): Promise<T & Facts> {
const recording = recordDrawing()
try {
const result = await run()
const { texts, images } = recording
return { ...result, texts, images, links: await readLinks(result.pdf) }
} finally {
recording.stop()
}
): Promise<Omit<T, 'pdf'> & { pdf: Uint8Array } & Facts> {
const result = await run()
const pdf =
result.pdf instanceof Uint8Array ? result.pdf : await bytesOf(result.pdf)
const { texts, images } = await readDrawing(pdf)
return { ...result, pdf, texts, images, links: await readLinks(pdf) }
}
const facts = ({ texts, images, links }: Facts): Facts => ({