Fixes macOS Preview garbled annotations

Overview

PDF Annotation Fixer

macOS Preview sometimes 'forgets' about annotations that were added to a PDF file. This can be particularly frustrating after providing feedback on a draft for many hours, just to loose the precious annotations when closing and re-opening the file.

This tool attempts to fix the annotations based on a technique described by 'thorimur'.

How to use

You can either use the command line app or try the web app hosted on GitHub Pages.

Web App

Thanks to WebAssembly, you can also use this tool from the browser here.

The web app runs entirely in the browser and the PDF is never sent anywhere.

The source code can be found under web-app directory of this repository.

Command Line

You need to have a working rust toolchain installed.

Then just run the program using cargo:

~ cargo run -- my_messed_up.pdf fixed.pdf
# ...
recovered 188 annotations
Comments
  • Trying to get this to work

    Trying to get this to work

    Hi there. Thanks for building this tool. I'm trying to use it but was unsuccessful. Would you mind providing more detailed instructions? I installed Rust per the link you provided, but now I'm getting "no permission" and "command not found" errors when copy pasting '~ cargo run -- my_messed_up.pdf fixed.pdf'. Any advice?

    opened by andrewthedina 11
  • ERROR: page annotations is not an array

    ERROR: page annotations is not an array

    Hi,

    After successfully cloning the repo and installing rust, I'm trying to run a pdf which has some annotations added in preview that doesn't appear when I open the pdf. Crashed pdf file is inside the project folder (and is attached here). crash.pdf

    cargo run -- crash.pdf test.pdf

    But I'm getting

    barretto@virus pdf_annotation_fix % cargo run -- crash.pdf test.pdf
        Finished dev [unoptimized + debuginfo] target(s) in 0.05s
        Running `target/debug/pdf_annotation_fix crash.pdf teste.pdf`
    Error: page annotations is not an array
    
    Caused by:
        An object does not have the expected type
    

    Any hints on how to get over this error or is it a bug?

    crash.pdf

    opened by fbarretto 3
  • Not working with some anotations?

    Not working with some anotations?

    Hello ! I had this weird bug as well on Preview & tried to run your script (on the web app) to repear my PDF, it didn't find any note (I have about 40 anotations that disappeared in a 1 page pdf, this is quite annoying) However, if I open my PDF in textedit, I find the notes in the "code" of the PDF .

    This is example of code of my disappeared anotations : /AP << /N 1073 0 R >> /Contents (Insert 2 \(from - to\))

    Could you help? I would really like to recover my specs doc instead of re-doing it again :)

    I can't show PDF here as it contains confidential infos..

    opened by homegourmet 0
  • Missing something in my Rust installation

    Missing something in my Rust installation

    When I try to compile your app, I get a Rust error:

    error: failed to parse manifest at `/Users/headless/Desktop/Vacasa/Cargo.toml`
    
    Caused by:
      no targets specified in the manifest
      either src/lib.rs, src/main.rs, a [lib] section, or [[bin]] section must be present
    
    

    I'm a noob to programming, but clearing I'm missing some configuration or dependencies?

    How do I fix this issue?

    Thanks

    PS: It should be noted that after installing Rust and their RLS, I was getting this message:

    cargo run -- /Users/headless/Desktop/Vacasa/Luna\ Inspection.pdf ~/Desktop/Vacasa/Luna\ fixed.pdf
    error: could not find `Cargo.toml` in `/Users/headless/Desktop/Vacasa` or any parent directory
    
    

    So I went to Rust's site where they mention needing to create a Cargo.toml file for your project.

    I did Cargo run and got a .toml in my project directory, but am unsure what to put into the file for proper execution of your app.

    opened by rkworden 0
  • Header error parsing pdf file in web app

    Header error parsing pdf file in web app

    Opening a pdf that was annotated in Big Sur. Upon uploading the document and pressing "Save Recovered", I get this error:

    unable to parse pdf document
    
    Caused by:
        Invalid file header
    

    Shoot me your email address and I will forward the actual document to you Screen Shot 2022-03-08 at 1 53 51 PM

    Many thanks

    .

    opened by rkworden 0
  • Rectangular annotations are not detected

    Rectangular annotations are not detected

    Although visible in Preview, the red dashed rectangles I have added to the below document do not appear in other PDF editors. Please let me know if this is not the intended function, but unfortunately the web-app does not detect the annotations suppdocA.pdf .

    opened by fluxtransistor 1
Owner
null
Rust bindings to llama.cpp, using metal on macOS

llama-rs Rust bindings to llama.cpp, for macOS, with metal support, for testing and evaluating whether it would be worthwhile to run an Llama model lo

Max Brunsfeld 7 Aug 31, 2023
A basic implementation of Yao's Garbled Circuits

yao-gc This is a rudimentary implementation of Yao's Garbled Circuits. This is a technique which allows two parties to evaluate a boolean function on

