Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>By far the easiest way to do this is to create a new PDF with the desired table at the desired location, then stamp it onto the existing PDF. This can be done in code using (for example) the <code>PdfStamper</code> class, but there are also standalone tools such as <code>pdftk</code> and many others. Don't think of this as "editing" a PDF, think of it as dropping something new on top of the original.</p> <pre><code>pdftk original.pdf stamp newtable.pdf output combined.pdf </code></pre> <p>The really interesting and potentially difficult part was addressed by @mkl's original question - how do you determine the correct position of the new table. If you can come up with a geometric rule, then you are in good shape. If this involves any parsing of the original file, you should be aware that something as (seemingly) simple as determining the number of rows in the existing table can sometimes be extremely difficult. In all likelihood, there is noting like an html <code>&lt;table&gt;</code> tag buried in the content stream. Having an example of an actual PDF would be very helpful. An image of the PDF is not the same thing.</p> <p>To give you some background information, parsing the <em>layout</em> of a PDF is easy, that's what PDF readers do. Parsing the <em>content</em> of a PDF is completely different and much harder. Just as an example, the PDF image you posted could be drawn from top to bottom, or the headers and footers could be drawn first followed by all the bold face items, followed by the plain faced text. Just because two things are next to each other in the physical layout does not mean they are next to each other in the file structure, the object tree, or the content stream. It's a vector graphic not a text file or a bitmap. PDFs are not designed to be editable unless the software that creates it specifically provides clues as to how the content is to be edited. There are a lot of things that seem like they <em>should</em> be easy, but once you understand how a PDF is built, it makes sense that it's difficult. I'm not saying this to discourage you, just so that you appreciate the magnitude of the task. If you can trace down the source document that this PDF was created from, I guarantee you will have more success with less frustration.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload