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:
1 parent
9e688b6801
commit
d492bf7112
29 files changed
+507
-131
No files matched your search
@@ -16,11 +16,14 @@ import { afterAll, beforeAll, describe, expect, it, vi } from 'vitest'
|
||||
import { AFRelationship, PageSizes, PDFDocument, StandardFonts } from 'pdf-lib'
|
||||
import type { Branding, Practitioner, Report } from '@faunosteo/core-wasm/types'
|
||||
import {
|
||||
exportReportArchive,
|
||||
readAttachedDocument,
|
||||
readAttachmentBytes,
|
||||
type ExportInput,
|
||||
type Rasterizer,
|
||||
} from '@faunosteo/pdf'
|
||||
import { exportReportToPdf } from '@/pdf/export'
|
||||
import { loadBranding } from '@/pdf/branding'
|
||||
import { defaultPdfLabels } from '@/pdf/labels'
|
||||
import { importAttachment } from '@/pdf/import'
|
||||
import type { SheetIndex } from '@/services/sheetIndex'
|
||||
import type { Locale } from '@/i18n/types'
|
||||
@@ -113,14 +116,26 @@ const fixedRaster =
|
||||
async () =>
|
||||
mode === 'logos' ? TWO_BY_ONE_PNG : ONE_PX_PNG
|
||||
|
||||
/** One export through `@/pdf/export`, drawn under the full recorder. */
|
||||
/**
|
||||
* One export through the TypeScript engine with the application's inputs (the snapshot
|
||||
* the core builds, the bundled branding of the mode, the app's labels, the fixed export
|
||||
* time), drawn under the full recorder. R4.6 moved `@/pdf/export` onto the core's
|
||||
* session: the oracles stay those of the R3 build, so the engine is called directly, as
|
||||
* the app export called it until then (same inputs, same order).
|
||||
*/
|
||||
async function exportRun(run: Run): Promise<Exported> {
|
||||
raster.rasterize = run.rasterize
|
||||
logoMode.current = run.mode
|
||||
const recorder = recordFullDrawing()
|
||||
try {
|
||||
const { pdf, warnings } = await exportReportToPdf(run.report, sheet, {
|
||||
const { pdf, warnings } = await exportReportArchive({
|
||||
report: run.report as ExportInput['report'],
|
||||
sheet: sheetSnapshot(sheet, run.report) as ExportInput['sheet'],
|
||||
branding: await loadBranding(),
|
||||
labels: defaultPdfLabels,
|
||||
locale: run.locale,
|
||||
rasterizer: run.rasterize,
|
||||
exportedAt: new Date(),
|
||||
})
|
||||
expect(warnings).toEqual([])
|
||||
expect(recorder.unexpectedCalls()).toEqual([])
|
||||
|
||||
Reference in new issue
Block a user