Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added binary comment as attribute and for load and write. Binary Comment is gonna be important for pdf in A/2, A/3 format. #370

Merged
merged 8 commits into from
Jan 14, 2025

Conversation

aedn-sama
Copy link
Contributor

No description provided.

@aedn-sama
Copy link
Contributor Author

image

Checked it against veraPDF.
Second line should be the binary marker.

// Load the existing PDF file
let mut pdf = Document::load("537_INPUT.pdf")?;
// let mut pdf = Document::load("output-pdfa3.pdf")?;
pdf.delete_zero_length_streams();
    
// pdf.binary_comment = vec![0xFF, 0xFF, 0xFF, 0xFF];
pdf.binary_comment = vec![0xC1, 0xC2, 0xC3, 0xFF];

Can be manipulated over public attribute.
If binary_comment is being untouched and the loaded document has a binary marker itself, it will get taken over.

@Heinenen Heinenen linked an issue Jan 12, 2025 that may be closed by this pull request
@Heinenen
Copy link
Collaborator

Looks good to me.
FYI, the normal PDF spec demands that a binary comment is written (it's only strictly necessary if there is binary data anywhere else in the file, but we wouldn't want to check for that anyway).

A downside of your implementation (for some users) is the immediate rejection of the file if it doesn't contain the binary comment.
Although this is spec-compliant, some users may still complain, cf. #41.

src/document.rs Outdated Show resolved Hide resolved
@aedn-sama aedn-sama requested a review from Heinenen January 13, 2025 16:04
@J-F-Liu J-F-Liu merged commit 1b2868e into J-F-Liu:main Jan 14, 2025
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

lopdf does not write binary marker
3 participants