I am writing a replacement for \include that will only include the file if it has been modified. To do this I need to delete or extract files from a pdf. I am using lua to do all this.

I see there are some cmd line tools to do it: http://www.verypdf.com/wordpress/201112/delete-specified-pdf-pages-using-command-line-15756.html

But is there any easier way? Ultimately I would like to extract/copy only a subset of pages from a pdf to a new pdf rather than copy the whole file(which may be large) into another then delete the pages.

  • 1
    Have you taken a look at Merge two outputted PDFs from LaTeX??
    – Jake
    May 13, 2012 at 20:23
  • @Jake I'm trying to do much more than that... make a conditional include or includepdf
    – Uiy
    May 13, 2012 at 20:38
  • Sorry, I should have been clearer: I meant that you can use \includepdf[pages=...] to specify which pages to include.
    – Jake
    May 13, 2012 at 20:42
  • @Jake Yes, I know that. I will use it, but I am trying to trim down the pdf's in the first place so it is quicker and they take up less space.
    – Uiy
    May 13, 2012 at 20:59
  • 1
    If you know the page numbers of the pieces you want to extract the answer here might help: tex.stackexchange.com/questions/54157/… May 14, 2012 at 0:40


Browse other questions tagged or ask your own question.