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

pdftops mangles output from Perl PDF::API2. #470

Closed
michaelrsweet opened this issue Dec 10, 2003 · 8 comments
Closed

pdftops mangles output from Perl PDF::API2. #470

michaelrsweet opened this issue Dec 10, 2003 · 8 comments

Comments

@michaelrsweet
Copy link
Collaborator

Version: 1.1.20
CUPS.org User: ash.dragonpaw

http://www.dragonpaw.org/~ash/earthdawn/ash.pdf (Also attached.)

This PDF file created using the Perl PDF::API2 library is printed slightly wrong. I do not know if this is a Cups problem for certain. On the top of the page, the alignment of the first two parts of the page is off. Both the title and the copyright line should be centered.

Though this exact version of the problem only happens with cups' pdftops filter, gpdf also displays the file wrong, but in a completely different way. Xpdf shows the file correctly. The xpdf-utils version of pdftops correctly converts it to PostScript, which then print properly.

Works fine:
pdftops ash.pdf ash.ps
lp ash.ps

Mangles the alignment:
lp ash.pdf

In gpdf, the alignment is good, but the font is missing, though the font metric loads properly. So letters are smashed together, but in the wrong font. (The correct font is a condensed face.)

Debian unstable, x86.

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: mike

Reassigned to 1.2.

What version of Xpdf are you using? I get the same non-centered output from Xpdf 2.01's pdftops and the CUPS pdftops, but the xpdf display shows the correct (centered) output.

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: ash.dragonpaw

[ash@ash]:/usr/local$ dpkg -l xpdf-utils
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Installed/Config-files/Unpacked/Failed-config/Half-installed
|/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)
||/ Name Version Description
+++-==============-==============-============================================
ii xpdf-utils 2.03-2 Portable Document Format (PDF) suite -- util

This is from Debian Unstable on x86. There may be some Debian patches on the version, I'm not sure.

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: mike

Can you post the converted PS file from your Xpdf pdftops utility? I am unable to get the output to look any different with any version of Xpdf's pdftops in use (i.e. I get the same offset title with all versions of Xpdf when converting to PS, but not when I display the file on the screen...)

Thanks!

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: ash.dragonpaw

Here is the file in question. (I just printed it to be certain, and it centers properly.)

One thing I should add, is that I think that ps2ps that is used at the end might also be involved in this problem. I typically disable it as all my printers are alreadys PostScript and I tend to embed the control strings in them for things like directly printing on 4x6 cards. If you print this file, and it's mangled, but print it to a PS printer with -raw, and it looks good, then the problem might be in both apps actually. They do share some of their codebase I'd assume, yes?

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: mike

OK, the file you attached was produced by Ghostscript (pdf2ps) and not by Xpdf (pdftops). I've confirmed that the problem is present in Xpdf through v3.00, and there are no patches for this in the Debian tree.

I will contact the Xpdf author and see if we can work up a fix...

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: mike

Please try the attached patch...

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: mike

Fixed in CVS - the anonymous CVS repository will be updated at midnight EST.

@michaelrsweet
Copy link
Collaborator Author

"str470.patch":

Index: Gfx.cxx

RCS file: /development/cvs/cups/pdftops/Gfx.cxx,v
retrieving revision 1.17
diff -u -r1.17 Gfx.cxx
--- Gfx.cxx 6 Feb 2004 21:01:51 -0000 1.17
+++ Gfx.cxx 9 Feb 2004 01:09:48 -0000
@@ -2227,6 +2227,10 @@
error(getPos(), "No font in show");
return;
}

  • if (fontChanged) {
  • out->updateFont(state);
  • fontChanged = gFalse;
  • }
    doShowText(args[0].getString());
    }

@@ -2237,6 +2241,10 @@
error(getPos(), "No font in move/show");
return;
}

  • if (fontChanged) {
  • out->updateFont(state);
  • fontChanged = gFalse;
  • }
    tx = state->getLineX();
    ty = state->getLineY() - state->getLeading();
    state->textMoveTo(tx, ty);
    @@ -2251,6 +2259,10 @@
    error(getPos(), "No font in move/set/show");
    return;
    }
  • if (fontChanged) {
  • out->updateFont(state);
  • fontChanged = gFalse;
  • }
    state->setWordSpace(args[0].getNum());
    state->setCharSpace(args[1].getNum());
    tx = state->getLineX();
    @@ -2272,6 +2284,10 @@
    error(getPos(), "No font in show/space");
    return;
    }
  • if (fontChanged) {
  • out->updateFont(state);
  • fontChanged = gFalse;
  • }
    wMode = state->getFont()->getWMode();
    a = args[0].getArray();
    for (i = 0; i < a->getLength(); ++i) {
    @@ -2308,10 +2324,6 @@
    char *p;
    int len, n, uLen, nChars, nSpaces, i;
  • if (fontChanged) {
  • out->updateFont(state);
  • fontChanged = gFalse;
  • }
    font = state->getFont();
    wMode = font->getWMode();

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