Skip to content
New issue

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

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

Already on GitHub? # to your account

corruption when open/save with v0.34.0: Error: Trailer #363

Open
gwik opened this issue Dec 13, 2024 · 0 comments
Open

corruption when open/save with v0.34.0: Error: Trailer #363

gwik opened this issue Dec 13, 2024 · 0 comments

Comments

@gwik
Copy link

gwik commented Dec 13, 2024

Hi,

When opening and saving a PDF the resulting PDF is corrupt and cannot be opened by lopdf with release 0.34.

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let mut pdf = lopdf::Document::load("doc.pdf")?;

    pdf.save("/tmp/test.pdf")?;
    lopdf::Document::load("/tmp/test.pdf")?;

    Ok(())
}
// Error: Trailer

The problem was fixed by 443ab33

Can you please make a new release?

A workaround is to remove the "Prev" entry from the trailer before save.

pdf.trailer.remove(b"Prev");
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant