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

psnup does not respect output paper size #31

Closed
AndyM48 opened this issue Nov 20, 2020 · 19 comments
Closed

psnup does not respect output paper size #31

AndyM48 opened this issue Nov 20, 2020 · 19 comments

Comments

@AndyM48
Copy link

AndyM48 commented Nov 20, 2020

Converting a postscript file using psnup always outputs in letter size.
To reproduce take a four A4 page postscript file and convert it to booklet page order

psbook printfile.ps psbook.ps

Convert the pages to two up

psnup -p A4 -2 psbook.ps fpbooklet.ps

The result is a booklet file on Letter format.

@rrthomas
Copy link
Owner

What version of psutils is this? Your example works fine for me with the most recent version, 2.04 (and it should work in any 2.xx version). There's a (passing) test for setting a non-default output paper size in the current version. I also checked outputting Letter size paper, since A4 is the default on my system.

@AndyM48
Copy link
Author

AndyM48 commented Nov 21, 2020

I am using psutils 2.03 running on Arch linux 5.9.9. My default paper size is also A4

@AndyM48
Copy link
Author

AndyM48 commented Nov 21, 2020

There is an error reported from pstops:

$ psbook printfile.ps psbook.ps
[1] [2] [3] [4] Wrote 4 pages
$ psnup -p A4 -2 psbook.ps fpbooklet.ps
Use of uninitialized value $upto in subtraction (-) at /usr/bin/pstops line 277, line 12554.
[1] [2] Wrote 2 pages

@AndyM48
Copy link
Author

AndyM48 commented Nov 21, 2020

Could not attach the postscript file so:
$ pdf2ps printfile.pdf

printfile.pdf

@rrthomas
Copy link
Owner

Nice choice of file! That particular error is fixed by 2.04, and I confirm that using your attached printfile.pdf with pdf2ps and then running your test, I get A4 output.

I also tried running the test with 2.03. I get the same error as you do (I believe it's harmless by the way), and I again get A4 output.

@rrthomas
Copy link
Owner

I tried changing my default paper size to Letter, and ran the test, and again I get A4 output. I'm sorry, I'm running out of ideas here.

@rrthomas
Copy link
Owner

You can attach your original PostScript file by adding the suffix .txt. Could you please attach that and your fpbooklet.ps file?

@AndyM48
Copy link
Author

AndyM48 commented Nov 21, 2020

Something is strange here. I attached the file "printfile.pdf". It is a text file from the psnup man page, printed in pdf format.

Here are all the files used, having converted printfile.pdf to printfile.ps, in .zip format:
psnup.zip

@rrthomas
Copy link
Owner

Thanks. fpbooklet.ps in your Zip file is A4 format.

@AndyM48
Copy link
Author

AndyM48 commented Nov 21, 2020

I really do appreciate your time on this!
If I look at the file using ghostscript I get:
ghostscript
If I convert the file to pdf using ps2pdf I get:
fpbooklet.pdf
I have no idea what is going wrong?

@rrthomas
Copy link
Owner

If I open fpbooklet.ps in gs (I was using evince before), it displays normally. (I'm using GhostScript 9.50 as supplied with Ubuntu 20.04.) Anyway, the DocumentMedia and BoundingBox lines say:

%%DocumentMedia: plain 595 842 0 () ()
%%BoundingBox: 0 0 595 842

which are A4 (divide by 72 and multiply by 2.54!).

The obvious thing that comes to mind is the default paper size configured for your installation of GhostScript; in any case, the output of psutils is clearly correct, so I'm closing the bug. I suggest you add "-sPAPERSIZE=a4" to your invocation of ps2pdf.

@AndyM48
Copy link
Author

AndyM48 commented Nov 21, 2020

Thank you for your help and I apologize for my ignorance. :)

@rrthomas
Copy link
Owner

No problem! It turns out that Debian's ghostscript (and hence Ubuntu's) uses libpaper, so it respects the default system paper size. I guess Arch doesn't do that. You can however set ghostscript's default paper size in gs_init.ps.

@rrthomas
Copy link
Owner

Alternatively, you've not configured libpaper's default paper size?

@AndyM48
Copy link
Author

AndyM48 commented Nov 21, 2020

Thanks - may be not quite so stupid :)

@AndyM48
Copy link
Author

AndyM48 commented Nov 21, 2020

Absolutely right. "paper" is set correctly. May be paper should also let libpaper?

@rrthomas
Copy link
Owner

Thereby hangs a tale! Paper is designed as a replacement for libpaper, and I'm trying to work out how to get there…

@AndyM48
Copy link
Author

AndyM48 commented Nov 21, 2020

I suppose you would not consider a rewrite of ghostscript while you are at it? :) :) :)

@rrthomas
Copy link
Owner

The idea is to have ghostscript use the new libpaper, indeed.

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

No branches or pull requests

2 participants