{"id":967,"date":"2021-08-20T15:37:24","date_gmt":"2021-08-20T22:37:24","guid":{"rendered":"http:\/\/10.0.1.201\/?p=967"},"modified":"2025-12-01T10:50:18","modified_gmt":"2025-12-01T17:50:18","slug":"ps2pdf-droplet","status":"publish","type":"post","link":"https:\/\/strawhousepig.net\/wordpress\/2021\/08\/20\/ps2pdf-droplet\/","title":{"rendered":"ps2pdf droplet"},"content":{"rendered":"\n<p>The long running gag around here is I use old software that works with old hardware. Fun. Recently I was sent a PostScript file to output to film, but the version of Distiller I use choked on it. Illustrator CS2 could open it, but unbeknownst to me it only imports the first page. More fun.<\/p>\n\n\n\n<!--more-->\n\n\n\n<p>Inkscape will import PostScript files and will ask you which page you&#8217;d like to open. Unfortunately Inkscape version 1.1 on macOS will not because&#8230; reasons?<\/p>\n\n\n\n<p>Luckily the tool it uses to convert PS to PDF still works\u2013 <code>ps2pdf<\/code>. If you have Ghostscript installed you should have ps2pdf available as well.<\/p>\n\n\n\n<p>This AppleScript is set to use <code>ps2pdf<\/code> installed via <a href=\"https:\/\/www.macports.org\/\">macports<\/a>.<\/p>\n\n\n\n<p>Of note is replacing the &#8220;.ps&#8221; extension using text item delimiters. Relevant lines being:<br><code>set my text item delimiters to {\".\"}<br>...<br>set target_path to (text items 1 thru -2 of source_path) &amp; \"pdf\" as string<\/code><\/p>\n\n\n\n<p>I&#8217;ve seen people write complete paragraph weight routines to do that, so tuck this away in your bag-of-tricks. \ud83d\ude09<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>(*\nhttp:&#47;&#47;strawhousepig.net\/\n*)\n\n-- Path to your ps2pdf script.\nproperty path2ps2pdf : \"\/opt\/local\/bin\/ps2pdf \" -- Don't forget the trailing space!\n\non run\n\ttell application \"Finder\"\n\t\ttry\n\t\t\tset _files to (selection as list)\n\t\t\tmy make_it_pdf(_files)\n\t\ton error\n\t\t\ttry\n\t\t\t\tset cwd to folder of window 1\n\t\t\ton error\n\t\t\t\tset cwd to home\n\t\t\tend try\n\t\t\tmy make_it_pdf({choose file with prompt \u00ac\n\t\t\t\t\"Choose PostScript files to convert:\" default location cwd as alias with multiple selections allowed})\n\t\tend try\n\tend tell\nend run\n\non open the_files\n\tmake_it_pdf(the_files)\nend open\n\non make_it_pdf(the_files)\n\tset my text item delimiters to {\".\"}\n\trepeat with _file in the_files\n\t\tif name extension of (info for _file) is \"ps\" then\n\t\t\ttry\n\t\t\t\tset source_path to POSIX path of (_file as alias)\n\t\t\t\tset target_path to (text items 1 thru -2 of source_path) &amp; \"pdf\" as string\n\t\t\t\tdo shell script path2ps2pdf &amp; quoted form of source_path &amp; \" \" &amp; quoted form of target_path\n\t\t\ton error theErr\n\t\t\t\tif theErr is not \"User canceled.\" then display dialog theErr\n\t\t\tend try\n\t\tend if\n\tend repeat\nend make_it_pdf<\/code><\/pre>\n\n\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-1067\" src=\"https:\/\/strawhousepig.net\/wordpress\/wp-content\/uploads\/2021\/08\/ps2pdf-300x300.png\" alt=\"\" width=\"300\" height=\"300\" srcset=\"https:\/\/strawhousepig.net\/wordpress\/wp-content\/uploads\/2021\/08\/ps2pdf-300x300.png 300w, https:\/\/strawhousepig.net\/wordpress\/wp-content\/uploads\/2021\/08\/ps2pdf-150x150.png 150w, https:\/\/strawhousepig.net\/wordpress\/wp-content\/uploads\/2021\/08\/ps2pdf.png 512w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/p>\n<p><a href=\"https:\/\/strawhousepig.net\/wordpress\/wp-content\/uploads\/2021\/08\/ps2pdf.icns_.zip\">ps2pdf.icns<\/a><\/p>","protected":false},"excerpt":{"rendered":"<p>The long running gag around here is I use old software that works with old hardware. Fun. Recently I was sent a PostScript file to output to film, but the version of Distiller I use choked on it. Illustrator CS2 could open it, but unbeknownst to me it only imports the first page. More fun.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[10,23,24,28,33,34],"class_list":["post-967","post","type-post","status-publish","format-standard","hentry","category-code","tag-applescript-2","tag-macintosh","tag-macos","tag-os-x","tag-script","tag-shell-script"],"_links":{"self":[{"href":"https:\/\/strawhousepig.net\/wordpress\/wp-json\/wp\/v2\/posts\/967","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/strawhousepig.net\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/strawhousepig.net\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/strawhousepig.net\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/strawhousepig.net\/wordpress\/wp-json\/wp\/v2\/comments?post=967"}],"version-history":[{"count":5,"href":"https:\/\/strawhousepig.net\/wordpress\/wp-json\/wp\/v2\/posts\/967\/revisions"}],"predecessor-version":[{"id":1069,"href":"https:\/\/strawhousepig.net\/wordpress\/wp-json\/wp\/v2\/posts\/967\/revisions\/1069"}],"wp:attachment":[{"href":"https:\/\/strawhousepig.net\/wordpress\/wp-json\/wp\/v2\/media?parent=967"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/strawhousepig.net\/wordpress\/wp-json\/wp\/v2\/categories?post=967"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/strawhousepig.net\/wordpress\/wp-json\/wp\/v2\/tags?post=967"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}