How to extract some pages from a multi-page PDF?

It may be necessary to split a set of pages from a multi-page PDF into a separate document. Usually, this can be done by using the „Print to PDF“ function of Ubuntu, but not all applications are supported now. Otherwise, one could just print the desired pages to a new PDF file. Another solution would be cups-pdf, a virtual printer. But the quality is very low and insufficient for some purposes.

Finally, I found this nice tool: pdftk

Install it with sudo apt-get install pdftk and then simply enter the following, in order to extract pages 3 to 17 from input.pdf and write them into output.pdf:

pdftk input.pdf cat 3-17 output output.pdf