There are various C++ libraries for working with PDF files. HaHu, PoDoFo, JagPDF, and PDF-Writer (also known as Hummus) are some of the open source and cross-platform libraries that you could use for this purpose. In this book, I will use PDF-Writer, available at https://github.com/galkahana/PDF-Writer. This is a free, fast, and extensible library with a basic feature set that includes support for text, images, and shapes with both PDF operators and higher-level functions (which I will use for the solution to this problem).
The function print_pdf(), shown as follows, implements the following algorithm:
- Start a new PDF document with PDFWriter::StartPDF().
- Print at most 25 movies on each page. Each page ...