<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
          "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">


<article lang="fr">
  
 <articleinfo>
  <title>Enemy Action</title>

  <subtitle>
  Gazette&nbsp;Linux n°180 &mdash; novembre 2010
  </subtitle>
    
  <author>
    <firstname>Henry</firstname>
    <surname>Grebler</surname>
    <email>henrygrebler CHEZ optusnet POINT com POINT au</email>
  </author>
    
  <othercredit role="traduction" class="translator">
   <firstname>Prénom</firstname>
   <surname>Nom</surname>
   <contrib>Adaptation française </contrib>
   <email>adresse CHEZ fournisseur POINT pays</email>
  </othercredit>
    
  <othercredit role="relecture" class="translator">
    <firstname>Prénom</firstname>
    <surname>Nom du relecteur</surname>
    <contrib>Relecture de la version française </contrib>
    <email>adresse_électronique CHEZ fournisseur POINT code_pays</email>
  </othercredit>
    
  <legalnotice>
    <para>Article paru dans le n°180 de la Gazette&nbsp;Linux de novembre 2010.</para>
    <para>Cet article est publié selon les termes de la <ulink url="http://linuxgazette.net/copying.html">Open Publication License</ulink>.
    La <citetitle>Linux&nbsp;Gazette</citetitle> n'est ni produite, ni sponsorisée, ni avalisée par notre hébergeur principal, SSC, Inc.</para>
  </legalnotice>
    
  <copyright>
    <year>2010</year>
    <holder>Henry Grebler</holder>
  </copyright>

  <copyright>
    <year>Année de traduction</year>
    <holder>Prénom Nom du traducteur</holder>
  </copyright>
    
  <copyright>
    <year>Année de relecture</year>
    <holder>Prénom Nom du relecteur</holder>
  </copyright>
  
 </articleinfo>
  
<blockquote>
<attribution>Ian Fleming (spoken by Auric Goldfinger)</attribution>
<para>
<quote>Once is happenstance. Twice is coincidence. Three times is
enemy action.</quote>
</para>
</blockquote>

<section id="once"><title>Once</title>

<para>
Sometimes I buy tickets on the Internet. About a month ago, I bought
tickets to the <ulink
url="http://en.wikipedia.org/wiki/Australian_rules_football">footy</ulink>.
There are several options, but I choose to get the tickets emailed to
me as a PDF. I have no idea what research the ticketing agencies do,
but they obviously do not include me in the profile of their typical
user.
</para>

<para>
I planned to go with a friend, Jeremy, who supports the opposition
team. Jeremy is in paid employment, whereas I am currently <quote>between
engagements</quote>. He intended to ride his bicycle to the stadium; I would
take the train. I agreed to meet Jeremy inside the stadium.
</para>

<para>
But I've still got to get him his ticket.
</para>

<para>
Sometimes the tickets come as separate PDF files, but this time they
were both in a single PDF. I struggled mindlessly for some time and
eventually sent Jeremy a 6.5 MB .ppm! Fortunately, it gzipped very
nicely and the email was less than 350 KB. 
</para>

</section>

<section id="twice"><title>Twice</title>

<para>
Recently, I bought more tickets for some future footy game. Again,
they came as a single PDF. This time it was Mark and Matt to whom I
wanted to send tickets.
</para>

<para>
I went to my help directory to see what I had done the previous time.
Nothing. As disciplined as I try to be, I remain disappointingly
human.
</para>

<para>
Never mind. I've had lots of time living with myself. I now know there
are two of me. I've learnt to put up with the hopeless deficiencies of
the Bad Henry. After all, what can you do?
</para>

<para>
So, I worked out (again!) how to split out pages from a PDF. Between
the first and second time, I'd been on a ten-day trip to Adelaide.
Before I leave home on long trips I shut down my computer. And my
brain.
</para>

<para>
My solution this time involved PostScript files. I wrote it up (Good
Henry was in charge). Then, for completeness (Good Henry can be quite
anal), I reconstructed what I probably did the first time and wrote that up
also.
</para>

</section>

<section id="three_times"><title>Three times</title>

<para>
Today it happened again. Last night I booked tickets for the theatre.
(You see? There's more to me than just football.) When I looked at
the tickets, I found a single PDF containing 4 tickets: two for me and
my wife, two for Peter and his wife, Barbara.
</para>

<para>
And finally I hit the roof. I'd tried <application>Adobe Acrobat</application>,
<application>xpdf</application>, and <application>evince</application>. They all have the same problem:
they insist on honouring the stupid restrictions included in the PDF,
things like <quote>no copying</quote>.
</para>

<programlisting>
	Encrypted:      yes (print:yes copy:no change:no addNotes:no)
</programlisting>

<para>
Think about it. How stupid is this? If I have <filename>x.pdf</filename>,
no matter what some cretin includes in the file, nothing can stop me
from going:
</para>

<programlisting>
	cp x.pdf x2.pdf
</programlisting>

<para>
So what has been achieved by the restriction? The words of the song
about the benefits of war come to mind: absolutely nothing! And I
<emphasis role="bold">am</emphasis> tempted to say it again: absolutely nothing.
</para>

<sidebar>
<para>
[ These days, there are so many ways to remove/bypass/eliminate/ignore that
so-called <quote>protection</quote> - e.g., <ulink
url="http://ensode.net/pdf-crack.jsf">ensode.net</ulink>'s online <quote>unlocker</quote> -
that it is indeed meaningless. -- Ben ]
</para>
</sidebar>

<para>
So let's say I send Jeremy or Mark or Matt a copy of the entire PDF.
What I'm concerned about is that they may inadvertently print the
wrong ticket. Sure, in the email, I tell each person which ticket is
his. But... since each ticket has a barcode, perhaps the stadium
checks and complains about a second attempt to present the same
ticket. Embarrassment all round.
</para>

<para>
Notice that I'm not trying to do anything illegal or underhanded. I'm
not trying to violate some cretin's digital rights. I'm not trying to
harm anyone. I'm trying to get a ticket to my friend; a ticket that I
bought legitimately; one that I'm not only entitled, but required, to
print out. I guess they want me to fax it to him. But isn't that also
making a copy? Do they expect me to drive across town to get him his
ticket?
</para>

<para>
It seems to me amazing that I'm the only one who wants this
capability. Every time I've looked on my computer (<command>apropos</command>)
or anywhere else (Internet), I've never found a convenient mechanism.
I now have a mechanism (see next section), but this is really a plea
for help. Can anyone suggest something a little more elegant than what
I've come up with?
</para>

</section>

<section id="two_cent_tip"><title>2-Cent Tip</title>

<para>
Here is the best method I could come up with for extracting one page,
or several contiguous pages, from a PDF into a separate PDF:
</para>

<programlisting>
	gs -dSAFER -sDEVICE=pdfwrite -dNOPAUSE -dBATCH \
		-dFirstPage=3 -dLastPage=4 \
		-sOutputFile=PeterAndBarbara.pdf Tickets.pdf
</programlisting>

<para>
Basically this command says to extract pages 3 and 4 from <filename>Tickets.pdf</filename>
and put them into <filename>PeterAndBarbara.pdf</filename>. The first line consists mainly
of window dressing.
</para>

<para>
If you want to extract each page as a separate PDF file (not a bad
idea), here's a script:

<programlisting>

#! /bin/sh
#       pdfsplit.sh - extract each page of a PDF into a separate file

        myname=`basename $0`

#----------------------------------------------------------------------#
Usage () {
        cat &lt;&lt;EOF
Usage: $myname file

where   file    is the PDF to split

Output goes to /tmp/page_n.pdf
EOF
        exit
}

#----------------------------------------------------------------------#
Die () {
        echo $myname: $*
        exit
}

#----------------------------------------------------------------------#
        [ $# -eq 1 ] || Usage

        pages=`pdfinfo $1 | grep Pages | awk '{print $2}'`
        [ "$pages" = '' ] &amp;&amp; Die "No pages found. Perhaps $1 is not a pdf."
        [ "$pages" -eq 1 ] &amp;&amp; Die "Only 1 page in $1. Nothing to do."

        jj=1
        while [ $jj -le $pages ]
        do
                gs -dSAFER -sDEVICE=pdfwrite -dNOPAUSE -dBATCH \
                        -dFirstPage=$jj -dLastPage=$jj \
                        -sOutputFile=/tmp/page_$jj.pdf $1
                jj=`expr $jj + 1`
        done


</programlisting>
</para>

</section>

<section id="notes"><title>Notes</title>

<para>
You can look at <command>gs(1)</command> for a limited amount of help. For more
useful help, do this:

<programlisting>
	gs -h
</programlisting>

and look at the second last line. Mine says:

<screen>
	For more information, see /usr/share/ghostscript/8.15/doc/Use.htm.
</screen>
</para>

<para>
I've probably broken my system, because it is actually in
<filename>/usr/share/doc/ghostscript-8.15/Use.htm</filename>. Another
system refers correctly to
<filename>/usr/local/share/ghostscript/8.64/doc/Use.htm</filename>.
</para>

<para>
You can use your usual browser or you can use:

<programlisting>
	lynx /usr/share/doc/ghostscript-8.15/Use.htm
</programlisting>
</para>

<para>
See also <command>pdfinfo(1)</command>. Here's an example of its output:

<screen>
pdfinfo Tickets.pdf
Producer:       Acrobat Distiller 7.0.5 (Windows)
CreationDate:   Tue Mar 16 04:21:58 2010
ModDate:        Tue Mar 16 04:21:58 2010
Tagged:         no
Pages:          4
Encrypted:      yes (print:yes copy:yes change:no addNotes:no)
Page size:      595 x 842 pts (A4)
File size:      1290313 bytes
Optimized:      no
PDF version:    1.4
</screen>
</para>

</section>

<bibliography id="bibliography"><title>À propos de l'auteur</title>
<bibliomixed>
<authorblurb>
<para>
 Henry has spent his days working with computers, mostly for computer
 manufacturers or software developers. His early computer experience
 includes relics such as punch cards, paper tape and mag tape. It is
 his darkest secret that he has been paid to do the sorts of things he
 would have paid money to be allowed to do. Just don't tell any of his
 employers. 
</para>

<para>
He has used Linux as his personal home desktop since the family got its
 first PC in 1996. Back then, when the family shared the one PC, it was a
 dual-boot Windows/Slackware setup. Now that each member has his/her own
 computer, Henry somehow survives in a purely Linux world.
</para>

<para>
He lives in a suburb of Melbourne, Australia.
</para>
</authorblurb>
</bibliomixed>
</bibliography>

<colophon id="a-propos-de-la-gazette">

<title>Adaptation française de la Gazette Linux</title>

<para>
L'adaptation française de ce document a été réalisée dans le cadre du <citetitle>Projet de traduction de la Gazette&nbsp;Linux</citetitle>.

</para>

<para>
Vous pourrez lire d'autres articles traduits et en apprendre plus sur ce projet en visitant notre site&nbsp;: <ulink
url="http://www.traduc.org/Gazette_Linux"/>.
</para>

<para>
Si vous souhaitez apporter votre contribution, n'hésitez pas à nous rejoindre, nous serons heureux de vous accueillir.
</para>

</colophon>
</article>
