Give the preflight test fixtures a PDF/A-2 file header

The header check reports a file without the binary comment, and Save as PDF/A then makes the next save a full one. The known-answer documents and the generation-repair file predate it: the minimal document got a 6.1.2 issue, and an undamaged file needed a full save for its header instead of being saved incrementally. They now start with the comment, as the crate's unit test documents do.
This commit is contained in:
bflatastic committed 2026-11-09 09:56:47 +07:00
1 parent 8ed1e1e155
commit 4e86cd337d
2 files changed
+5 -2

No files matched your search

+3 -1
View File
@@ -4,7 +4,9 @@ use pdfcraft_preflight::{Level, convert};
use std::sync::Arc;
fn image_file(damaged: bool) -> Arc<Vec<u8>> {
let mut bytes = b"%PDF-1.7\n".to_vec();
// A PDF/A-2 header (6.1.2), so that Save as PDF/A has no header to rewrite and only the
// repaired references decide whether the next save is full.
let mut bytes = b"%PDF-1.7\n%\xE2\xE3\xCF\xD3\n".to_vec();
let bodies = [
"<< /Type /Catalog /Pages 2 0 R /HeaderImage 5 1 R /RowImage 5 0 R /StaleImage 5 2 R >>",
"<< /Type /Pages /Kids [3 0 R] /Count 1 >>",
+2 -1
View File
@@ -22,7 +22,8 @@ use pdfcraft_preflight::{Level, convert, declared, icc, verify};
/// A document from hand-written objects and extra trailer entries (copied from the crate's unit
/// tests).
fn build(objs: &[&str], trailer_extra: &str) -> Document {
let mut out = b"%PDF-1.7\n".to_vec();
// ISO 19005-2 6.1.2: the header line is followed by a comment of four bytes above 127.
let mut out = b"%PDF-1.7\n%\xE2\xE3\xCF\xD3\n".to_vec();
let mut offsets = Vec::new();
for (i, o) in objs.iter().enumerate() {
offsets.push(out.len());