| <<<Back 1 day (to 2014/11/21) | 20141122 |
nesQuick | Hey folks, is this actually the right place for "user questions"? :) | 06:24.01 |
avih | nesQuick: it probably is wrt MuPDF and MuJS, but it's weekend so answers may lag. give it a go though ;) | 08:06.58 |
Robin_Watts | nesQuick: Shoot | 08:42.19 |
nesQuick | @Robin_Watts I've a pdf, containing images, and I want to reduce the resolution of the bigger images in order to limit the filesize in general | 08:44.37 |
Robin_Watts | nesQuick: MuPDF (as it currently stands) is not the tool for you then. | 08:45.25 |
| You can probably achieve that using ghostscript, but you have to understand what will be going on. | 08:45.49 |
nesQuick | haha, I think that is my problem tho | 08:46.09 |
Robin_Watts | When you run a PDF through gs to get a new PDF, it doesn't 'change' the PDF. It completely rebuilds a new PDF that looks like the old one. | 08:46.25 |
nesQuick | ah, ok. But that isn't necessarily bad | 08:46.46 |
Robin_Watts | Any extra information (like indexes, or bookmarks etc) will be lost. | 08:46.52 |
nesQuick | That's fine :) | 08:47.28 |
| this is what I got so far https://gist.github.com/nesQuick/d6c26a79913ba034c0dd | 08:47.47 |
Robin_Watts | kens is the expert here. | 08:49.34 |
nesQuick | But I'm lacking the part where and how I can limit the sizeof bitmap images (jpg/png) | 08:49.39 |
Robin_Watts | He's usually around on a saturday. Usually. | 08:50.05 |
| I suspect he may tell you to steer away from -dPDFSETTINGS | 08:50.29 |
| but I can't immediately offer more guidance. | 08:50.40 |
nesQuick | @Robin_Watts ok. cool. no worries, thanks for your insight. I learned more about ghostsript already :) | 08:53.06 |
| I'm going to wait for him then, thank you! | 08:53.21 |
kens | nesQuick Robin_Watts is correct IMO, you don't want to use PDFSETTINGS, those set a bunch of variables, many of which you don't need or (probably) want. You are spot on with the DownsampleColorImages, ColorImageResolution but you will also want to set ColorImageDownsampleThreshold and ColorImageDownsampleType. You may well also choose to set ColorImageFilter so as not to use JPEG. | 09:09.26 |
| There are of course similar settings for Gray and Mono images. I'd apologise for the slew of required settings, but these are available to match Adobe Distiller, its not our choice..... | 09:10.35 |
| Note that NumRenderingThreads only affects rendering, and since pdfwrite doesn't render to a bitmap, that setting has no effect at all. By selecting a CompatibilityLevel of 1.3 your are forcing any transparency to be converted to an image, which will potentially *increase* the file size. | 09:12.19 |
| You cannot limit explicitly the size of the images containerd in the output PDF file, all you can do is select a new resolution for them. | 09:12.59 |
| Here's a similar request on Stack Overflow: | 09:14.13 |
| http://stackoverflow.com/questions/14989959/how-to-resize-resample-bitmap-images-within-pdfs-and-maintain-vector-overlays/15065276#15065276 | 09:14.13 |
nesQuick | @kens: wow, thanks for the answers, so what CompatibilityLevel would you reccomend? | 10:18.37 |
avih | tor, should this return int? : double js_tointeger(js_State *J, int idx); | 10:18.39 |
kens | nesQuick : I'd leave it untouched, or at least set it to 1.4 so transparency is not converted to an image | 10:19.00 |
nesQuick | I'd like to add a question to this, anc I limit the memmory consumption anyway? :) | 10:20.41 |
kens | Hmm limit which memory consumption ? YOu mean while processing the input PDF file ? | 10:21.19 |
nesQuick | yeah | 10:21.28 |
kens | THen the answer is no, there is no way ot limit the memory used by pdfwrite. | 10:21.44 |
| It stores a metric tonne of stuff in meory for performance reasons. | 10:22.00 |
| We assume it will always be running on a 'desktop' or better class of device, rather than say a mobile platofrm | 10:22.22 |
| OTOH it shouldn't normally be using monstrous amounts of memory | 10:22.38 |
nesQuick | Actually i use it on heroku where a dyno is limited to 512mb otherwise they kill the dyno when exceeding 200% of that | 10:22.56 |
kens | THat usually only happens when converting transparency to a bbitmap, and IIRC the recent versions should be a lto better about that too | 10:23.03 |
nesQuick | w0000t :D with your tweaks it ran amazingly fast :O | 10:23.43 |
kens | pdfwrite doesn'#t 'usually' use that much memory, but it depends hugely on the file and how you process it. Also, are you using a recent version of GS ? | 10:23.50 |
| nesQuick : Rendering the transparency is slow (bit images, default resolution is 720 dpi) and uses large amounts of memory, particularly in older versions | 10:24.21 |
| s/bit/big/ | 10:24.33 |
nesQuick | from 153M to 1.8M | 10:24.34 |
kens | Yeah well that sounds like your PDF file has transparency in it all right | 10:24.51 |
nesQuick | yeah, all my odfs are slidedecks, there is often lots of transperency in there | 10:25.25 |
kens | The later versions of GS are supposed to use a display list to reduce the memory requirement for that rendering, so it shouldn't get *that* big any more. I'm not certain if the memory controls work for that, I assuem they do, but I didn't write that code | 10:25.37 |
nesQuick | I think lots of the stuff were caused by the transperency as you mentioned | 10:26.06 |
| λ slidr.io git:(master) heroku run "gs --version" | 10:26.17 |
| Running `gs --version` attached to terminal... up, run.4448 | 10:26.17 |
| 9.14 | 10:26.17 |
kens | Yeah, going to 1.3 would be bad for that purpose. | 10:26.18 |
nesQuick | Is that recent? | 10:26.21 |
kens | Its recent, I'm not certain if its recent enough, the current version is 9.15 | 10:26.45 |
| There are switches to control memory usage of display lists | 10:27.03 |
| -dMaxBitmapSize is one, but I'm having trouble finding that documented | 10:27.59 |
nesQuick | I will implement the stuff you mentioned and then I might come back with more questions regarding memory. But as of now, it's blazingly fast and amazingly small. Thank you so much kens! | 10:28.13 |
kens | Oh, hsould be -dMaxBitmap | 10:28.13 |
| NP, glad its working for you | 10:28.25 |
nesQuick | Thanks again :) | 10:28.41 |
jas_ | hiii | 11:42.13 |
| sir | 11:42.16 |
| i m working on | 11:42.26 |
| android pdf viewr | 11:42.35 |
| and i want some fetures like seach | 11:42.46 |
| optimazation | 11:42.53 |
| hi | 11:43.12 |
ghostbot | Welcome to #ghostscript, the channel for Ghostscript and MuPDF. If you have a question, please ask it, don't ask to ask it. Do be prepared to wait for a reply as devs will check the logs and reply when they come on line. | 11:43.12 |
jas_ | hi | 11:43.24 |
ghostbot | Welcome to #ghostscript, the channel for Ghostscript and MuPDF. If you have a question, please ask it, don't ask to ask it. Do be prepared to wait for a reply as devs will check the logs and reply when they come on line. | 11:43.24 |
jas_ | hel | 11:44.19 |
| hello | 11:44.22 |
ghostbot | Welcome to #ghostscript, the channel for Ghostscript and MuPDF. If you have a question, please ask it, don't ask to ask it. Do be prepared to wait for a reply as devs will check the logs and reply when they come on line. | 11:44.22 |
nesQuick | does these things happen more often? :D | 11:45.09 |
jas_ | hi | 12:04.17 |
ghostbot | Welcome to #ghostscript, the channel for Ghostscript and MuPDF. If you have a question, please ask it, don't ask to ask it. Do be prepared to wait for a reply as devs will check the logs and reply when they come on line. | 12:04.17 |
jas_ | hi | 12:04.30 |
ghostbot | Welcome to #ghostscript, the channel for Ghostscript and MuPDF. If you have a question, please ask it, don't ask to ask it. Do be prepared to wait for a reply as devs will check the logs and reply when they come on line. | 12:04.30 |
jas_ | mupdf | 12:05.00 |
| reader | 12:05.06 |
| how to use in android | 12:05.20 |
| i want ti use it in android activity | 12:05.40 |
| and use features like seach bookmark | 12:05.56 |
| etc | 12:05.59 |
| Forward 1 day (to 2014/11/23)>>> | |