| <<<Back 1 day (to 2018/08/22) | 20180823 |
makei | Hi team is it possible to compress my 500mb PDF to 50mb with ghostscript | 10:45.44 |
kens | OK first point; Ghostscript (or more specifically the pdfwrite device) doens't 'compress' PDF files. Neither does it merge them or anything else like that. What it does is create a new PDF file where the content should be the same as the original. This is described in teh documentation in the VectorDevices.htm file, and you should probably read it. | 10:47.03 |
| Secondly, there's no possible way I can tell! | 10:47.11 |
| I;ve got no clue what's in your PDF file, so no idea whether it can be compressed, non-marking content removed, images downsampled or anything else | 10:47.43 |
| It all depends on what is in the PDF file which is using the space. | 10:48.06 |
makei | https://wetransfer.com/downloads/3da8efbd1b32e687cc99ade61aa362dd20180823104846/22da2ad7a939dad2e0d66886d11b272a20180823104846/121027 | 10:50.37 |
kens | Uh, are you expecting me to download a 500MB file ? O.O | 10:50.53 |
makei | you may find in the above link | 10:50.53 |
kens | Yeah not downloading and ananlysing a 500 MB file, sorry, I'm too busy | 10:51.12 |
makei | pdf contains of jpeg images and fonts | 10:52.09 |
| i have used following to compress gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dQUIET -dBATCH -sOutputFile=myNewFile.pdf /Users/rakesh/Desktop/Orginal.pdf | 10:52.51 |
kens | Well you can reduce teh size of images by downsampling them to a lower resolution. At the coost of quality of course. Fonts will be subset unless you tell pdfwrite not to, but I'd be surprised if they were a significant portion of 500MB | 10:52.57 |
| So that command line will produce a new file where the images are downsampled. So what's your problem ? | 10:54.35 |
makei | openjpeg warning: Found a misplaced 'cmap' box outside jp2h box openjpeg warning: Non conformant codestream TPsot==TNsot. | 10:59.28 |
kens | Well that's not ideal. You have an invalid JPX image | 10:59.53 |
makei | the above issue i found | 11:00.10 |
kens | That's an issue with yourt image, not Ghostscript | 11:00.23 |
makei | it downsize to 270mb but i want 50mb output | 11:01.08 |
kens | Well, then you can apply more downsampling of images | 11:01.33 |
| By altering the distiller parameters | 11:01.47 |
| Note that Ghostscript will **not** compress teh images with JPX (JPEG2000), because that is a patent-encumbered scheme. While it is legal to decompress it wihtout paying a royalty, compression requires licencing the patents. | 11:02.40 |
| So the resulting compression will be less than the original. That is, if you did not downsample the images, the outptu file would be *larger* than the input file. | 11:03.31 |
makei | Convert Ai image to pdf using ghostscript? | 11:10.11 |
kens | Ghostscript doesn't accept Adobe Illustrator native files as input. In general these may be either a subset of PostScript, or a PDF file, in which case Ghostscritp can work with them, but it is not guaranteed. Modern Adobe Illustrator files are PDF files which contain the native Illustrator file within them. If you create a new PDF file from those, Ghostscript will dump the native Illustrator file, which will make the resultign file smaller | 11:11.51 |
| Other than that, I do not understand what you are asking | 11:12.03 |
makei | psd to pdf with ghostscript? | 11:14.38 |
kens | No, no idea what you are asking | 11:14.52 |
makei | psd image to pdf using ghostscript | 11:15.26 |
kens | Is that a question ? | 11:15.34 |
rnissl | Hi, I've got a question regarding PDF page orientation | 13:40.15 |
kens | If you have a question, then just ask it | 13:40.35 |
rnissl | I've read VectorDevices.htm | 13:40.39 |
| section Setting page orientation | 13:40.55 |
| ps file contains %%Orientation: Landscape | 13:41.35 |
| pdf file is Portrait | 13:41.53 |
kens | Did you read ./AutoRotatePages ? | 13:42.17 |
rnissl | page doesn't contain any text, just an image | 13:42.29 |
| have tried -dAutoRotatePages=/None /All and /PageByPage | 13:43.03 |
| only -c "<</Orientation 3>> setpagedevice" does the trick | 13:43.24 |
kens | If there is no text then that will have no effect | 13:43.24 |
| You probably need to look at ProcessDSCCOmments | 13:44.24 |
rnissl | added -dParseDSCComments=true -- still Portrait | 13:45.06 |
kens | Well I can't really comment, without seeing the file. If you're convinced tehre is a bug then open a bug report and attach the file. | 13:45.38 |
rnissl | did you mean ParseDSCComments with ProcessDSCCOmments? | 13:46.27 |
kens | Not especially | 13:46.38 |
| I'm rather busy right at the moment, and without a file to investigate I don't have the time to indulge in random 'what if' thinking. | 13:47.12 |
| If you think its a bug then please open a bug report | 13:47.31 |
rnissl | ok, kens | 13:47.42 |
gpoo | Hi. I do not have access to https://bugs.ghostscript.com/show_bug.cgi?id=699623 (security issue), but I wonder if the next version with the fix will 9.25 (so, to prepare a patch for a library that calls gs) | 14:21.20 |
chrisl | The fix will be in 9.24 - which should be released during Septemeber | 14:22.24 |
kens | Security bugs are private until a patch is available | 14:22.24 |
| We will make the bugs public shortly after a patch is available | 14:22.43 |
| As Chrisl says you can get the next release, or watch the bug tracker, or view our Git repository looking for these patches | 14:23.15 |
| To pick them up before that. | 14:23.23 |
gpoo | we just run gs, we can check the version, anything lower we just will fail and not render anything. So, if 9.24 will be the version, that is enough for me. Thank you! | 14:24.19 |
| unfortunately, the issue is too easy to trigger :-( | 14:24.37 |
kens | Its unfortunate that responsible disclosure was not followed, the bug was made public before we were informed | 14:25.10 |
gpoo | they say they try to get in touch two weeks ago... I do not know how. Anyhow, I am not blaming anyone. | 14:26.09 |
kens | Oh sorry, that's a different problem | 14:26.22 |
| But it will still be in the next release | 14:26.49 |
chrisl | Solving that one fully has taken longer than I expected - the solution was simple, the side effects were less so | 14:27.07 |
rnissl | kens, I couldn't create a simple test case yet, but I found the reason for incorrect orientation | 15:40.59 |
kens | OK | 15:41.07 |
rnissl | ghostscript's PDFA_def.ps starts with %! and my mailFilterText.ps contains comments like that %%%%% | 15:42.02 |
kens | Oh well you didn't say..... | 15:42.53 |
rnissl | if I put a '% ' (without the ') in front of these sequences, everything works as expected. | 15:44.02 |
| so they are parsed as regular comments | 15:44.28 |
kens | DSC Comments are specifically tow % characters | 15:45.00 |
| s/tow/two/ | 15:45.08 |
rnissl | right, but %! isn't a DSC comment, is it? | 15:45.26 |
kens | Yes, its a special | 15:45.43 |
rnissl | is it necessary that PDFA_def.ps starts with %! ? | 15:45.51 |
kens | It introduces the PS-ADOBE | 15:45.53 |
| No it isn't required | 15:46.09 |
rnissl | could it be removed in 9.24 then? | 15:46.33 |
kens | It could be, but I don;'t plan to | 15:46.46 |
| You have to modify that file anyway. | 15:47.23 |
rnissl | well, so far I had no need to | 15:47.53 |
kens | Huh, how are you specifying the ICC profile then ? | 15:48.09 |
rnissl | doesn't it reference srgb.icc by default? | 15:49.11 |
| I just copy srgb.icc to current working directory | 15:49.28 |
kens | Yes, but that will only work if you have a profile by that name in the current working directory at teh time the interpreter accewses it | 15:49.43 |
rnissl | right | 15:49.53 |
kens | So rather than modify the file, you copy a profile ? I'd modify the file. | 15:50.19 |
| Give it a different name and you won't have to copy the profile every time we upgrade or whatever | 15:50.41 |
| And then, you can remove the comments as you see fit | 15:51.00 |
rnissl | ok | 15:51.09 |
| a different issue I've just realized with the problematic file, indepentent of orientation and comments | 15:52.02 |
| I get the message: | 15:52.17 |
| Attempting to write a DeviceN space with an inappropriate alternate, | 15:52.21 |
| have you set ColorConversionStrategy ? | 15:52.21 |
| I've used -sColorConversionStrategy=/UseDeviceIndependentColor. | 15:52.40 |
kens | Yeah that's not going to work | 15:53.08 |
| DeviceIndependentColour means an ICC profile | 15:53.25 |
rnissl | and the image in the pdf file looks like it has been changed from grayscale to mono | 15:53.44 |
kens | Exactly what profile should we use for a six colour Hexachrome DeviceN specification, and how should we generate such a profile ? | 15:53.50 |
| If you are using DeviceN you will have to choose a device colour for the alternate, same is true for Separation | 15:54.18 |
| You can't use DeviceIndependentColor | 15:54.29 |
rnissl | I must admit, I'm not used to that | 15:55.34 |
kens | There is no real way for us to know what ICC profile we should use for a Separation or DeviceN colour space. | 15:56.07 |
rnissl | the problematic file is a CAD drawing and the drawing is embedded into the pdf as grayscale bitmap | 15:56.17 |
kens | Well the warning says its using DeviceN | 15:56.35 |
| Obviously without seeing teh file I cannot possibly comment further | 15:56.49 |
rnissl | I wonder why this pdf file should require DeviceN | 15:56.55 |
kens | *requires* and *contains* are not the same thing | 15:57.11 |
| Its entirely possible that its a /DeviceN [/Black] specification | 15:57.30 |
rnissl | should /DeviceN appear in the ps file then? | 15:58.01 |
kens | Well yes | 15:58.13 |
| But that may be hard to determine | 15:58.24 |
rnissl | PDF printed with Acrobat Reader on Windows PS printer driver | 15:58.25 |
kens | So you started with a PDF file, pritned it to PostScript and tehn are going back to a PDF file ? | 15:59.05 |
| "What coudl possibly go wrong" | 15:59.18 |
rnissl | well, a lot will go wrong, especially for the intent of my colleague | 16:10.09 |
kens | So why are you doing that ? | 16:10.22 |
rnissl | if I remember correctly, ghostscript will omit paths from a pdf which are hidden for example behind a filled rectangle | 16:11.15 |
kens | I believe you remember incorrectly | 16:11.26 |
| paths will only be dropped if they are completely clipped out in the output | 16:11.49 |
rnissl | ok, then everything that's out of clipping path | 16:11.51 |
kens | so off the page or similar | 16:11.53 |
| Also, sending it via PostScript won't change that behaviour | 16:12.27 |
| If its clipped in the PDF it will be clipped in teh PostScript | 16:12.39 |
| so the eventual new PDF file will not contain the path | 16:12.49 |
rnissl | ok, so they wanted to hide some confidential information by adding white rectangles to the pdf with Acrobat | 16:13.29 |
kens | Oh, bad idea | 16:13.38 |
| That's entirely easy to remove | 16:13.48 |
| And trivial to detect | 16:13.55 |
| You need to apply proper redaction if you want to do that | 16:14.06 |
rnissl | and printing them through my PDFmail should remove the covered areas in the final pdf | 16:14.42 |
kens | I rather doubt that it will | 16:14.59 |
| Unless you print from somethign other than Adobe Acrobat | 16:15.07 |
rnissl | even if these rectangles would modify the clipping area, as this special pdf file has a single bitmap in background | 16:15.20 |
kens | When Acrobat prints to a PostScript printer what it does is send the entire PDF file, along with a PostScript program which reads it and turns it into PostScript | 16:15.40 |
rnissl | the information will still be there if one removes the clipping area from the final pdf | 16:15.41 |
kens | You aren't talking about clipping, you said white rectangles, that's not the same thing | 16:16.08 |
| And again, there is no difference in taking the PDF file to Ghostscript than there is in printing to PostScript and then sending teh PostScript to Ghostscript | 16:16.49 |
rnissl | yes, that's how they are trying to do it, and clipping would be a way to omit some paths as just talked about | 16:17.05 |
| but it will not work with that single bitmap | 16:17.13 |
kens | Then you don't need to pritn to PostScript | 16:17.18 |
| Printing to PostScritp gains you nothing, because essentially the PDF file is contained in teh PostScript program | 16:17.44 |
rnissl | well, Acrobat Reader can print as image, then it may work as expected | 16:17.50 |
kens | You could take the original PDF file and send it to Ghostscript and get the same reuslt | 16:18.02 |
| Yes if you print as an image then it will work | 16:18.12 |
| It will produce a huge ugly PDF file that won't print well at any other resolution, or on screen, but hey | 16:18.38 |
| Or you could use a proper redaction tool | 16:18.51 |
rnissl | as the original CAD drawing in that pdf file is already a bitmap, it won't make a big difference | 16:22.25 |
| kens, can you give me some more information about -sColorConversionStrategy | 16:23.59 |
kens | Probably not, its in the documentation | 16:24.22 |
rnissl | using RGB looks good | 16:26.35 |
| CMYK too | 16:27.44 |
| I'm a bit lost about what to choose instead of UseDeviceIndependentColor | 16:29.22 |
kens | Up to you | 16:29.43 |
rnissl | especially, if -sProcessColorModel may not match | 16:29.58 |
kens | -sProcessColorModel is set by ColorConversionStrategy, mostly | 16:30.17 |
rnissl | haven't used the later yet | 16:30.21 |
kens | Unless you are doing somethign weird you should not need to touch the ProcessColorModel | 16:30.49 |
rnissl | I'm sorry, I've misread the documentation | 16:31.36 |
| -sProcessColorModel should be set if using -sColorConversionStrategy=UseDeviceIndependentColor | 16:32.20 |
kens | Yes. | 16:32.29 |
| But not otherwise | 16:32.33 |
| And I'm off now, goodnight | 16:32.39 |
| Forward 1 day (to 2018/08/24)>>> | |