Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DefaultPaperSize directive in cupsd.conf #2848

Closed
michaelrsweet opened this Issue Jun 4, 2008 · 4 comments

Comments

Projects
None yet
1 participant
@michaelrsweet
Copy link
Collaborator

michaelrsweet commented Jun 4, 2008

Version: 1.4-feature
CUPS.org User: jsmeix.suse

This feature request is because of
http://www.cups.org/str.php?L2846

Please add a DefaultPaperSize directive in cupsd.conf
that overrides the locale and libpaper checks.

@michaelrsweet

This comment has been minimized.

Copy link
Collaborator Author

michaelrsweet commented Jun 4, 2008

CUPS.org User: kssingvo.suse

I think it would be a great idea to have another possibility: not changing anything of the defaults, which means: skip the whole magic and keep the values as they are in the PPD, as another program might change the PPD before installation.

Please add a value to new variable DefaultPaperSize like "AsIs", or "PPD" or anything else you like.
I really don't care about the name of the value, as long as this additional possibility will be introduced. :-)

@michaelrsweet

This comment has been minimized.

Copy link
Collaborator Author

michaelrsweet commented Jun 4, 2008

CUPS.org User: mike

Assigning to 1.4...

"DefaultPaperSize None" will prevent any page size changes.

"DefaultPaperSize sizename" will force it.

The default will be the value from the current algorithm.

@michaelrsweet

This comment has been minimized.

Copy link
Collaborator Author

michaelrsweet commented Sep 3, 2008

CUPS.org User: mike

Fixed in Subversion repository.

@michaelrsweet

This comment has been minimized.

Copy link
Collaborator Author

michaelrsweet commented Sep 3, 2008

"str2848.patch":

Index: scheduler/conf.c

--- scheduler/conf.c (revision 7898)
+++ scheduler/conf.c (working copy)
@@ -103,6 +103,7 @@
{ "DefaultCharset", &DefaultCharset, CUPSD_VARTYPE_STRING },
{ "DefaultLanguage", &DefaultLanguage, CUPSD_VARTYPE_STRING },
{ "DefaultLeaseDuration", &DefaultLeaseDuration, CUPSD_VARTYPE_INTEGER },

  • { "DefaultPaperSize", &DefaultPaperSize, CUPSD_VARTYPE_STRING },
    { "DefaultPolicy", &DefaultPolicy, CUPSD_VARTYPE_STRING },
    { "DefaultShared", &DefaultShared, CUPSD_VARTYPE_BOOLEAN },
    { "DirtyCleanInterval", &DirtyCleanInterval, CUPSD_VARTYPE_INTEGER },
    @@ -462,6 +463,8 @@

cupsdSetString(&DefaultCharset, _cupsEncodingName(language->encoding));

  • cupsdClearString(&DefaultPaperSize);

cupsdSetString(&RIPCache, "8m");

cupsdSetString(&TempDir, NULL);
@@ -881,6 +884,48 @@
cupsdInitEnv();

/*

  • * Update default paper size setting as needed...
  • */
  • if (!DefaultPaperSize)
  • {
    +#ifdef HAVE_LIBPAPER
  • char paper_result; / Paper size name from libpaper */
  • if ((paper_result = systempapername()) != NULL)
  •  cupsdSetString(&DefaultPaperSize, paper_result);
    
  • else
    +#endif /* HAVE_LIBPAPER */
  • if (!DefaultLanguage ||
  •    !strcasecmp(DefaultLanguage, "C") ||
    
  •    !strcasecmp(DefaultLanguage, "POSIX") ||
    
  • !strcasecmp(DefaultLanguage, "en") ||
  • !strncasecmp(DefaultLanguage, "en.", 3) ||
  • !strncasecmp(DefaultLanguage, "en_US", 5) ||
  • !strncasecmp(DefaultLanguage, "en_CA", 5) ||
  • !strncasecmp(DefaultLanguage, "fr_CA", 5))
  • {
  • /*
    
  •  \* These are the only locales that will default to "letter" size...
    
  •  */
    
  •  cupsdSetString(&DefaultPaperSize, "Letter");
    
  • }
  • else
  •  cupsdSetString(&DefaultPaperSize, "A4");
    
  • }
  • /*
  • * Update classification setting as needed...
  • */
  • if (Classification && !strcasecmp(Classification, "none"))
  • cupsdClearString(&Classification);
  • if (Classification)
  • cupsdLogMessage(CUPSD_LOG_INFO, "Security set to "%s"", Classification);
  • /*
    • Check the MaxClients setting, and then allocate memory for it...
      */

@@ -904,12 +949,6 @@
if (MaxActiveJobs > (MaxFDs / 3))
MaxActiveJobs = MaxFDs / 3;

  • if (Classification && !strcasecmp(Classification, "none"))

- cupsdClearString(&Classification);

  • if (Classification)

- cupsdLogMessage(CUPSD_LOG_INFO, "Security set to "%s"", Classification);

