Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.postscript > #3802
| From | ken <ken@spamcop.net> |
|---|---|
| Newsgroups | comp.lang.postscript |
| Subject | Re: Need help with ghostscript command syntax to compress pdf without flattening . |
| Date | 2022-11-22 14:38 +0000 |
| Message-ID | <MPG.3de6ef321ad72cef9898d4@usenet.plus.net> (permalink) |
| References | <3c149175-4095-43cd-9564-39e76d1311cdn@googlegroups.com> |
In article <3c149175-4095-43cd-9564-39e76d1311cdn@googlegroups.com>, cthalkar@nolo.com says... > > I have PDF with form fields, I need to compress pdf but without flattening i.e. retain ability of fillable form fields after pdf compression. > > Following command is use to compress PDF file it compresses PDF file by 35% but pdf is flatterend i.e. in generated compress PDF does not have editable form fields > > gs -dSAFER -dBATCH -dNOPAUSE -dQUIET -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/default -sOutputFile=SAMPLE_compressed_via_gs.pdf SAMPLE.pdf Ghostscript (more proerly Ghostscript's pdfwrite device) doesn't compress PDF files. If you are prepared to sacrifice quality, then it can reduce the file size, but the default settings do not do so (and you are using /PDFSETTINGS=/default, which is quite pointless since those are the defaults!) It is possible that the output PDF file may be smaller than the input file, but there is absolutely no guarantee that this is so, and it may equally well be larger. It all depends on how the input file is organised. For more details on the process see: https://ghostscript.readthedocs.io/en/latest/VectorDevices.html As to forms.... There are two types of Forms in PDF; AcroForms and XML forms (XFA), you don't say which your PDF file is using, and you have not supplied an example to look at. Ghostscript and the pdfwrite device do not support XFA, at all. If your file contains XFA forms then the output file may look correct (probably won't) but it will no longer contain any XFA and will therefore no longer be a form. The PDF interpreter and pdfwrite device do not preserve the AcroForm and do not preserve Widget annotations as annotations. The *content* of the form is transferred, as marking objects on the page, so it will look the same. But there is no AcroForm in the output file, and so you can no longer edit the form fields. You can't do what you want using Ghostscript currently. That may change in the future, but I would not hold my breath waiting for it. Ken
Back to comp.lang.postscript | Previous | Next — Previous in thread | Find similar
Need help with ghostscript command syntax to compress pdf without flattening . Chandrashekhar Thalkar <cthalkar@nolo.com> - 2022-11-21 06:46 -0800 Re: Need help with ghostscript command syntax to compress pdf without flattening . ken <ken@spamcop.net> - 2022-11-22 14:38 +0000
csiph-web