How to Merge and Optimize Your PDF Files
I recently purchased a DJI Neo drone, and in Japan, it's mandatory to register your drone with the Ministry of Land, Infrastructure, Transport and Tourism (MLIT). During registration, you need to submit a user manual that includes both handling instructions and specifications. However, the DJI Neo manual only contains references to specifications on DJI's website. Therefore, for the registration, I needed to merge the user manual with the specifications from the website. While the DJI Neo user manual is provided in PDF format, it's password-protected, preventing any modifications or merging. Here's how to bypass the password protection on a Mac: This process will create a new PDF without password protection. While this can be done with Here's how to merge PDFs: After merging, I found that the file size exceeded 40MB, which was too large to upload to MLIT's DIPS2.0 (Drone/UAS Information Platform System). To resolve this, I used Ghostscript for optimization: The Scanned PDFs aren't searchable. Use these Linux/Mac commands for OCR instead of expensive software: Scanned PDFs often lack a table of contents. Instead of buying expensive PDF software, use these Linux/Mac commands: Open metadata.txt in your editor and add bookmark locations in this format: Then apply the metadata to create a PDF with a table of contents: With these steps, I successfully optimized the PDF and completed the drone registration. However, it seems rather inefficient to require individual manual submissions for DJI drones, which are widely used. This feels like typical bureaucratic red tape. Finally, while this may only be relevant for Japanese users, I'm sharing the prepared DJI Neo manual that meets DIPS2.0 requirements here: DownloadBypassing PDF Password Protection
Merging PDFs
Ghostscript (mentioned later), we'll use pdftk for its advantages:# Install pdftk (on Mac)
brew install pdftk-java
# Merge PDFs
pdftk input1.pdf input2.pdf cat output merged.pdfPDF Optimization
# Install Ghostscript (on Mac)
brew install ghostscript
# Optimize PDF
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf-dPDFSETTINGS option allows you to adjust the compression level:/screen: For screen display (72dpi) - smallest file size/ebook: For e-books (150dpi) - balanced compression/printer: For printing (300dpi)/prepress: For high-quality printing (highest quality)Making PDF Searchable
brew install ocrmypdf
brew install tesseract-lang
# OCR with image optimization
ocrmypdf -l jpn --optimize 3 input.pdf output.pdfCreating Table of contents
# Install pdftk (on Mac)
brew install pdftk-java
# Extract metadata
pdftk input.pdf dump_data_utf8 > metadata.txtBookmarkBegin
BookmarkTitle: Chapter 1
BookmarkLevel: 1
BookmarkPageNumber: 1
BookmarkBegin
BookmarkTitle: Chapter 2
BookmarkLevel: 1
BookmarkPageNumber: 10# Apply edited metadata
pdftk input.pdf update_info_utf8 metadata.txt output output.pdfConclusion