<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  
  
  <channel>
    <title>chrisjrob: pdf</title>
    <link>https://chrisjrob.com</link>
    <atom:link href="https://chrisjrob.com/tag/pdf/feed/index.xml" rel="self" type="application/rss+xml" />
    <description>GNU Linux, Perl and FLOSS</description>
    <language>en-gb</language>
    <pubDate>Fri, 13 Feb 2026 17:22:31 +0000</pubDate>
    <lastBuildDate>Fri, 13 Feb 2026 17:22:31 +0000</lastBuildDate>
    
    <item>
      <title>PDFTK The PDF Toolkit</title>
      <link>https://chrisjrob.com/2014/03/24/pdftk-the-pdf-toolkit-2/</link>
      <pubDate>Mon, 24 Mar 2014 00:00:00 +0000</pubDate>
      <author>chrisjrob@gmail.com (Chris Roberts)</author>
      <guid>https://chrisjrob.com/2014/03/24/pdftk-the-pdf-toolkit-2</guid>
      <description>
       <![CDATA[
         
         <p><a href="http://www.pdflabs.com/docs/pdftk-cli-examples/" title="PDFTK - The PDF Toolkit">PDFTK - The PDF
Toolkit</a></p>

<p>I have long been a keen user of pdftk, the PDF Toolkit, but am
frequently surprised when people have not heard of it. True, it is a
command line tool, but it is easy to incorporate into service menus,
scripts etc and doubtless there is a GUI front-end for it somewhere (in
fact there is one linked to from the above page).</p>

<!--more-->

<p>Clearly a blog post is called for, but, whilst you wait for a post that
will never arrive, <a href="http://www.pdflabs.com/docs/pdftk-cli-examples/" title="PDFTK - The PDF Toolkit">here is a
link</a>
to some examples that should open your eyes to what is possible with
pdftk.</p>

<p>To get started on a Debian-based system:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ sudo apt-get install pdftk
$ man pdftk
</code></pre></div></div>

<p>Enjoy.</p>


       ]]>
      </description>
    </item>
    
    <item>
      <title>Howto | Convert XPS to PDF</title>
      <link>https://chrisjrob.com/2013/03/12/convert-xps-to-pdf/</link>
      <pubDate>Tue, 12 Mar 2013 10:47:53 +0000</pubDate>
      <author>chrisjrob@gmail.com (Chris Roberts)</author>
      <guid>https://chrisjrob.com/2013/03/12/convert-xps-to-pdf</guid>
      <description>
       <![CDATA[
         
         <h2 id="introduction">Introduction</h2>

<p>XPS is Microsoft’s attempt to replace PDF, the only difference is that everyone can read PDFs, and not everyone can read XPS.  I understand that KDE 4 versions of Okular will support XPS, which may make these instructions unnecessary, although having a tool for conversion readily at hand is always useful!</p>

<!--more-->

<p>These instructions were tested in Debian Lenny.  These instructions worked for our specific systems YMMV.</p>

<h2 id="building-from-source">Building from source</h2>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ sudo apt-get install libxext-dev libxt-dev
$ wget http://ghostscript.com/releases/ghostpdl-8.71.tar.bz2
$ tar xvvjf ghostpdl-8.71.tar.bz2
$ cd ghostpdl-8.71
$ make xps
</code></pre></div></div>

<h2 id="testing">Testing</h2>

<p>After the build you will find gxps in xps/obj</p>

<p>To test, you will need a test document in XPS format.</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ cd xps/obj
$ ./gxps -sDEVICE=pdfwrite -sOutputFile=test.pdf -dNOPAUSE test.xps
</code></pre></div></div>

<h2 id="move-to-bin">Move to bin</h2>

<p>You probably want to move the gxps executable into a convenient location within your PATH.  /usr/local/bin may be a good destination.  Once there you ought to be able to run the command from anywhere and it just work.  Not sure what your PATH is?  Type “echo $PATH” in your terminal.</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ echo $PATH
$ sudo cp xps/obj/gxps /usr/local/bin/
$ sudo chown root:root /usr/local/bin/gxps
</code></pre></div></div>

<h2 id="creating-file-type">Creating file type</h2>

<p>XPS probably does not exist on your Linux system as a file type, you can either create yourself using KDE Control Centre, or in KDE:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>Single user:
~/.kde/share/mimelnk/application/xps.desktop

All users:
/usr/share/mimelnk/application/xps.desktop

[Desktop Entry]
Comment=XPS Document
Hidden=false
Icon=application-xps
MimeType=application/xps
Patterns=*.xps;*.XPS
Type=MimeType
X-KDE-AutoEmbed=false
</code></pre></div></div>

<h2 id="adding-to-servicemenu">Adding to ServiceMenu</h2>

<p>If you are using Konqueror, you can add a service menu (to enable right-click / action menu).</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>Single user:
~/.kde/share/apps/konqueror/servicemenus/xpstopdf.desktop

All users:
/usr/share/apps/konqueror/servicemenus/xpstopdf.desktop

[Desktop Entry]
Version=1.0
Encoding=UTF-8
Name=xpstopdf service menu
ServiceTypes=application/xps
Icon=acroread
Actions=xpstopdf

[Desktop Action xpstopdf]
Icon=acroread
Name=Convert XPS to PDF
Exec=cd "%d"; gxps -sDEVICE=pdfwrite -sOutputFile="`echo "%f" | cut -d . -f 1`.pdf" -dNOPAUSE "%f"; mv "%f" ~/.local/share/Trash/files; kdialog --title "Convert XPS to PDF" --passivepopup "Done" 3; echo;
</code></pre></div></div>

<h2 id="testing-servicemenu">Testing ServiceMenu</h2>

<p>You should now be able to right-click on the file and “Convert XPS to PDF”.  This will create a PDF of the same name and move the XPS into trash.</p>

<h2 id="references">References</h2>

<ul>
  <li><a href="http://www.ghostscript.com/GhostPCL.html">http://www.ghostscript.com/GhostPCL.html</a></li>
  <li><a href="http://obscured.info/2010/03/01/converting-xps-to-pdf-on-ubuntu-9-10/">http://obscured.info/2010/03/01/converting-xps-to-pdf-on-ubuntu-9-10/</a></li>
  <li><a href="http://blog.rubypdf.com/2009/04/14/convert-xps-to-pdf-in-two-ways/">http://blog.rubypdf.com/2009/04/14/convert-xps-to-pdf-in-two-ways/</a></li>
</ul>

       ]]>
      </description>
    </item>
    
    <item>
      <title>Viewing A Textual PDF In Mutt</title>
      <link>https://chrisjrob.com/2011/03/23/viewing-a-textual-pdf-in-mutt/</link>
      <pubDate>Wed, 23 Mar 2011 00:00:00 +0000</pubDate>
      <author>chrisjrob@gmail.com (Chris Roberts)</author>
      <guid>https://chrisjrob.com/2011/03/23/viewing-a-textual-pdf-in-mutt</guid>
      <description>
       <![CDATA[
         
         <p>I think there must be something wrong with me. Why, in this age of
graphical user interfaces, does it delight me so much that I can view
textual PDFs within Mutt (on a remote server without a gui)?</p>

<p>To set this up, you need to install pdftotext. This application is
available in either poppler-utils or xpdf-utils - most people seem to
use the latter, but I suspect the former is probably a better option for
a text-only server. I installed poppler-utils.</p>

<!--more-->

<p>Next create (or edit) the <code class="language-plaintext highlighter-rouge">~/.mailcap</code> file, so that it has the
following line:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>application/pdf;                pdftotext -layout %s -; copiousoutput
</code></pre></div></div>

<p>You could also add the line:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>text/html;                      elinks %s; nametemplate=%s.html`
</code></pre></div></div>

<p>The latter line opens HTML attachments in elinks.</p>

<p>Then just hit “V” when viewing an email, and you will see the
attachments, select the attachment and hit Enter to view it. Awesome :)</p>


       ]]>
      </description>
    </item>
    
    <item>
      <title>Microsoft XPS under Linux</title>
      <link>https://chrisjrob.com/2010/08/04/microsoft-xps-under-linux/</link>
      <pubDate>Wed, 04 Aug 2010 00:00:00 +0000</pubDate>
      <author>chrisjrob@gmail.com (Chris Roberts)</author>
      <guid>https://chrisjrob.com/2010/08/04/microsoft-xps-under-linux</guid>
      <description>
       <![CDATA[
         
         <p>A member of staff asked how he could open a personal XPS file, created in Windows 7.  Now XPS is the Microsoft replacement for PDF and it is apparently installed as a printer by default in Vista and Windows 7, which means increasingly people are going to start sending XPS files whether we like it or not.</p>

<!--more-->

<p>Fortunately it seems XPS is supported in Okular under KDE4 (which we don’t have yet), and can also be readily converted to PDF using the Ghostscript “gxps” tool.  This has to be built from source, but proved relatively simple.  As our users do not have access to the command line, I also had to also create a Konqueror service menu, to enable right-click Action “Convert XPS to PDF”.</p>

<p>I am pleased to say it all works beautifully, and I have typed up my instructions for Debian Lenny here:</p>

<ul>
  <li>
    <table>
      <tbody>
        <tr>
          <td>[Howto</td>
          <td>Convert XPS to PDF](/2013/03/12/convert-xps-to-pdf/)</td>
        </tr>
      </tbody>
    </table>
  </li>
</ul>

       ]]>
      </description>
    </item>
    
    <item>
      <title>Command line PDF tool pdftk</title>
      <link>https://chrisjrob.com/2008/12/09/command-line-pdf-tool-pdftk/</link>
      <pubDate>Tue, 09 Dec 2008 00:00:00 +0000</pubDate>
      <author>chrisjrob@gmail.com (Chris Roberts)</author>
      <guid>https://chrisjrob.com/2008/12/09/command-line-pdf-tool-pdftk</guid>
      <description>
       <![CDATA[
         
         <p>I had a 25-page OpenOffice writer document that needed to be sent to as a pdf.  Obviously creating a pdf from OpenOffice is simple enough, but I wanted to insert within the final pdf additional pages from other documents (i.e. not just simply appended on the end).</p>

<!--more-->

<p>We often use pdftk for command line pdf, but I hadn’t delved deeply into the features.  But using pdftk all I had to do was:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ pdftk A=main.pdf B=2nd.pdf C=3rd.pdf cat A1-24 B A25 C output final.pdf
</code></pre></div></div>

<p>In other words the final document (final.pdf) is pages 1-24 of document A (main.pdf), the whole of document B (2nd.pdf), page 25 of document A (main.pdf) and the whole of document C (3rd.pdf).</p>

<p>For a command line program, I think that is stunningly intuitive.  And best of all it was instantaneous and there was no loss of quality.</p>

<p>pdftk can seemingly do just about anything with pdfs, including encrypt, decrypt, repair, burst and rotate.</p>

<p>pdftk is installable from the Debian repos and typing <code class="language-plaintext highlighter-rouge">pdftk --help</code> gives you a handy set of usage examples, so that you don’t have to re-learn it every time you use it.</p>

       ]]>
      </description>
    </item>
    
  </channel> 
</rss>
