Richard,

I see nothing wrong :(

Let's try this. I have attached a program which is exactly the code in
dt to send the file to CUPS. Nothing fancy and really straight forward.

To compile:

$ gcc -o dtprt dtprt.c `pkg-config --cflags --libs glib-2.0` -lcups

Then to send a file to CUPS:

$ dtprt workroom <pdf file here>

If you don't mind print the PDF and comment out one line at a time in
dtprt.c (see comment starting with ## with priority order) and check
again.

Alternatively you can try to comment out all lines and if the print is
ok add one at a time until it create a wrong print.

Thanks,

-- 
  Pascal Obry /  Magny Les Hameaux (78)

  The best way to travel is by means of imagination

  http://v2p.fr.eu.org
  http://www.obry.net

  gpg --keyserver keys.gnupg.net --recv-key F949BD3B

/*
    This file is part of darktable,
    copyright (c) 2014-2015 pascal obry.

    darktable is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    darktable is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with darktable.  If not, see <http://www.gnu.org/licenses/>.
*/

// gcc -o dtprt dtprt.c `pkg-config --cflags --libs glib-2.0` -lcups

#include <glib.h>
#include <stdio.h>
#include <tiffio.h>
#include <stdio.h>
#include <cups/cups.h>
#include <cups/ppd.h>

void dt_print_file(const char *printer_name, const char *filename)
{
  // first for safety check that filename exists and is readable
  int j, k;

  if (!g_file_test(filename, G_FILE_TEST_IS_REGULAR))
  {
    printf("file '%s' to print not found for image `%d' on %s", filename, printer_name);
    return;
  }

  cups_dest_t *dests;
  int num_dests = cupsGetDests(&dests);
  cups_dest_t *dest = cupsGetDest(printer_name, NULL, num_dests, dests);

  cups_option_t *options = NULL;
  int num_options = 0;

  // ##2 check with the whole loop commented out
  for (j = 0; j < dest->num_options; j ++)
    if (cupsGetOption(dest->options[j].name, num_options,
                      options) == NULL)
      num_options = cupsAddOption(dest->options[j].name,
                                  dest->options[j].value,
                                  num_options, &options);

  // disable cm on CUPS, this is important as dt does the cm

  // ##1 check with line below commented out
  num_options = cupsAddOption("cm-calibration", "true", num_options, &options);

  // media to print on

  // ##3 check with line below commented out
  num_options = cupsAddOption("media", "iso_a4_210x297mm", num_options, &options);

  // never print two-side

  // ##5 check with line below commented out
  num_options = cupsAddOption("sides", "one-sided", num_options, &options);

  // and a single image per page

  // ##4 check with line below commented out
  num_options = cupsAddOption("number-up", "1", num_options, &options);

  // ##6 check with line below commented out
  num_options = cupsAddOption("landscape", "false", num_options, &options);

  // print lp options

  printf ("[print] printer options (%d)\n", num_options);
  for (k=0; k<num_options; k++)
  {
    printf ("[print]   %s=%s\n", options[k].name, options[k].value);
  }

  const int job_id = cupsPrintFile(printer_name, filename,  "darktable", num_options, options);

  if (job_id == 0)
    printf("error while printing image on `%s'", printer_name);
  else
    printf("printing image on `%s'", printer_name);

  cupsFreeOptions (num_options, options);
}

int main (int argc, char **argv)
{
  if (argc == 3)
  {
    printf ("printing %s on %s\n", argv[2], argv[1]);
    dt_print_file (argv[1], argv[2]);
  }
}

// modelines: These editor modelines have been set for all relevant files by tools/update_modelines.sh
// vim: shiftwidth=2 expandtab tabstop=2 cindent
// kate: tab-indents: off; indent-width 2; replace-tabs on; indent-mode cstyle; remove-trailing-space on;
------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet
_______________________________________________
darktable-devel mailing list
darktable-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/darktable-devel

Reply via email to