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

reverse printing in landscape, nup, and other configurations is broken #1725

Closed
michaelrsweet opened this issue May 25, 2006 · 4 comments
Closed
Milestone

Comments

@michaelrsweet
Copy link
Collaborator

Version: 1.2-current
CUPS.org User: david.gelphman

When end_nup is called and the code needs to emit "userdict/ESPsave get restore", that code is written using puts rather than doc_puts, which puts all the data before any page rather than as part of a given page.

Diffs for the fix are below:

diff filter/pstops.c /XSource/easysw/cups/filter/pstops.c
2c2

< * "$Id: pstops.c 164 2006-05-23 17:38:13Z jlovell $"

  • "$Id: pstops.c 5569 2006-05-22 18:30:52Z mike $"
    1859c1859
    < doc_puts(doc, "userdict/ESPsave get restore");

    puts("userdict/ESPsave get restore");
    2938c2938
    < * End of "$Id: pstops.c 164 2006-05-23 17:38:13Z jlovell $".

  • End of "$Id: pstops.c 5569 2006-05-22 18:30:52Z mike $".
@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: david.gelphman

Actually the fix should be:

doc_puts(doc, "userdict/ESPsave get restore\n")

instead of

doc_puts(doc, "userdict/ESPsave get restore")

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: mike

Actually, it looks like the problem is much larger than this - we need to update the WriteLabels function to accept a cups_file_t * argument so that the labels go to the temp file as well...

Working on it...

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: mike

Fixed in Subversion repository.

Please verify the attached patch...

@michaelrsweet
Copy link
Collaborator Author

"str1725.patch":

Index: pstops.c

--- pstops.c (revision 5595)
+++ pstops.c (working copy)
@@ -49,6 +49,7 @@

  • set_pstops_options() - Set pstops options...
  • skip_page() - Skip past a page that won't be printed...
  • start_nup() - Start processing for N-up printing...
  • * write_labels() - Write the actual page labels.
    */

/*
@@ -204,6 +205,7 @@
size_t linesize);
static void start_nup(pstops_doc_t *doc, int number,
int show_border, const int *bounding_box);
+static void write_labels(pstops_doc_t *doc, int orient);

/*
@@ -1856,15 +1858,15 @@
int number) /* I - Page number */
{
if (doc->mirror || Orientation || doc->number_up > 1)

  • puts("userdict/ESPsave get restore");
  • doc_puts(doc, "userdict/ESPsave get restore\n");

switch (doc->number_up)
{
case 1 :
if (doc->use_ESPshowpage)
{

  • WriteLabels(Orientation);
    
  •      puts("ESPshowpage");
    
  • write_labels(doc, Orientation);
    
  •      doc_puts(doc, "ESPshowpage\n");
    
    }
    break;

@@ -1878,7 +1880,7 @@
* Rotate the labels back to portrait...
*/

  •   WriteLabels(Orientation - 1);
    
  •   write_labels(doc, Orientation - 1);
    

    }
    else if (Orientation == 0)
    {
    @@ -1886,7 +1888,7 @@
    * Rotate the labels to landscape...
    */

  •   WriteLabels(doc->normal_landscape ? 1 : 3);
    
  •   write_labels(doc, doc->normal_landscape ? 1 : 3);
    

    }
    else
    {
    @@ -1894,18 +1896,18 @@
    * Rotate the labels to landscape...
    */

  •   WriteLabels(doc->normal_landscape ? 3 : 1);
    
  •   write_labels(doc, doc->normal_landscape ? 3 : 1);
    

    }

  •      puts("ESPshowpage");
    
  •      doc_puts(doc, "ESPshowpage\n");
    

    }
    break;

    default :
    if (is_last_page(number) && doc->use_ESPshowpage)
    {

  • WriteLabels(Orientation);
    
  •      puts("ESPshowpage");
    
  • write_labels(doc, Orientation);
    
  •      doc_puts(doc, "ESPshowpage\n");
    

    }
    break;
    }
    @@ -2935,5 +2937,51 @@

    /*

  • * 'write_labels()' - Write the actual page labels.

  • * This function is a copy of the one in common.c since we need to

  • * use doc_puts/doc_printf instead of puts/printf...

  • /
    +
    +static void
    +write_labels(pstops_doc_t *doc, /
    I - Document information */

  •         int          orient)  /\* I - Orientation of the page */
    

    +{

  • float width, /* Width of page */

  • length; /* Length of page */

  • doc_puts(doc, "gsave\n");
  • if ((orient ^ Orientation) & 1)
  • {
  • width = PageLength;
  • length = PageWidth;
  • }
  • else
  • {
  • width = PageWidth;
  • length = PageLength;
  • }
  • switch (orient & 3)
  • {
  • case 1 : /* Landscape */
  •    doc_printf(doc, "%.1f 0.0 translate 90 rotate\n", length);
    
  •    break;
    
  • case 2 : /* Reverse Portrait */
  •    doc_printf(doc, "%.1f %.1f translate 180 rotate\n", width, length);
    
  •    break;
    
  • case 3 : /* Reverse Landscape */
  •    doc_printf(doc, "0.0 %.1f translate -90 rotate\n", width);
    
  •    break;
    
  • }
  • doc_puts(doc, "ESPwl\n");
  • doc_puts(doc, "grestore\n");
    +}

+/*

  • End of "$Id$".
    */

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant