{"id":8467,"date":"2023-09-23T11:00:25","date_gmt":"2023-09-23T09:00:25","guid":{"rendered":"https:\/\/linux-bibel.at\/?p=8467"},"modified":"2023-09-23T14:19:33","modified_gmt":"2023-09-23T12:19:33","slug":"a2ps-postscript-dokumente-mit-linux","status":"publish","type":"post","link":"https:\/\/linux-bibel.at\/index.php\/2023\/09\/23\/a2ps-postscript-dokumente-mit-linux\/","title":{"rendered":"a2ps \u2013 PostScript-Dokumente mit Linux"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">PostScript ist die Sprache der Drucker &#8211; egal unter welchem Betriebssystem. Die meisten Nutzer haben es nicht mehr so mit diesem Format \u2013 es gibt ja PDF. Aber PostScript &#8211; auch oft gerne mit PS abgek\u00fcrzt &#8211; kann so einiges, vor allem Dokumente platzsparend und in einem passenden Dokumentformat archivieren.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In diesem Beitrag geht es nun um die Software <strong>a2ps<\/strong> \u2013 fr\u00fcher die Abk\u00fcrzung f\u00fcr &#8222;<em>ASCII to PostScript<\/em>&#8222;, heute &#8222;<em>Anything to PostScript<\/em>&#8222;. Der Grund dahinter: Die Software kann mit ziemlich vielen Dateiformaten umgehen.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">a2ps installieren<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Unter auf Debian basierenden Linux-Distributionen installieren Sie diese Software wie \u00fcblich ganz einfach \u00fcber die Paket-Verwaltung&nbsp;durch das Paket <strong>a2ps<\/strong>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">a2ps nutzen<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">a2ps wird am&nbsp;Terminal&nbsp;genutzt, dies funktioniert jedoch recht einfach. Als Erstes wollen wir uns einmal ansehen, mit welchen Dokumentformaten die Software umgehen kann, also welche Dateiformate die Software in PostScript konvertieren kann. Hierzu gen\u00fcgt der Befehl:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>a2ps --list=delegations | less<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/a2ps-1024x576.jpg\" alt=\"\" class=\"wp-image-8468\" srcset=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/a2ps-1024x576.jpg 1024w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/a2ps-300x169.jpg 300w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/a2ps-150x84.jpg 150w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/a2ps-768x432.jpg 768w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/a2ps-1536x864.jpg 1536w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/a2ps.jpg 1920w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Hiermit wird die Software\u00a0<strong><code>less<\/code><\/strong>\u00a0mit den m\u00f6glichen Formaten ge\u00f6ffnet, Sie scrollen weiter mit <strong>Eingabe<\/strong> und beenden <code>less<\/code> mit\u00a0<strong><code>q<\/code><\/strong>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>a2ps<\/code> funktioniert nun recht einfach, \u00fcblicherweise wird als Option nur der Dateiname angegeben, somit wird die Datei direkt mit dem voreingestellten Drucker ausgedruckt. Ein Beispiel:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>a2ps vlc-lizenz.txt<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">M\u00f6chte man die Datei in ein PostScript-Dokument konvertieren (<em>das Original bleibt nat\u00fcrlich erhalten<\/em>), gibt man einfach mit der Option <strong><code>-o Dateiname<\/code><\/strong> die Bezeichnung der zu erstellenden Datei an, etwa:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>a2ps vlc-lizenz.txt -o VLC-Lizenz.ps<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/a2ps-1-1024x576.jpg\" alt=\"\" class=\"wp-image-8469\" srcset=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/a2ps-1-1024x576.jpg 1024w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/a2ps-1-300x169.jpg 300w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/a2ps-1-150x84.jpg 150w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/a2ps-1-768x432.jpg 768w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/a2ps-1-1536x864.jpg 1536w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/a2ps-1.jpg 1920w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Und schon l\u00e4sst sich die konvertierte Datei in jedem PDF-Reader \u00f6ffnen:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/a2ps-2-1024x576.jpg\" alt=\"\" class=\"wp-image-8470\" srcset=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/a2ps-2-1024x576.jpg 1024w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/a2ps-2-300x169.jpg 300w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/a2ps-2-150x84.jpg 150w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/a2ps-2-768x432.jpg 768w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/a2ps-2-1536x864.jpg 1536w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/a2ps-2.jpg 1920w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Um Platz zu sparen, druckt a2ps mindestens zwei Seiten auf ein Blatt, ein PDF-Reader zeigt das Blatt also quer an \u2013 gedruckt wird ebenso quer. M\u00f6chten Sie dies nicht, Sie m\u00f6chten also eine Seite auf einem Blatt, geben Sie dies mit <strong><code>-1<\/code><\/strong> an:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>a2ps -1 vlc-lizenz.txt -o VLC-Lizenz.ps<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/a2ps-3-1024x576.jpg\" alt=\"\" class=\"wp-image-8471\" srcset=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/a2ps-3-1024x576.jpg 1024w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/a2ps-3-300x169.jpg 300w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/a2ps-3-150x84.jpg 150w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/a2ps-3-768x432.jpg 768w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/a2ps-3-1536x864.jpg 1536w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/a2ps-3.jpg 1920w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">M\u00f6chten Sie auf dem Blatt Platz sparen, k\u00f6nnen Sie auch mehr als zwei Seiten auf einem Blatt unterbringen, Sie geben dies ganz einfach durch eine Zahl zwischen&nbsp;<strong>1<\/strong>&nbsp;und&nbsp;<strong>9<\/strong>&nbsp;an:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>a2ps -8 vlc-lizenz.txt -o VLC-Lizenz.ps<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/a2ps-4-1024x576.jpg\" alt=\"\" class=\"wp-image-8472\" srcset=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/a2ps-4-1024x576.jpg 1024w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/a2ps-4-300x169.jpg 300w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/a2ps-4-150x84.jpg 150w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/a2ps-4-768x432.jpg 768w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/a2ps-4-1536x864.jpg 1536w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/a2ps-4.jpg 1920w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Sie k\u00f6nnen auch mehrere Dateien angeben, etwa:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>a2ps datei_1.txt datei_2.txt datei_3.txt -o ergebnis.ps<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">In diesem Fall h\u00e4ngt a2ps alle Dateien in einem neuen Dokument zusammen, f\u00e4ngt f\u00fcr jede Datei eine neue Seite an. M\u00f6chten Sie dies umgehen \u2013 also der Text beginnt gleich am Ende der letzten Datei \u2013, nutzen Sie die Option <strong><code>--file-align=virtual<\/code><\/strong> \u2013 etwa:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>a2ps --file-align=virtual datei_1.txt datei_2.txt datei3.txt -o ergebnis.ps<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">a2ps kennt auch Syntax-Highlighting, welche Formate die Software beherrscht, zeigt der Befehl:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>a2ps --list=style-sheets | less<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/a2ps-5-1024x576.jpg\" alt=\"\" class=\"wp-image-8473\" srcset=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/a2ps-5-1024x576.jpg 1024w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/a2ps-5-300x169.jpg 300w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/a2ps-5-150x84.jpg 150w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/a2ps-5-768x432.jpg 768w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/a2ps-5-1536x864.jpg 1536w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/a2ps-5.jpg 1920w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Unter normalen Umst\u00e4nden erkennt die Software die jeweilige Programmiersprache automatisch. Sollte dies einmal nicht richtig funktionieren, geben Sie die Sprache manuell an <strong><code>--pretty-print=XXX<\/code><\/strong> \u2013 etwa f\u00fcr PHP:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>a2ps --pretty-print=php dateiname.php -o dateiname.ps<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Die Syntax hebt die Software normal durch unterschiedliche Schriftstile hervor, m\u00f6chten Sie lieber Farbe, geben Sie dies mit der zus\u00e4tzlichen Option <strong><code>--prologue=color<\/code><\/strong> an:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>a2ps --pretty-print=php --prologue=color dateiname.php -o dateiname.ps<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Weitere nette Optionen zeigt wie \u00fcblich die Manpage mit dem Befehl:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>man a2ps<\/code><\/pre>\n<div class=\"pld-like-dislike-wrap pld-custom\">\r\n    <div class=\"pld-like-wrap  pld-common-wrap\">\r\n    <a href=\"javascript:void(0)\" class=\"pld-like-trigger pld-like-dislike-trigger  \" title=\"Gef\u00e4llt mir\" data-post-id=\"8467\" data-trigger-type=\"like\" data-restriction=\"cookie\" data-already-liked=\"0\">\r\n                            <img src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/12\/Daumen-Hoch.png\" alt=\"Gef\u00e4llt mir\" \/>\r\n            <\/a>\r\n    <span class=\"pld-like-count-wrap pld-count-wrap\">    <\/span>\r\n<\/div><div class=\"pld-dislike-wrap  pld-common-wrap\">\r\n    <a href=\"javascript:void(0)\" class=\"pld-dislike-trigger pld-like-dislike-trigger  \" title=\"Gef\u00e4llt mir nicht\" data-post-id=\"8467\" data-trigger-type=\"dislike\" data-restriction=\"cookie\" data-already-liked=\"0\">\r\n                            <img src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/12\/Daumen-Runter.png\" alt=\"Gef\u00e4llt mir nicht\" \/>\r\n            <\/a>\r\n    <span class=\"pld-dislike-count-wrap pld-count-wrap\"><\/span>\r\n<\/div><\/div>","protected":false},"excerpt":{"rendered":"<p>PostScript ist die Sprache der Drucker &#8211; egal unter welchem Betriebssystem. Die meisten Nutzer haben es nicht mehr so mit diesem Format \u2013 es gibt ja PDF. Aber PostScript &#8211; auch oft gerne mit PS abgek\u00fcrzt &#8211; kann so einiges, vor allem Dokumente platzsparend und in einem passenden Dokumentformat archivieren. In diesem Beitrag geht es [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":8472,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[57],"tags":[59],"class_list":["post-8467","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-buero","tag-buero"],"_links":{"self":[{"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/posts\/8467","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/comments?post=8467"}],"version-history":[{"count":5,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/posts\/8467\/revisions"}],"predecessor-version":[{"id":8501,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/posts\/8467\/revisions\/8501"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/media\/8472"}],"wp:attachment":[{"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/media?parent=8467"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/categories?post=8467"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/tags?post=8467"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}