# Link to 'future' PDF page [closed]

I am compiling large conference proceedings with many sections in the following way using a kind of Ruby script:

1. I get all articles in PDFs.
2. For each one I calculate page count using pdftk.
3. For each section I generate overlaying TeX file with shmutztitle and headings, concatenate articles with pdftk and overlay smutztitle and headings with pdftk.
4. Then I generate TOC programmatically using \contentsline and finally concatenate everything with pdftk again. And proudly get single ~30 MiB PDF file as output.

I know all resulting page numbers, but, just as expected, when I try to use page.4 link in TOC, it just links to page 4 of TOC itself.

Okay, it is always better to have bookmaks in the proceedings, so I started generating them for shmutztitles as \pdfbookmark[1]{Section Name}{abspage-5} and for articles as \pdfbookmark[2]{Article Title}{abspage-7}. Page numbers are 'global' here, meaning numbers from very final document. Bookmarks work pretty well there and I am happy with them, but...

... But TOC still lags. When I try to reference above article bookmark from TOC with \hyperlink{abspage-7.2}{7} (just making page numbers clickable, .2 is bookmark level as http://ttic.uchicago.edu/~gregory/notes/pdfsl/docs/pdfdoc.pdf prescribes), it points nowhere...

So I tried:

• almost without hope, referencing page numbers;
• with great hope, referencing bookmarks.

And failed both times.

What should I try next, preferably without rewriting the whole system to use one global TeX overlay for the whole proceedings? =)

## closed as unclear what you're asking by user31729, Sean Allred, Zarko, egreg, Stefan PinnowFeb 6 '17 at 2:38

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

• If I understand what you are trying to achieve correctly, doesn't the pdfpages packages fit your needs? With that package you can include other PDF documents inside a LaTeX document. – sodd Dec 10 '16 at 9:47
• Yes, pdfpages was one of possible solutions for me, but as the whole proceedings it very big, I do not want to assemble them with TeX. Concatenating standalone PDFs with pdftk is much faster. But they remain too standalone then =) – dluciv Dec 10 '16 at 11:09
• You can use pdfpages after you've compiled the complete document to include one page at a time and stick labels in that that you create programmatically, something like \foreach \p in [1..P] {\includepdf[pages=\p]{complete} \label{page\p}} . (Need some fine tuning) – JPi Feb 5 '17 at 23:30