1

I have about ten pdf files, all of which have bookmarks. I want to combine all ten files into a single file. I also want all the bookmarks to be retained in the process.

Here is my current method to combine the files:

\documentclass{article}% or something else
\usepackage{pdfpages}

\begin{document}

\includepdf[pages=-]{file1} \includepdf[pages=-]{file2} \includepdf[pages=-]{file3} \includepdf[pages=-]{file4}

\end{document}

This previous question is similar to my question. This one is also similar.

However, I don't want to create any new bookmarks, I just want to import them all.

  • 1
    It is theoretically possible: you can readd the destinations with the newpax package and one could also extract the bookmark info to recombine them. But I'm not aware of a concrete implementation in LaTeX. – Ulrike Fischer Jul 19 '23 at 09:17
  • 2
    If you only want to combine several PDFs, you can try using ghostscript to combine them. The bookmarks should be kept then. – Jasper Habicht Jul 19 '23 at 09:19
  • @JasperHabicht You are right, this work very well. – Astor Florida Jul 19 '23 at 09:51

1 Answers1

2

In the comments, @Jasper Habict made the following suggestion:

If you only want to combine several PDFs, you can try using ghostscript to combine them. The bookmarks should be kept then.

They are right about that. I installed ghostscript and used the command I found here:

gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=combine.pdf -dBATCH 1.pdf 2.pdf

I needed to add -dNOSAFER as well to allow access to my file system.