78. Creating a PDF from a collection of images

To solve this problem we will use the same PDF-Writer library we used for the previous problem. I recommend that you look at and implement the previous problem first, if you have not done that already, before continuing with this one.

The following get_images() function returns a vector of strings that represent the path of all JPG images from a specified directory:

namespace fs = std::experimental::filesystem;std::vector<std::string> get_images(fs::path const & dirpath){   std::vector<std::string> paths;   for (auto const & p : fs::directory_iterator(dirpath))   {
      if (p.path().extension() == ".jpg")         paths.push_back(p.path().string());   }   return paths;}

The print_pdf() function creates a PDF document ...

Get The Modern C++ Challenge now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.