[Tex/LaTex] How to preserve hyperlinks in a PDF that is a subset of the pages in a larger PDF

hyperreflinkspdf

I would like to send my colleague just part of a document. The document includes hyperlinks from the hyperref package for clickable cross-referencing within my document.

I have tried to create a PDF that is a subset of the pages in the larger PDF file by using the "print to file" feature in evince. It works to create a PDF with just some of the pages, but it does not preserve the hyperlinks from hyperref. How can I create a PDF with just a subset of the pages from the original PDF yet preserve the hyperlinks?

UPDATE: related: Compiling only a page range or page selection.

UPDATE 2: Though Adam Liter's solution works for me, for a (preferable) solution within LaTex see Heiko Oberdiek' answer below.

Best Answer

For a non-TeX solution: you can use the command line tool pdftk to splice up the original PDF and make a new PDF with just a subset of the pages from the original PDF. This will preserve the hyperlinks from the original PDF.