• Converting UTF-8 email text to PDF

    From Loris Bennett@21:1/5 to All on Thu Feb 13 12:00:01 2025
    Hi,

    I am using Emacs' Gnus to display a buffer containing an email.
    I want to convert this email to a PDF file.

    If I save the mail to a file I get:

    $ file einladung.txt
    einladung.txt: news or mail, Unicode text, UTF-8 text

    I have tried the following approaches to converting to PDF:

    1. a2ps + ps2pdf

    This fails because a2ps seemingly can't handle UTF-8.

    2. pandoc

    pandoc --wrap=none -o einladung.pdf einladung.txt

    This works and preserves the non-ASCII characters, but the headers of
    the email are compressed into a single paragraph, rather than being
    preserved as individual lines.

    Does anyone have a better suggestion?

    Cheers,

    Loris

    PS I am aware that I can probably print the buffer directly from Emacs,
    but that also seems fiddly to set up and I'll maybe ask about that in an
    Emacs context.

    --
    This signature is currently under constuction.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Rand Pritelrohm@21:1/5 to Loris Bennett on Thu Feb 13 12:20:01 2025
    On 2025-02-13 11:32:09, Loris Bennett wrote:

    Hi,

    [snip]

    Does anyone have a better suggestion?

    [snip]

    Hello,

    I use with success 'paps'
    https://github.com/dov/paps

    Maybe you can find it in repos.

    Regards,
    Rand

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Hans@21:1/5 to All on Thu Feb 13 12:20:01 2025
    Easiest way for me: Just print into a file. The result is a pdf-file.

    However, do not know, if your printer driver can do this, but I suppose, most printer drivers are able to it.

    Best

    Hans

    Am Donnerstag, 13. Februar 2025, 11:32:09 CET schrieb Loris Bennett:
    Hi,

    I am using Emacs' Gnus to display a buffer containing an email.
    I want to convert this email to a PDF file.

    If I save the mail to a file I get:

    $ file einladung.txt
    einladung.txt: news or mail, Unicode text, UTF-8 text

    I have tried the following approaches to converting to PDF:

    1. a2ps + ps2pdf

    This fails because a2ps seemingly can't handle UTF-8.

    2. pandoc

    pandoc --wrap=none -o einladung.pdf einladung.txt

    This works and preserves the non-ASCII characters, but the headers of
    the email are compressed into a single paragraph, rather than being
    preserved as individual lines.

    Does anyone have a better suggestion?

    Cheers,

    Loris

    PS I am aware that I can probably print the buffer directly from Emacs,
    but that also seems fiddly to set up and I'll maybe ask about that in an Emacs context.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Loris Bennett@21:1/5 to Rand Pritelrohm on Thu Feb 13 13:20:01 2025
    Rand Pritelrohm <[email protected]> writes:

    On 2025-02-13 11:32:09, Loris Bennett wrote:

    Hi,

    [snip]

    Does anyone have a better suggestion?

    [snip]

    Hello,

    I use with success 'paps'
    https://github.com/dov/paps

    Maybe you can find it in repos.

    'paps' is indeed available for bookworm, which is what I have.

    However, I ended up installing the 'printing' package for Emacs, which
    allowed me to print from Emacs to a PostScript file, which I could then
    convert to PDF via 'ps2pdf'.

    But thanks for the suggestion anyway.

    --
    This signature is currently under constuction.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Loris Bennett@21:1/5 to Hans on Thu Feb 13 13:20:01 2025
    Hans <[email protected]> writes:

    Easiest way for me: Just print into a file. The result is a pdf-file.

    How do you do that from Emacs?

    However, do not know, if your printer driver can do this, but I suppose, most printer drivers are able to it.

    Best

    Hans

    Am Donnerstag, 13. Februar 2025, 11:32:09 CET schrieb Loris Bennett:
    Hi,

    I am using Emacs' Gnus to display a buffer containing an email.
    I want to convert this email to a PDF file.

    If I save the mail to a file I get:

    $ file einladung.txt
    einladung.txt: news or mail, Unicode text, UTF-8 text

    I have tried the following approaches to converting to PDF:

    1. a2ps + ps2pdf

    This fails because a2ps seemingly can't handle UTF-8.

    2. pandoc

    pandoc --wrap=none -o einladung.pdf einladung.txt

    This works and preserves the non-ASCII characters, but the headers of
    the email are compressed into a single paragraph, rather than being
    preserved as individual lines.

    Does anyone have a better suggestion?

    Cheers,

    Loris

    PS I am aware that I can probably print the buffer directly from Emacs,
    but that also seems fiddly to set up and I'll maybe ask about that in an
    Emacs context.
    --
    Dr. Loris Bennett (Herr/Mr)
    FUB-IT, Freie Universität Berlin

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Hans@21:1/5 to All on Thu Feb 13 16:40:01 2025
    This is a multi-part message in MIME format.

    I got this information from here:

    https://askubuntu.com/questions/27097/how-to-print-a-regular-file-to-pdf-from-command-line[1]

    where are shown other ways, too.

    Best

    Hans

    --------
    [1] https://askubuntu.com/questions/27097/how-to-print-a-regular-file-to-pdf-from-command-line

    <html>
    <head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    </head>
    <body><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">I got this information from here:</p>
    <br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;"><a href="https://askubuntu.com/questions/27097/how-to-print-a-regular-file-to-pdf-from-command-line">https://askubuntu.com/questions/27097/how-to-print-a-regular-file-to-pdf-from-
    command-line</a></p>
    <br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">where are shown other ways, too.</p>
    <br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">Best</p>
    <br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">Hans</p>
    </body>
    </html>

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Hans@21:1/5 to you on Thu Feb 13 16:40:01 2025
    This is a multi-part message in MIME format.

    Hi Loris,
    you wrote
    $ file einladung.txt
    einladung.txt: news or mail, Unicode text, UTF-8 text
    So you already have a simple textfile. Did you try the following?

    enscript einladung.txt -o - | ps2pdf - einladung.pdf

    Please note, "enscript" is a package which can easily be installed witrh apt.

    Hope this helps.

    Best

    Hans

    <html>
    <head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    </head>
    <body><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">Hi Loris,</p>
    <p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">you wrote</p>
    <p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">&gt;&nbsp;&nbsp; $ file einladung.txt</p>
    <p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">&gt;&nbsp;&nbsp; einladung.txt: news or mail, Unicode text, UTF-8 text</p>
    <p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">So you already have a simple textfile. Did you try the following?</p>
    <br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;"><span style="font-family:Hack;">enscript einladung.txt -o - | ps2pdf - einladung.pdf</span></p>
    <br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">Please note, &quot;enscript&quot; is a package which can easily be installed witrh apt.</p>
    <br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">Hope this helps.</p>
    <br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">Best</p>
    <br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">Hans</p>
    </body>
    </html>

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Richmond@21:1/5 to Loris Bennett on Thu Feb 13 20:40:01 2025
    On 13/02/2025 10:32, Loris Bennett wrote:
    Hi,

    I am using Emacs' Gnus to display a buffer containing an email.
    I want to convert this email to a PDF file.


    You can print the file into a pdf from a web browser. Put file:/// into
    the location bar and navigate to the text file, select it and print it.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ralph Katz@21:1/5 to Loris Bennett on Fri Feb 14 03:20:01 2025
    On 2/13/25 03:32, Loris Bennett wrote:
    Hi,

    I am using Emacs' Gnus to display a buffer containing an email.
    I want to convert this email to a PDF file.

    If I save the mail to a file I get:

    $ file einladung.txt
    einladung.txt: news or mail, Unicode text, UTF-8 text



    Does anyone have a better suggestion?
    [snip]

    If libreoffice is installed, convert or batch convert text files to pdf:

    soffice --convert-to pdf file(s)

    Regards,
    Ralph

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Linux-Fan@21:1/5 to Loris Bennett on Fri Feb 14 20:10:02 2025
    This is a MIME GnuPG-signed message. If you see this text, it means that
    your E-mail or Usenet software does not support MIME signed messages.
    The Internet standard for MIME PGP messages, RFC 2015, was published in 1996. To open this message correctly you will need to install E-mail or Usenet software that supports modern Internet standards.

    Loris Bennett writes:

    Hi,

    I am using Emacs' Gnus to display a buffer containing an email.
    I want to convert this email to a PDF file.

    [...]

    Does anyone have a better suggestion?

    If you can get your e-mail in .eml format, you could use a tool specifically targeted at converting e-mails to PDF.

    I like this one: <https://github.com/nickrussler/email-to-pdf-converter>

    The tool is unfortunately not directly available in Debian, but I have defined my build instructions for creating a basic package out of it here: <https://github.com/m7a/bp-emltopdfconverter>.

    I am not sure if my build instructions still work as-is because it seems I have last updated the package in 2023 - if you are interested in using them
    I should be able to fix them, though.

    HTH
    Linux-Fan

    öö

    -----BEGIN PGP SIGNATURE-----

    iQIzBAABCgAdFiEEkKMBOo1F/f2B6jfK+Elw7bKeCLUFAmevk3kACgkQ+Elw7bKe CLW2thAAmMnhWFS7vSLNJv4y0tDBs6impBgAKX4Awo5EBkNOaKU2n2E+wTjb0eIV tgBWnmSw0BaWrBtrxLN2nshB2/J7zGRGjj53URsx6VvrYERXaxg+7jZe3vFTn+7U ZgrXJdSe50yvgeaqJbaftoZgcSouY4U3GQ+UJxSZD2Ms1x9saJWH9ZPBLqbvZMib SL3WMwFB4IHcpFOTajrifFKAR8o9fS0STmS4QDjC24UvN4evA2GdBLc8o/PtbJmH kQljgJJbDl4kfdqgXzFALMptIghZwjKOPcmM8wQj8KCcsRV/VoDRYZJv7KNz1k/+ CjxrwePioqTjGly8siIMSxaYf8hF0EL8DDUzYOkc95kCWs5/1PG+8BtIf8HFi2pu 2+m1esWv3cYoqDdaQqJO6ja3E5pEBKU1v/BduyNDba42KylFCHjr1xU0AYVTKj86 OxtBUpyK8pSCxT8co1+fVydnidrvGhOv+TTwQXOJy+NG+3oi45SznMy5IoC/8dNw LT86khuZfaLxsvHkaekn1k0xAj3YNBfTVmWAiG6pl6GEJI9LaYoKPzbZs99Vm8/Q ISQ3sEOgzBIgJ0fZmgjlTWxW+4BaXoiXOqXdYlC+Erczo36/eg3Il9HhIm2CR/xf PPhTLLmtJhP73N08wwXLOOLl55QsmbwVIACx1LXQtZrD540YMi4=
    =FYWE
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)