It would be much better for you to learn the CPAN modules rather than use my old code. My code is from 1998, and is probably for perl5.005 and pdf for Acrobat 3. If you try the CPAN module and it is unsuitable, please let me know what the problem is, and if my old code handles it you will be welcome to have it!

I started writing pdf files by using print statements to generate the examples in the pdf documentation from Adobe. Then I started substituting my own commands for the ones in the example. There were some checksums that I needed to compute for the PDF, if I recall correctly.

It is straightforward to position text and draw vectors in PDF, although not quite as easy as it is in postscript. Text positioning is easiest to compute with a fixed-width font. Otherwise, you will need some other routine to determine how wide your text will come out.

For reading PDF, the process is just reversed. Many documents only use a few PDF commands. The documents that I was parsing were typically designed to be compatible with Acrobat 2.0, so they tended to be simpler. As the new readers became more widely used the documents tended to make more use of compression, which I don't believe I ever successfully decoded. The compression formats are not unusual or undocumented, but my work no longer required it. Instead, we switched to using a C-language API that we bought from Adobe, and we built our application on top an example that came with this API. Adobe discontinued the API product a few months after we bought it, and would not answer questions about their example. Not good after you spend $50,000 on software, and don't get the source code!

Since then, the open-source solutions have become proficient enough at PDF that they handle all my needs.

It should work perfectly the first time! - toma

In reply to Re: Re: Re: Editing text in PDF file by toma
in thread Editing text in PDF file by gnum

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.