Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
April 8, 2023 04:34 pm GMT

Are your PDFs Actually Redacted? Double Check!

Introduction

PDF is a very common file format for documents but one thing people may not realise is that the complexity the format provides can mean some things aren't quite as they seem. Specifically, I've seen numerous "redacted" documents where the user has drawn over the text and saved the file. However, under the hood, PDFs have layers which means that the block or marker you used is actually may actually be saved as a separate layer from the text it's covering. This means anyone who opens the file can simply move the block away and see the text that was underneath!

Drawing over the text that should be redacted:

Drawing over the text that should be redacted

After saving the file as "Seemingly_Redacted.pdf", and opening it in Acrobat, a user can easily remove the line to expose the text that should be hidden:

Uncovering

Easy Fix

Adobe Acrobat Pro (paid versions) supports proper redacting of text but it can be too expensive to buy for people to justify their use, depending on how often you used advanced features. Fortunately, the free version of Adobe Acrobat can help with that.

Instead of saving the PDF by either using the "Save" option or "Save As" option, go to "File...Print" in Adobe Acrobat. Set the printer to "Microsoft Print to PDF" (or similar PDF related printer) and go to the "Advanced" button as below to select "Print as Image" and set the Dots Per Inch (DPI). Normally PDFs are 300dpi be default but since flattening can cause a decrease in quality, I found changing it to 600 kept a decent level of quality comparable to the original (though the higher the dpi, the larger the file size, so play around and see what suits your requirements):

Print Quality

Click "Print" and it should ask to save the file to a location and once you choose a location, it will create a PDF file that is now flattened. I recommend creating a new final file, instead of overwriting the original version, in case further edits need to be made or data went missing during flattening. That's it! The text under your drawing is no longer visible by moving the line or block out of the way. This also means nothing can be edited, so it's advisable to use it once you have the final version you want to send as opposed to constantly flattening it after every edit.

Things to be aware of

Flattening PDFs can cause a decrease in quality but you can change it increase the Dots Per Inch (DPI) as shown in the previous step. This may increase the file size slightly but aims to keep the quality as high as possible.

Flattening a PDF file can sometimes lead to errors or inconsistencies in the document, especially if there are complex graphics. Always proofread after to ensure everything looks as expected.

Finally, flattening can also affect OCR and accessibility tools making them harder to use. Consider your audience and requirements for flattening.

However, for a lot of use cases, the downsides to flattening are outweighed by the pros. I had to use it to send a bank statement for proof of address but there was no need for the company to be able to see all my transactions on the statement.

The paid version of Acrobat, and other readers, feature more advanced levels of redaction and such so depending on your requirements, it may be better value to use that.

Advanced usage using ImageMagick

For those who want to automate this, you can use a command line too like ImageMagick. The following command flattens the PDF with a DPI of 300. You can toy around with the DPI value if you need to, the higher the value, the bigger the file size.

convert -density 300 -quality 100 input.pdf -flatten flattened_output.pdf

I hope that helps, feel free to leave any comments or questions below.


Original Link: https://dev.to/reaminated/are-you-pdfs-actually-redacted-double-check-3ce3

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To