Lúcás Meier 21 Nov 23, 2022
Allow function lifetime elision and explicit `for<'a>` annotations on closures.

::higher-order-closure Allow function lifetime elision and explicit for<'a> annotations on closures. Motivation / Rationale See the RFC #3216: this cr

Daniel Henry-Mantilla 18 Dec 26, 2022
An ultra-fast CLI app that fixes JSON files in large codebase or folders

minosse An ultra fast CLI app that fixes json files in large codebase or folders USAGE: minosse [OPTIONS] <input-dir> FLAGS: -h, --help Prints

Antonino Bertulla 5 Oct 17, 2022
A blazinlgy fast 🚀 transpiler written in rust 🦀 that fixes (pun intended) your problems

Pissfix ?? Pissfix is a blazingly fast ?? programming language that transpiles to a "interesting" and not well known programming language called "Post

null 3 Sep 28, 2023
A preview of the integration between Bitcoin and the Internet Computer.

Bitcoin Integration Developer Preview Overview The integration between the Internet Computer and Bitcoin will enable developers to build canisters tha

DFINITY 39 Sep 21, 2022
Pretty social media preview thumbnails on the edge

pretty-grauniad-thumbnails Created for the Guardian Fastly Hack day. I aimed to improve the rendering of our social media post sharing thumbnail image

Oliver Barnwell 3 Apr 27, 2022
Generates preview thumbnails for 3D model files

Generates preview thumbnails for 3D model files. Provide a Windows Explorer extensions that adds preview thumbnails for 3D model files.

EYHN 244 Dec 27, 2022
Bevy plugin to simulate and preview different types of Color Blindness.

Bevy Color Blindness Simulation Bevy plugin to simulate and preview different types of Color Blindness. This lets you ensure that your game is accessi

annie 29 Nov 22, 2022
Preview Image in CLI.

PIC ?? PIC (Preview Image in CLI ) is a lightweight Rust tool to preview images in your terminal! With support for various image protocols (Kitty, Six

emanuel 23 Mar 3, 2023
[PoC] An all-in-one preview window for the furries

previuwu An all-in-one preview window for the furries. Uses egui to render the preview window. STATUS: Proof of Concept ( ⚠️ heavy work in progress).

Arijit Basu 9 Feb 10, 2023
runs init, preview and apply on pulumi stacks right in your Github Actions. Inspired from Atalantis for Terraform

pulumi-actions runs init, preview and apply on pulumi stacks right in your Github-Actions. Inspired from Atlantis for Terraform PREVIEW Release Curren

Meet Vasani 6 Aug 7, 2023
GitHub Actions for mdBook (rust-lang/mdBook) ⚡️ Setup mdBook quickly and build your site fast. Linux (Ubuntu), macOS, and Windows are supported.

GitHub Actions for mdBook rust-lang/mdBook Setup Action. We can run mdBook on a virtual machine of GitHub Actions by this mdBook action. Linux, macOS,

Shohei Ueda 231 Jan 2, 2023
Travis CI and AppVeyor template to test your Rust crate on 5 architectures and publish binary releases of it for Linux, macOS and Windows

trust Travis CI and AppVeyor template to test your Rust crate on 5 architectures and publish binary releases of it for Linux, macOS and Windows Featur

Jorge Aparicio 1.2k Dec 30, 2022
Bindings to the macOS Security.framework

macOS/iOS Security framework for Rust Documentation Bindings to the Apple's Security.framework. Allows use of TLS and Keychain from Rust. License Lice

Kornel 172 Dec 24, 2022
ShaderToy clone in Rust, currently supporting MacOS.

ShaderRoy ShaderToy clone in Rust, currently supporting MacOS. Features cargo run <rust project dir> displays a single macOS window filled with a Meta

Michal Srb 24 Dec 11, 2022
Bundle Cargo crates for use with macOS/iOS in Xcode

cargo-cocoapods - Build Rust code for Xcode integration Installing cargo install cargo-cocoapods You'll also need to install all the toolchains you i

Brendan Molloy 14 Dec 29, 2022
Advanced Fuzzing Library - Slot your Fuzzer together in Rust! Scales across cores and machines. For Windows, Android, MacOS, Linux, no_std, ...

LibAFL, the fuzzer library. Advanced Fuzzing Library - Slot your own fuzzers together and extend their features using Rust. LibAFL is written and main

Advanced Fuzzing League ++ 1.2k Dec 29, 2022
A tracing layer for macOS/iOS's `oslog`

tracing_oslog This is a tracing layer for the Apple OS logging framework. Activities are used to handle spans, Example use tracing_oslog::OsLogger; l

Lucy 12 Dec 6, 2022
mach-dump can parse Mach-O core dumps taken with lldb from macOS and iOS devices.

mach-dump mach-dump can parse Mach-O core dumps taken with lldb from macOS and iOS devices. It has no external dependencies. Example use std::path::Pa

Tobi 8 Sep 16, 2022