GtkPrintOperation file name

Hi,
How can I change the print file name in the Gtk print dialog?
To better understand my needs, in a GtkNotebook, every tab has a name identifier and can be printed out independently. I want to add the respective identifier in the print output file name (print to file, pdf.), the “~/Documents/output.pdf” in the attached capture.
I use the GtkPrintOperation API in C, linux.
I do not want to use gtk_print_operation_set_export_filename(), to keep the option of normal printing.

Thank you!

Use GtkPrintSettings to set the output file details:

gtk_print_settings_set (settings,
  GTK_PRINT_SETTINGS_OUTPUT_BASENAME,
  "output-file-basename");
gtk_print_settings_set (settings,
  GTK_PRINT_SETTINGS_OUTPUT_FILE_FORMAT,
  "pdf");
gtk_print_settings_set (settings,
  GTK_PRINT_SETTINGS_OUTPUT_DIR,
  some_directory);

Great! Many thanks!
Sorry if I missed these items in the help pages, but I couldn’t find directly the keys for the gtk_print_settings_set() function.

They are part of the API reference, for instance:

You can search for “print settings output” in the documentation, for instance. They are also listed in the “constants” section of the main index.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.