Page LayoutInclude pdf and reference pages

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
Sekantombi
Posts: 21
Joined: Mon Apr 21, 2008 3:50 am

Include pdf and reference pages

Post by Sekantombi »

Dear Colleagues,

I regularly need to compile a complex document (meeting papers) which includes editable text from a certain well-known word processing package and multiple scanned pdf files of physical letters (they are pdf images).

The hard part is to put all this together and reference the included pdf pages with cross-references and / or table of contents.

Have been doing this under (word processing package) and then transforming all editable pages into pdf and assembling under Acrobat. But this is a nightmare from the page-reference point of view: that is, hand-made table of contents and cross-references. There are numerous additions and edits that need to be done as the scheduled meeting draws near, and lots of opportunities for error on the page references.

I have done trials of the assembling process under LaTex with some success. But am uncertain whether there is a way to \includepdf and generate a cross-reference to the page number of such a page (that is, the included pdf doc). Is it possible? Probably need Table of Contents *and* cross-references.

Cheers,

Sekantombi.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Include pdf and reference pages

Post by gmedina »

Hi,

the pdfpages and xr packages could be of interest for you.
1,1,2,3,5,8,13,21,34,55,89,144,233,...
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Include pdf and reference pages

Post by frabjous »

Well, the \includepdf command was mentioned, and so the original poster obviously already knows about the pdfpages package.

There are a few things I can think of that might help. First, the \includepdf command has a "link" option which will make each page the target of a hyperlink. (See page 5 of the pdfpages manual.) The link's name is <filename>.pdf.<pagenumber>. So in this minimal working example, suppose trial.pdf has 10 pages, then the link at the end goes to page 6:

Code: Select all

\documentclass{book}
\usepackage{pdfpages}
\usepackage{hyperref}
\begin{document}
\clearpage
\includepdf[link,pages=-]{trial.pdf}
\clearpage
Here is a \hyperlink{trial.pdf.6}{hyperlink to page 6} of trial.pdf.
\end{document}
It also has an "addtotoc" command, dubbed "experimental", that you can use to include an entry in the toc for in the included PDF (along with the label for crossreferencing and hyperlinks)

The following, for example, puts an entry in the toc for page 4 of the included pdf, as a chapter entry, with "greatchap" as a target you can cross-refer to later if need be.

Code: Select all

\documentclass{book}
\usepackage{pdfpages}
\usepackage{hyperref}
\begin{document}
\frontmatter
\tableofcontents
\mainmatter
\clearpage
\includepdf[pages=-,addtotoc={4,chapter,1,{A Great Chapter},greatchap}]{trial.pdf}
\end{document}
The problem with that method is that it will only put in one entry per \includepdf command. You can, of course, use multiple \includepdf commands for page ranges of the same document and get more than one entry that way. In fact, you wouldn't necessarily even need to use that option then, e.g.:

Code: Select all

\documentclass{book}
\usepackage{pdfpages}
\usepackage{hyperref}
\begin{document}
\frontmatter
\tableofcontents
\mainmatter
\clearpage
\phantomsection\addcontentsline{toc}{chapter}{Page 1 of Trial}
\includepdf[pages=1-5]{trial.pdf}
\clearpage
\phantomsection\addcontentsline{toc}{chapter}{Page 6 of Trial}
\includepdf[pages=6-]{trial.pdf}
\end{document}
As far as I know, however, there's no way to put in a hyperlink to a particular part of an included page, or make the text inside the included pdf into a hyperlink, or in any way make use of the table of contents information that would be stored inside the Word file or included PDF.
Sekantombi
Posts: 21
Joined: Mon Apr 21, 2008 3:50 am

Re: Include pdf and reference pages

Post by Sekantombi »

Thank you Colleagues,

This looks as though it's heading in the right direction. I need to clarify and then ask a further question though. Your patience is appreciated.

First, I am proposing to replace the Word docs with LaTex docs. There's not much I can do about the scanned pdf docs -- they are a given.

Second, my final version needs to have an intial ToC and either two further Toc's for the two sections of scanned pdfs (two kinds of correspondence for the meeting papers).

So I need to either have a way of generating two further ToCs or to make a list of the scanned items with page reference / cross-reference, which is essentially the same thing but using different commands.

I think I need a page number reference rather than a hyperlink to the included pdfs, because the users of the documents use them in hard-copy. Do you think this is possible?

Cheers,

Sekantombi
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Include pdf and reference pages

Post by frabjous »

Sure. Take a look at pp. of the tocloft package for how to create a new "List of..." (pp. 12ff.).
Post Reply