| | 428 | |
| | 429 | // Add Cups options. |
| | 430 | cups_option_t *options; |
| | 431 | gint numOptions = 0; |
| | 432 | |
| | 433 | gchar *numCopies = g_strdup_printf ("%d", job->getNumberOfCopies ()); |
| | 434 | numOptions = cupsAddOption ("copies", numCopies, numOptions, &options); |
| | 435 | g_free (numCopies); |
| | 436 | |
| | 437 | gchar *collate = g_strdup (job->getCollate() ? "True" : "False"); |
| | 438 | numOptions = cupsAddOption ("Collate", collate, numOptions, &options); |
| | 439 | g_free (collate); |
| | 440 | |
| | 441 | gchar *orientation = NULL; |
| | 442 | if ( PRINT_PAGE_ORIENTATION_LANDSCAPE == job->getPageOrientation () ) |
| | 443 | { |
| | 444 | orientation = g_strdup_printf ("4"); |
| | 445 | } |
| | 446 | else |
| | 447 | { |
| | 448 | orientation = g_strdup_printf ("3"); |
| | 449 | } |
| | 450 | numOptions = cupsAddOption ("orientation-requested", orientation, |
| | 451 | numOptions, &options); |
| | 452 | g_free (orientation); |
| | 453 | |
| | 454 | gchar *layout = NULL; |
| | 455 | switch (job->getPageLayout ()) |
| | 456 | { |
| | 457 | case PRINT_PAGE_LAYOUT_2IN1: |
| | 458 | layout = g_strdup_printf ("%d", 2); |
| | 459 | break; |
| | 460 | |
| | 461 | case PRINT_PAGE_LAYOUT_4IN1: |
| | 462 | layout = g_strdup_printf ("%d", 4); |
| | 463 | break; |
| | 464 | |
| | 465 | default: |
| | 466 | layout = g_strdup_printf ("%d", 1); |
| | 467 | } |
| | 468 | numOptions = cupsAddOption ("number-up", layout, numOptions, &options); |
| | 469 | |
| | 470 | cupsPrintFile (job->getPrinterName (), job->getTempFileName (), |
| | 471 | job->getDocument ().getFileName (), numOptions, options); |
| | 472 | |
| | 473 | cupsFreeOptions (numOptions, options); |
| | 474 | |