From: Jeffrey Ellis
Sent: 02 November 2021 15:55
To: fltk.general
Subject: [fltk.general] Fl_Printer and multiple pages
1.3.7 documentation says that the argument to start_job is the number of pages to print, and you can pass 0 if you don't know. However when I pass 0, start_job returns a non-zero value indicating an error, and the printer dialog never opens. Am I doing something wrong? Should I instead just pass a large page number and end before that number is reached?
Hi Jeffrey,
I call start_job with:
bool printer::start_printer(int& from_page, int& to_page) {
char* error_message = new char[256];;
memset(error_message, 0, 256);
char* message = new char[266];
bool result;
// Start the job with unknown number of pages - exit if cancelled
switch (start_job(0, &from_page, &to_page, &error_message)) {
Also, does anybody know of a good code example for how to print multiple pages?
I have an example but it’s not simple:
I attach the code. It prints my database in two ways – a table and a set of labels. It’s reasonably well commented. It shows how I paginate.
Regards Phil.
I think I figured it out.TLDR: the page count is nothing more than the maximum of the page range that the user can select from the printer dialog when selecting a range of pages to print. There should be no harm in just making this something high like 100.Longer version...Fl_Printer::start_job redirects the call to Fl_System_Printer::start_job (in Fl_GDI_Printer.cxx). This method makes a call to the MS-Windows PrintDlg method which apparently is returning an error, since the dialog never opens.