Log of #ghostscript at irc.freenode.net.

Search:
 <<<Back 1 day (to 2019/03/18)20190319 
inkbottle How can I make a 2-up pdf, knowing the numbers beforehand?16:45.15 
  I tried the script there https://stackoverflow.com/questions/30545382/ghostscript-for-pdf-how-to-fit-4-pages-into-116:45.26 
  but had huge white areas, even though I had done a successful cropping before.16:46.21 
chrisl inkbottle: You might want to try adding either -dUseCropBox or -dUseArtBox to the command line, with that utility16:50.40 
inkbottle chrisl: OK, I do that right now16:51.39 
  chrisl: with -dUseCropBox, I got rid of top and right margin; so definitely an improvement but still a lot of white space16:58.13 
  -dUseArtBox didn't make changes16:59.15 
chrisl inkbottle: If I'm reading that code correctly, it just rotates and scales onto the "default" page size, it doesn't resize the output page to suit the input. You can either set the page size to something that'll work on the command line, or rewrite the utility to do something like that - I suspect the reason it doesn't do that is because there's not requirement for all pages in a PDF to be the same dimension17:03.07 
  erm, dimensions....17:03.17 
kens I was on #mupdf....17:03.30 
  I have an answer to this question on SO:17:03.48 
  https://stackoverflow.com/questions/22138567/shrink-pdf-to-fit-onto-one-page-using-ghostscript/22145864#2214586417:03.49 
  ah same program different question and answer :-)17:04.14 
inkbottle too bad17:05.34 
kens Its a PostScript program and it even has debug output so you can see what its doing, it should be easy enough to alter17:06.04 
  You'll need to set Verbose to get that out, but I'd recommend doing so17:07.00 
  It clearly starts by getting the dimensions of the current media and the dimensions of the PDF file pages. It assumes all pages in the PDF file are the same size.17:07.37 
inkbottle It's quite lengthy though; I've read it, but I'm not skilled enough to amend it usefully (also, it does do waht it says, only leaving too much white space)17:08.02 
kens Then it tries to decide if the media is landscape or portrait, and the PDF pages are landscape or portrait, and tries to make them match17:08.15 
  The white space is part of the program, you can change it17:08.36 
  I can't see why it would be leqaving extra white space17:09.10 
  You would need to post an example somewhere17:09.19 
inkbottle kens: that file:http://www.cse.chalmers.se/~ulfn/papers/afp08/tutorial.pdf; and all what I did: https://paste.debian.net/1073775/17:11.03 
kens chrisl what would be involved in trying to use clang instead of gcc to build GS ?17:11.13 
  inkbottle: give me a minute....17:11.18 
chrisl kens: From git?17:11.32 
kens The latest one about Chrome OS says they are using clang17:11.48 
  I'm wondering if we cna try that17:11.54 
chrisl ./autogen.sh CC=clang17:12.03 
kens OK I'll tell them that I'll try that tomorrow. May have to install clang first :-)17:12.25 
chrisl You might want to ask if they are using any other options for configure/autogen.sh - if they haven't told us already17:13.28 
inkbottle (trying to understand something of the script...)17:14.00 
chrisl kens: The n-up script linked above doesn't set a pagesize, that I can see17:14.37 
kens No, it just uses the current media size I believe. It sets the scaling from that and the PDF boox17:15.01 
  The assumption is that you set hte media size you want first, then it scales/rotates the pages onto that.17:15.28 
  IIRC17:15.30 
  Sorry writing email, will be back in a mo17:15.44 
chrisl Yes, so if the original pages don't have the same aspect ratio as the output page, you'll get "extra" white space17:15.53 
kens The program tries to match the aspect ratios of the media and hte PDF boxes17:16.35 
  But its always possible you're going to get *some* white space, unless we scale the pages differently in each direction.17:17.02 
inkbottle using verbose, I can see I have both PDFWidth is 483 and PageWidth is 612: the initial cropping operation was not so successful17:19.01 
  from the point of view of the script17:19.13 
  cropping arguments were: 132 174 484 72417:19.50 
kens 612x792 will be the default media size, that'll be US Letter17:20.09 
  OK mail sent, let me get the PDF file now17:21.21 
inkbottle (if I am to actually print on paper, it'll be a4)17:22.54 
  gs -q -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sPAPERSIZE=a4 -dFIXEDMEDIA -dPDFFitPage -o markedA4.pdf -f marked.pdf17:26.43 
  the above line failed to change media size17:26.56 
  I cut and past the relevant part of the script to test that17:27.22 
kens OK so my default media size is A4 not US Letter17:28.48 
  The PDF is on US Letter17:29.23 
inkbottle gs -q -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sPAPERSIZE=letter -dFIXEDMEDIA -dPDFFitPage -o markedLetter.pdf -f marked.pdf17:29.59 
  verbose shows no differences in the concern of page size17:30.16 
kens Fitting 2 pages on the sheet is best done by rotating the A4, and that results in the Letter pages beign shrunk to 0.717:30.17 
inkbottle sure17:30.35 
kens Sorry, teh PDF is A417:31.17 
  my default media is also A417:31.31 
inkbottle fine17:31.36 
kens If I chaneg to Letter the scaling changes form 0.7 to 0.617:32.08 
  Looking at your original file, it already has a great deal of white space17:33.04 
  Huge margins at top/bottom/left/right17:33.18 
inkbottle L612x79217:34.11 
  letter*17:34.15 
kens Looking at the original tutorial file in 2 paghe side by side mode in Acrobat looks very similar to the resutl of 2-up.ps17:34.21 
inkbottle conversion to a4 failed17:34.23 
  (yes, definitely not one'd want)17:35.08 
kens So I'm not really sure what your problem is.17:35.53 
  If you want to trim off the white space, you need to start by doing that in the original file, the 2-up program dfoesn't attempt to do that17:36.19 
  It just shrinks the entire page, white space and all17:36.30 
inkbottle I did make a cropping before: gs -q -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -o marked.pdf -c "[/CropBox [132 174 484 724] /PAGES pdfmark" -f "tutorial.pdf"17:38.58 
kens Time for me to be off. If you have any questions feel free to put them here and I'll read them tomorrow and try to reply sensibly17:39.04 
  Adding a CropBox is nto the same as croppign the file17:39.22 
  By default Ghostscript uses the MediaBox, not the CropBox17:39.35 
  If you want ot use the CropBox you'll have to add -dUseCropBox17:39.48 
inkbottle OK, how do I really change that then17:39.52 
  I did that17:39.59 
  oh, in the first line? (I can try that)17:40.18 
kens No,. in the 2-up invocation17:40.30 
inkbottle that I did, little improvement17:40.42 
  and still 612x792 everywehre17:40.59 
kens If you want the 2up file on somethign otehr than Letter you need to specify it. Add -dDEVICEIWDTHPOINTS=595 -dDEVICEHEIGHTPOINTS=842 for A417:41.41 
inkbottle OK17:41.56 
kens I'm serious about going now though, its late here17:42.06 
inkbottle I'm sure I'll be able to finish it by myself17:42.30 
  I've learned a lot here: thanks17:42.50 
  Hacking the file: https://paste.debian.net/1073811/18:46.48 
  sed -n '264,$p' 2-up.ps > SomeScript.ps18:48.10 
  Then I'm defining the parameters by hand18:48.26 
  Error: /undefined in pdfgetpage18:48.54 
  l.163: 1 pdfgetpage get_any_box18:49.36 
  seems like something called pdfgetpage is defined here18:50.00 
  but I don't understand the syntax18:50.10 
  (not /pdfgetpage ... def)18:50.38 
  so pdfgetpage is a command: but described nowhere19:05.32 
  I managed using the full script 2-up.ps, but changing some parameter values in the middle20:07.41 
  missing the first page but I've already read it20:09.51 
  The understanding things part will have to wait; otherwise satisfactory20:10.29 
 Forward 1 day (to 2019/03/20)>>> 
ghostscript.com #mupdf
Search: