0

I have a pdf file created with pdflatex and hyperref / ocgx2 packages.

How can I create a pdf out of this containing a range of pages (say pages 2 to 5) preserving the ocg?

Usually I do: pdftk orig.pdf cat 2-5 output new.pdf which gives me a pdf file of pages 2 to 5 but does seem to break the ocg. (Originally I had hidden content that could be made visible clicking on a link. After pdftk the hidden content is always visible.)

Ideally I am looking for a solution that works from pdf to pdf. If that is not possible, I'd also be happy to recompile the tex file specifying the page range somewhere in the .tex.

  • 1
    I am afraid this isn't possible with Pdftk as ocgs rely on pdf objects that are distributed over the file and Pdftk doesn't seem to be able to keep track of them. Maybe only Acrobat can do that in a reliable way. – AlexG Sep 8 at 9:02
  • Thanks. Is there any way to do this in the text file? – user1583209 Sep 8 at 9:49
  • 1
    Do you mean in the *.tex source file? Should be easily possible, if you have split the input into separate files, e. g. chapter-wise, beforehand. You can use \includeonly{...} in the main input file to select individual chapters. – AlexG Sep 8 at 10:20
  • Also, there are numerous online services for pdf post-processing. Maybe there is one that does the job. – AlexG Sep 8 at 10:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.