Exportar a PDF

The 'Print to file' option is available in the print dialog, without the need for extra implementation. However, it is sometimes useful to generate a pdf file directly from code. For instance,

auto op = Gtk::PrintOperation::create();
// ...set up op...
op->set_export_filename("test.pdf");
auto res = op->run(Gtk::PRINT_OPERATION_ACTION_EXPORT);