Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Thufir's a Harkonnen now.


devel / comp.lang.postscript / Need help with ghostscript command syntax to compress pdf without flattening .

SubjectAuthor
* Need help with ghostscript command syntax to compress pdf withoutChandrashekhar Thalkar
`- Re: Need help with ghostscript command syntax to compress pdf without flatteningken

1
Need help with ghostscript command syntax to compress pdf without flattening .

<3c149175-4095-43cd-9564-39e76d1311cdn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=194&group=comp.lang.postscript#194

  copy link   Newsgroups: comp.lang.postscript
X-Received: by 2002:a05:6214:3383:b0:4c6:dd9:586c with SMTP id mv3-20020a056214338300b004c60dd9586cmr17326872qvb.40.1669041981369;
Mon, 21 Nov 2022 06:46:21 -0800 (PST)
X-Received: by 2002:a05:620a:b83:b0:6fb:ec6:da03 with SMTP id
k3-20020a05620a0b8300b006fb0ec6da03mr16340998qkh.206.1669041981079; Mon, 21
Nov 2022 06:46:21 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.postscript
Date: Mon, 21 Nov 2022 06:46:20 -0800 (PST)
Injection-Info: google-groups.googlegroups.com; posting-host=2409:4042:2095:add9:94bf:bc06:2af8:2a15;
posting-account=ngy9igoAAADFp13TZGSgN0WNTMWR_kjo
NNTP-Posting-Host: 2409:4042:2095:add9:94bf:bc06:2af8:2a15
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <3c149175-4095-43cd-9564-39e76d1311cdn@googlegroups.com>
Subject: Need help with ghostscript command syntax to compress pdf without
flattening .
From: cthalkar@nolo.com (Chandrashekhar Thalkar)
Injection-Date: Mon, 21 Nov 2022 14:46:21 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 1571
 by: Chandrashekhar Thalk - Mon, 21 Nov 2022 14:46 UTC

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

Re: Need help with ghostscript command syntax to compress pdf without flattening .

<MPG.3de6ef321ad72cef9898d4@usenet.plus.net>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=195&group=comp.lang.postscript#195

  copy link   Newsgroups: comp.lang.postscript
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!feeder.usenetexpress.com!tr3.iad1.usenetexpress.com!69.80.99.23.MISMATCH!Xl.tags.giganews.com!local-2.nntp.ord.giganews.com!nntp.brightview.co.uk!news.brightview.co.uk.POSTED!not-for-mail
NNTP-Posting-Date: Tue, 22 Nov 2022 14:38:32 +0000
From: ken@spamcop.net (ken)
Newsgroups: comp.lang.postscript
Subject: Re: Need help with ghostscript command syntax to compress pdf without flattening .
Date: Tue, 22 Nov 2022 14:38:32 -0000
Message-ID: <MPG.3de6ef321ad72cef9898d4@usenet.plus.net>
References: <3c149175-4095-43cd-9564-39e76d1311cdn@googlegroups.com>
Reply-To: ken@spamcop.net
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
User-Agent: MicroPlanet-Gravity/3.0.4
X-Antivirus: Avast (VPS 221121-8, 21/11/2022), Outbound message
X-Antivirus-Status: Clean
Lines: 46
X-Usenet-Provider: http://www.giganews.com
X-Trace: sv3-Yg1ejeM0770ru1VpqdQqcM7GVxhgiZLb3CiQgQcCamBFZsG7FAB/lzQjY7ZpyLcS1UcYnpEFDtih/1a!/9tMNUSmIQIbDLsL2rvtmLvoddY8bYhlJVvHhwrNjZqHHYbyXVtUN7MEZGVSNWnCikD9C0Q7bE0N!3lREMlokWT2uaTcH7w==
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
X-Received-Bytes: 3399
 by: ken - Tue, 22 Nov 2022 14:38 UTC

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

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor