From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Frederick Bartlett Newsgroups: gmane.emacs.help Subject: How I edit PDF files Date: Wed, 22 Mar 2023 15:46:50 -0400 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32646"; mail-complaints-to="usenet@ciao.gmane.io" To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Wed Mar 22 20:47:35 2023 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pf4Qp-0008Ff-El for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 22 Mar 2023 20:47:35 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pf4QN-0002eT-50; Wed, 22 Mar 2023 15:47:07 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pf4QL-0002eJ-U3 for help-gnu-emacs@gnu.org; Wed, 22 Mar 2023 15:47:05 -0400 Original-Received: from mail-qt1-x835.google.com ([2607:f8b0:4864:20::835]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pf4QJ-0006xT-5Y for help-gnu-emacs@gnu.org; Wed, 22 Mar 2023 15:47:05 -0400 Original-Received: by mail-qt1-x835.google.com with SMTP id c10so12934549qtj.10 for ; Wed, 22 Mar 2023 12:47:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679514422; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=NnCdTq2JwVm/MHZgV7zS2feN041z/hgf2hyTWYbEQyU=; b=B488iKmeBKn92q4pLE5+vFQrS8JEvjCCYO/jfKIuCWrWLnVtImTzpwfkJEgJF73pvQ Irj0zgzRqRWe3WNJJIpaQCCKO9Dc2BE/ZKSHGWGI8wnrMot4xZQh7uq/+vcLbct9S/+i Ng0MOO4iQupWEQ77nDaq9pcles73iCJAJGCLhOpDOv9sv+njD6ENI3r0UKNQEqrrATBq t8letGOfArLu6y4Ns7L+YChlA1H9KqGS673YYINKnELxE98sjHC59QiuuLofLmYnYhc6 kuVt7U4pVQ5+AjUqxj80PfSVqoxaR6v+UOjoZnR5+yS8WQTI8EFMCJ6ZIGwYDqeQ2TAi 6WwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679514422; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=NnCdTq2JwVm/MHZgV7zS2feN041z/hgf2hyTWYbEQyU=; b=snsBECNkM1QO+Km58fVUWZ+V0GXS5cZ8pu0zMU9nPsK9KNmHApCu/rIM8Fbu0AYH11 qZmeD+jZZGXWJZ865WyiA4FBTT2yjVal8svySMDaW3UK8COTeM8n0nh2XExRztVmFipU 6WLvODgAi7Ou48rAM92xIVgjgqSVy/m1SVqlp8c4trF4E2DkqGuqn3THqSsyEDz6ejF5 2haO5hVQqLbXwbrcF7eZqPDZZsEAOWgXWwx0PJFPhvHW+iC1kxmxvrM3FTRxsN+/X9zc JsfRJGr5eJ4rdvnhDnndvowynk3Z2vxuPjQ3W8Eauqhiza/FiFCLnBr0BeQaubeag3ga m5OA== X-Gm-Message-State: AO0yUKVmzd6jxsc8M1uB7rqsFAIOfFnouBb0mBiy+IJPRLc6rHFO3Qto r92iJt0cAQHl9h03lnL3SC7aYwUW1Dfgj+1MVm/6iKuy X-Google-Smtp-Source: AK7set/gTiAXD47HV5exnt4KcCB4Ffizm/wkqmxnrjtZfra0eXANZU2hOJYbUysj7CKhelb/Y/n7qbmgiFy6mcc4hVM= X-Received: by 2002:a05:622a:1a0e:b0:3bf:d025:1ac1 with SMTP id f14-20020a05622a1a0e00b003bfd0251ac1mr1779502qtb.11.1679514421578; Wed, 22 Mar 2023 12:47:01 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2607:f8b0:4864:20::835; envelope-from=frederick.bartlett@gmail.com; helo=mail-qt1-x835.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:143088 Archived-At: On rare occasions (that is, when the source of the PDF is unavailable), I have edited and/or transformed PDF files. Note that I started by editing Type 1 PostScript files in the late 80s before PDF was released; that was a much easier starting point than the full panoply of modern PDF. A general solution for PDF editing, while perhaps possible, would require roughly the same amount of work as creating the PDF format in the first place. While I=E2=80=99ve used Emacs as part of this process for 25 or 30 years, I= have not attempted to use Emacs Lisp (I don=E2=80=99t like parentheses). However, each application has its own application/dialect of PDF which can be reverse engineered; that takes (at best) several hours. For instance, I was able to change the information on a PDF address label when the original app wouldn=E2=80=99t allow the required changes =E2=80=93= we wanted 4 lines of information where the app would allow only 3. Also, back in the 90s at Springer-Verlag, I routinely swapped out bitmapped fonts for TFM-equivalent Type 1 fonts in author-produced TeX PDFs for publication. That was the easiest PDF editing I=E2=80=99ve ever done. Finally, just recently, I parsed the PDF of a Microsoft Excel spreadsheet and converted it to a Python array (from which it could be imported into database or spreadsheet apps) after the original xlsx file had been lost = =E2=80=93 but most of that work was done by pdftotext, which is part of poppler, after which a simple Python script did the rest. But it is always better and quicker to get to the original source of the PDF and make the changes there. On Wed, Mar 22, 2023 at 12:03=E2=80=AFPM w= rote: > Send help-gnu-emacs mailing list submissions to > help-gnu-emacs@gnu.org > > To subscribe or unsubscribe via the World Wide Web, visit > https://lists.gnu.org/mailman/listinfo/help-gnu-emacs > or, via email, send a message with subject or body 'help' to > help-gnu-emacs-request@gnu.org > > You can reach the person managing the list at > help-gnu-emacs-owner@gnu.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of help-gnu-emacs digest..." > > > Today's Topics: > > 1. Re: superfluous(?) quotes in mail alias expansion (Emanuel Berg) > 2. Re: editing a PDF [Re: emacs 30.5.0 editing epub] (Emanuel Berg) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Tue, 21 Mar 2023 15:24:41 +0100 > From: Emanuel Berg > To: help-gnu-emacs@gnu.org > Subject: Re: superfluous(?) quotes in mail alias expansion > Message-ID: <87h6ueqj12.fsf@dataswamp.org> > Content-Type: text/plain; charset=3Dutf-8 > > Gregor Zattler wrote: > > > the fine manual has this to say regarding mail aliases: > > > > If an address contains a space, quote the whole > > address with a pair of double quotes, like this: > > > > alias jsmith "John Q. Smith " > > > > Note that you need not include double quotes around > > individual parts of the address, such as the > > person=E2=80=99s full name. Emacs puts them in if they are > > needed. For instance, it inserts the above address > > as =E2=80=98"John Q. Smith" =E2=80=99. > > > > This describes correctly how this mechanism works, > > regarding it's outcome, but not why. > > In the data file, it's just so it can be parsed. When it gets > inserted, quotes are added if they are needed. > > Try putting it like this in ~/.mailrc: > > alias jsmith-1 "John Q. Smith " > alias jsmith-2 "John Q Smith " > alias jsmith jsmith-1 jsmith-2 > > then expand both with "jsmith", it will look like this: > > To: "John Q. Smith" , > John Q Smith > > Quotes inserted (because of the dot) in the first case, not in > the second as not needed. > > -- > underground experts united > https://dataswamp.org/~incal > > > > > ------------------------------ > > Message: 2 > Date: Tue, 21 Mar 2023 07:38:42 +0100 > From: Emanuel Berg > To: help-gnu-emacs@gnu.org > Subject: Re: editing a PDF [Re: emacs 30.5.0 editing epub] > Message-ID: <87v8iur4lp.fsf@dataswamp.org> > Content-Type: text/plain; charset=3Dutf-8 > > Yuri Khan wrote: > > >> It is kinda weird that, with all the many things that emacs > >> can do, it can't take the info from doc-view (which > >> obviously understands all the pieces of a pdf-- down to its > >> bits-- and how they all go together to make a document) and > >> edit it... it's pretty much implausible to believe emacs > >> *can't* do that. But then, I've always thought reality was > >> completely implausible. :^/ > > > > PDF is not really meant for editing. It=E2=80=99s not even a data > > format. Rather, it=E2=80=99s an executable program that has > > instructions like =E2=80=9Cselect this font=E2=80=9D and =E2=80=9Cdispl= ay this word > > in the selected font at this position on the page=E2=80=9D and =E2=80= =9Cmake > > a new page=E2=80=9D. > > > > You don=E2=80=99t normally edit executable programs, you compile > > them from source. In the same vein, to get a modified PDF, > > you find the source document from which it was produced, > > modify that, and re-export. > > Still, they are editable at/from the PDF level as well, for > example with xournal. This is used for signing documents, > for example. It should not be confused or compared with > editing the source, that's another thing. > > -- > underground experts united > https://dataswamp.org/~incal > > > > > ------------------------------ > > Subject: Digest Footer > > _______________________________________________ > help-gnu-emacs mailing list > help-gnu-emacs@gnu.org > https://lists.gnu.org/mailman/listinfo/help-gnu-emacs > > > ------------------------------ > > End of help-gnu-emacs Digest, Vol 244, Issue 37 > *********************************************** >