IRC Logs

Log of #ghostscript at irc.freenode.net.

Search:
 <<<Back 1 day (to 2015/05/15)20150516 
bobna good afternoon (or whatever) guys14:54.32 
  Is it possible to capture a part of a pdf and output to another pdf or a png with ghostscript... With that I mean.. Not a whole page, but a rectangle 'screenshot'14:55.10 
  I'm overwhelmed by the options... perhaps -dUseCropBox ?14:55.41 
sebras bobna: the ghostscript developers are mostly active here during european and us business hours during weekdays. so you might have to wait a bit to get an answer.15:27.21 
kens bobna you cna certainly do something like what you are asking, but with some caveats15:29.05 
  The main one is that the new PDF you create is not the same as the one you started with....15:29.32 
  The 'easy' way to do what you want is just to add a CropBox to the new PDF file (overriding any one already present), using a pdfmark.15:29.56 
bobna kens: that wouldn't be a big problem15:29.59 
kens This doesn't remove the cropped out content, it just moves the 'window' that the viewer displays.15:30.19 
bobna and then i would have to capture that somehow to a png rather15:30.45 
kens DO you want a PNG ?15:30.59 
  I thougth you wanted a new PDF file.15:31.05 
bobna png would be fine too15:31.16 
  maybe even better15:31.22 
kens OK then you nmeed to set the media size to the required size.15:31.39 
  -g or -sPAPERSIZE or _DDEVICEWIDTHPOINTS etc15:31.53 
  also -dFIXEDMEDIA so that the interpreter doesn't change it to ahwtever is in the PDF file.15:32.11 
  THen you need to move the bootom corner of the PDF file.15:32.20 
  THe bottom left corner is normally at 0,0,I presume you want to capture osme part hat may not include the bottom left corner15:32.48 
bobna now that i think of it, perhaps it's easier to just make a png of the whole page and do the cutting from the png15:32.59 
kens Well that may be easier :-)15:33.10 
  For a one-ff task15:33.17 
bobna no it's ment to be integrated in a program15:33.41 
kens Well, its up to you. YOu can do it in one operation in Ghostscript, provided all the pages you want are the same15:34.25 
bobna the idea is to have let the user configure some coordinates on where to cut into pieces and then do a batch-processing15:34.59 
kens Lets take an example; Say you want as 2 inch square area, which starts at x = 1 inch, y = 2 inches15:35.34 
  YOu would start by setting -dDEVICEIWDHTPOINTS=144 -dDEVICEHIGTPOINTS=144 -dFIXEDMEDIA15:35.55 
  THat sets up a canvas 2x2 inches, fixed size15:36.09 
  THe you would add -c "<</BeginPage {-72 -144 translate}>>setpagedevice -f15:36.40 
  That tells the interpreter to shift the contents down one inch and left 2 inches when drawing.15:37.07 
  That should be it.15:37.17 
  Or it would be if I could type :-)15:37.36 
  -dDEVICEWIDTHPOINTS=144 -dDEVICEHEIGHTPOINTS=144 -dFIXEDMEDIA -c "<</BeginPage {-72 -144 translate}>> setpagedevice" -f15:38.24 
  PostScript units are 72 to the inch, so its easiest to work in inches, but all those numbers can be flats, so if you want to use metric, you just have to do the conversion.15:39.09 
  If you want everything in pixels then you also need to thnk about the resolution.15:39.21 
  -r sets the resolution.15:39.31 
bobna seems i will have to spend a couple of hours minimum to get it working :|15:40.20 
  total ghostscript newbie15:40.30 
kens I htnk you can also do ths with MuPDF, which is probably even easier, but I'm less expert with that, and it seems like nobody is online who knows it better than me15:40.40 
  Let me have a quick look there15:40.50 
  Hmm well it can certainly output PNG, and you can select a size, but I'm not sure thre's a way to crop out the bit you want15:41.53 
bobna but thanks a lot kens, at least now i have an idea15:42.31 
  maybe in the future if i want to be able to write back to the pdf, i will have a look at ghostscript again15:42.46 
  but for now i think i will just stick with a simple ->png converter and cut it into pieces from there :)15:43.06 
kens Feel free to come back and ask more questions. If you can make it office hours in the UK then there will be more people here15:43.19 
bobna i copied your answer for later reference, perhaps i can make sense of it later ;)15:44.09 
kens Ths channel is logged, you can always check the logs (soeone may come up with a better answer)15:44.36 
  http://ghostscript.com/irclogs/current.html15:44.45 
bobna i know but it's easier to have it somewhere in my own notes :)15:44.59 
kens :-)15:45.06 
kens runs off again, bye....15:48.53 
rayjj mvrhel_laptop: I have clear progressions on some of the ps3cet files. 09-49a.PS, 12-07B.PS and comparefiles/ridt91.eps. Others are inconclusive. Changes are at the end of: http://www.ghostscript.com/regression/cgi-bin/clustermonitor.cgi?report=ray22:23.30 
  it doesn't change from the previous, simple, calculation for num_levels < 256 (I checked and the logic would never have a delta_sum != 0 for that case). For == 256, I've verified that it matches the HT tiling code, as expected.22:25.15 
  for > 256 the master code is totally broken, resulting in non-monotonic behavior. However, my "fudge" for the 256 case doesn't exactly match the HT tiling code. Since it is a progression, I think I should commit it and open a new bug for matching the non-fast HT tiling code22:27.03 
 Forward 1 day (to 2015/05/17)>>> 
ghostscript.com
Search: