I can think of a scripted solution, that, with some thought and research, might work.<div><br></div><div>1. separate the PDF into pages (files)</div><div>2. convert PDFs pages to PNG images</div><div>3. create PNG files with transparent background and a page number (in some color), one per each page in the original</div>
<div>4. composite the page-number PNG files (from step 3) onto their respective page PNG files (from step 2)</div><div>5. convert all the files from step 4 back to one PDF file</div><div><br></div><div>I researched ImageMagick and found (after about half an hour) that it can do, at least, steps 4 and 5, on the command line (and step 4 is really the trickiest step).</div>
<div><br></div><div>ImageMagick provides the command line tool 'convert'. The code for step 4 is " convert 50.png page-number.png -flatten output.png" and for step 5 is "convert 50.jpg 51.jpg output.pdf".</div>
<div><br></div><div>So, yeah, I think it can be scripted. I'm willing to work on the rest of the process with you, if you think this is worth pursuing.</div><div><br></div><div>Regards,</div><div>Caleb.</div><div><br>
</div><div>ps-- I have some experience with LaTeX and do NOT think it is the right tool for this job. LaTeX is awesome for formatting documents (physics review letters, say) into a specific, very polished format. What LaTeX won't do is parse the PDF source file. You'd have to find some -other- tool to translate the PDF into a full-fledged LaTeX document (at which point it would be trivial to add page numbers).</div>
<div><br></div><div><br></div><div><br></div><div><div class="gmail_quote">On Mon, Apr 12, 2010 at 5:57 PM, Patton Echols <span dir="ltr"><<a href="mailto:p.echols@comcast.net">p.echols@comcast.net</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">I am working on a modification to the script found here:<br>
<br>
<a href="http://forums.debian.net/viewtopic.php?t=30598" target="_blank">http://forums.debian.net/viewtopic.php?t=30598</a><br>
<br>
The purpose is to "page number" an existing PDF document.  Part of the<br>
process requires a pdf document with the page numbers in the appropriate<br>
place.  The script author made his manually using OO.  What I would like<br>
to do is to script the process.  One of the commentators to the script<br>
said that he made his using LaTeX. (Which I know nothing about).<br>
<br>
The documentation I have been able to find is massive and frankly I<br>
don't  quite know where to begin.<br>
<br>
What I would like to do is to feed a script a PDF and have it calculate<br>
the number of pages "$n", then the script would create the "page number"<br>
pdf with pages $n, and the correct text, font, color, leading zeros,<br>
etc.  (Example "Page PE - 00001")<br>
<br>
  So here are the questions:<br>
<br>
If this is something that can be done with LaTeX? (tex-live)<br>
<br>
Nodding in the direction of "RTFM" is there a recommended "FM?" (and<br>
pointers about what I should be reading!)<br>
<br>
Is there another way of doing the above that would be more<br>
straightforward / scriptable?<br>
<br>
Thanks<br>
<font color="#888888"><br>
--PE<br>
</font><div><div></div><div class="h5"><br>
--<br>
ubuntu-users mailing list<br>
<a href="mailto:ubuntu-users@lists.ubuntu.com">ubuntu-users@lists.ubuntu.com</a><br>
Modify settings or unsubscribe at: <a href="https://lists.ubuntu.com/mailman/listinfo/ubuntu-users" target="_blank">https://lists.ubuntu.com/mailman/listinfo/ubuntu-users</a><br>
</div></div></blockquote></div><br></div>