/*

  • Update the MaxClientsPerHost value, as needed...
    */

    Index: scheduler/ipp.c

    --- scheduler/ipp.c (revision 7901)
    +++ scheduler/ipp.c (working copy)
    @@ -4977,12 +4977,6 @@
    cups_option_t defaults; / Default options /
    char cups_protocol[PPD_MAX_LINE];
    /
    cupsProtocol attribute */

    • int have_letter, /* Have Letter size */
    •   have_a4;        /\* Have A4 size */
      
      -#ifdef HAVE_LIBPAPER
    • char paper_result; / Paper size name from libpaper */
    • char system_paper[64]; /* Paper size name buffer /
      -#endif /
      HAVE_LIBPAPER */

    cupsdLogMessage(CUPSD_LOG_DEBUG2,
    @@ -5107,9 +5101,6 @@
    return (-1);
    }

  • have_letter = ppdPageSize(ppd, "Letter") != NULL;

- have_a4 = ppdPageSize(ppd, "A4") != NULL;

/*

  • Open the destination (if possible) and set the default options...
    */
    @@ -5154,81 +5145,20 @@

    cupsFileClose(dst);
    }
    -#ifdef HAVE_LIBPAPER

    • else if ((paper_result = systempapername()) != NULL)
    • else if (ppdPageSize(ppd, DefaultPaperSize))
      {
      /*
    • * Set the default media sizes from the systemwide default...

    - */

    • strlcpy(system_paper, paper_result, sizeof(system_paper));

    - system_paper[0] = toupper(system_paper[0] & 255);

    • if ((!strcmp(system_paper, "Letter") && have_letter) ||
    •    (!strcmp(system_paper, "A4") && have_a4))
      
    • {
    •  num_defaults = cupsAddOption("PageSize", system_paper,
      
    •              num_defaults, &defaults);
      
    •  num_defaults = cupsAddOption("PageRegion", system_paper,
      
    •              num_defaults, &defaults);
      
    •  num_defaults = cupsAddOption("PaperDimension", system_paper,
      
    •              num_defaults, &defaults);
      
    •  num_defaults = cupsAddOption("ImageableArea", system_paper,
      
    •              num_defaults, &defaults);
      
    • }
    • }
      -#endif /* HAVE_LIBPAPER */
    • else
    • {
    • /*
    • Add the default media sizes...
    • * Note: These values are generally not valid for large-format devices
    • * like plotters, however it is probably safe to say that those
    • * users will configure the media size after initially adding
    • * the device anyways...
      */
  • if (!DefaultLanguage ||

  •    !strcasecmp(DefaultLanguage, "C") ||
    
  •    !strcasecmp(DefaultLanguage, "POSIX") ||
    
  • !strcasecmp(DefaultLanguage, "en") ||

  • !strncasecmp(DefaultLanguage, "en.", 3) ||

  • !strncasecmp(DefaultLanguage, "en_US", 5) ||

  • !strncasecmp(DefaultLanguage, "en_CA", 5) ||

  • !strncasecmp(DefaultLanguage, "fr_CA", 5))

  • {

  • /*
    
  •  \* These are the only locales that will default to "letter" size...
    

- */

  •  if (have_letter)
    
  •  {
    
  • num_defaults = cupsAddOption("PageSize", "Letter", num_defaults,
  •                                 &defaults);
    
  • num_defaults = cupsAddOption("PageRegion", "Letter", num_defaults,
  •                                 &defaults);
    
  • num_defaults = cupsAddOption("PaperDimension", "Letter", num_defaults,
  •                                 &defaults);
    
  • num_defaults = cupsAddOption("ImageableArea", "Letter", num_defaults,
  •                                 &defaults);
    
  •  }
    
  • }
  • else if (have_a4)
  • {
  • /*
    
  •  \* The rest default to "a4" size...
    

- */

  •  num_defaults = cupsAddOption("PageSize", "A4", num_defaults,
    
  •                               &defaults);
    
  •  num_defaults = cupsAddOption("PageRegion", "A4", num_defaults,
    
  •                               &defaults);
    
  •  num_defaults = cupsAddOption("PaperDimension", "A4", num_defaults,
    
  •                               &defaults);
    
  •  num_defaults = cupsAddOption("ImageableArea", "A4", num_defaults,
    
  •                               &defaults);
    
  • }

  • num_defaults = cupsAddOption("PageSize", DefaultPaperSize,

  •                             num_defaults, &defaults);
    
  • num_defaults = cupsAddOption("PageRegion", DefaultPaperSize,

  •                             num_defaults, &defaults);
    
  • num_defaults = cupsAddOption("PaperDimension", DefaultPaperSize,

  •                             num_defaults, &defaults);
    
  • num_defaults = cupsAddOption("ImageableArea", DefaultPaperSize,

  •                             num_defaults, &defaults);
    

    }

    ppdClose(ppd);

    Index: scheduler/conf.h

    --- scheduler/conf.h (revision 7898)
    +++ scheduler/conf.h (working copy)
    @@ -98,6 +98,8 @@
    /* Default charset /
    *DefaultLocale VALUE(NULL),
    /
    Default locale */

  •       *DefaultPaperSize   VALUE(NULL),
    
  •               /\* Default paper size _/
        *ErrorPolicy        VALUE(NULL),
                /_ Default printer-error-policy */
        *RIPCache       VALUE(NULL),
    

@michaelrsweet michaelrsweet added this to the Stable milestone Mar 17, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.