PDFs are relatively simple beasts, but what you're trying to do is corrupting the xref tables, which hold byte offsets to the beginnings of PDF objects. I haven't seen the output of Indesign, but the fact that you are able to replace text directly suggests that Indesign does not compress all its objects. That's good for your purposes.

You'll want the PDF Reference (published by Adobe) to understand this better, but look at the xref table in the output file. It looks like this:

xref 69 16 0000000016 00000 n 0000001041 00000 n 0000000616 00000 n 0000001121 00000 n 0000001250 00000 n 0000001381 00000 n 0000001533 00000 n 0000001567 00000 n 0000001782 00000 n 0000001858 00000 n 0000002238 00000 n 0000002609 00000 n 0000002830 00000 n 0000003269 00000 n 0000003514 00000 n 0000006183 00000 n
You'll want to know which objects you are modifying so you can correct all the objects with higher offset values. An object starts with a section like this:
71 0 obj
This is the 71st object (note that the xref table I copied started its numbering at 69, for some reason), 0th revision. It starts after 616 bytes, which you can see in the xref table above.

At a minimum, if all else goes well, you will have to correct the byte offstes of the objects that appear after your changes, so that the viewer can "find" them.

If you're looking for an easy fix, this won't help. If you're willing to invest some time learning a really cool file format, jump on in!

P.S. (Pun kinda intended) There may be more than one xref table. For your purposes, update all of them with offsets greater than your byte location until you know why you don't have to... :-)


In reply to Re: Editing/Replacing Text in a PDF by Russ
in thread Editing/Replacing Text in a PDF by ikkon

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.