0

I have some PDF file, 3 pages. On the top of the second page I need to insert (or not in some cases) few (variable) paragraphs of text - kind of page "header". After header I need to put large block of text, ~1.5 pages with heavy formatting, HTML links and so on. How can I insert text on top of the second page and make below part going under it? I attach some picture for clarification. Looking on PDFsharp or iTextSharp libs ...

PDF layout explanation

Alex A
  • 141
  • 6
  • 2
    You should ask a question for either iText OR PDFsharp - not both. Ask two separate questions if necessary. Also, describe what you have already done. – Amedee Van Gasse Sep 29 '16 at 12:28

1 Answers1

0

I would use PDFsharp.

I would create a new PDF and draw the pages from the existing PDF on the new pages as needed. The first page would be drawn 1:1, the second page would be drawn under the new header (you can use a custom page size to draw the page 1:1 or shrink it to fit the remaining space).

Most likely the same approach can be used with iTextSharp.

There is no easy way to keep part of page 2 on page 2 and have the rest of page 2 on page 3 - not sure if that is what you want. This would require analyzing the contents of the pages and that is something that PDFsharp cannot do.

If you have to generate text with a lot of formatting, then maybe MigraDoc can be helpful.

  • I would use iText. Whatever you describe can also be done with iText; however, the question isn't very clear. The reference to "heavy formating, html links and so on" is confusing. How should one interpret "html links" in the context of PDF? Is there some HTML to PDF involved? Also: the pages in the image don't seem to have the same size, so maybe it's sufficient to just extend the size of page 2 similar to the way the page size is extended in the answer to [How to extend the page size of a PDF to add a watermark?](http://stackoverflow.com/questions/29775893/) – Bruno Lowagie Sep 29 '16 at 12:46
  • "html links" in the context of PDF means that there are clickable links in bottom text, so i can't copy and insert it as image, need to preserve clickable links. – Alex A Sep 29 '16 at 13:08