You can use the pagecommand key:
\includepdf[scale=0.8,pages=1,pagecommand=\subsection{blub}]{testpdf}
You get the empty page when you use \includegraphics
because the graphics is too large for the textbody, so latex tries if it fits on the next page (and then complain). pdfpages
hides the size of the graphics so it is possible to insert complete pages which overwrites the margins. If you want to insert large graphics with \includegraphics
: use eso-pic
.
As Martin said, interactive parts of a PDF, called Annotations in PDF specification parlance, such as links or 3D objects, get lost when embedding a PDF containing them. Instead, Annotations have to be re-generated for the new PDF.
To embed a 3D object in the PRC format into a PDF, use LaTeX package media9
. See media9
manual, section "3D quick-start guide".
In case the standalone PRC file is not available it can be extracted from the PDF. This can be done manually, as explained below, or automatically with the help of a small Perl script. Either method requires a tool for uncompressing PDFs, such as PDFtk.
Extracting the PRC from PDF is not recommended if the PRC was generated by asymptote
and you have the asy
source file of it!
Standalone PRC files are generated from asy
source by
asy --keep --tex pdflatex mysource.asy
Automatically, using PDFtk + Perl script
This extracts all PRC streams from PDFwithPRC.pdf
to separate files prc-0.prc
, prc-1.prc
, ...
pdftk PDFwithPRC.pdf output - uncompress | perl prcextract.pl
On Windows, with a Java runtime and some perl.exe
installed:
java -jar pdftk-all.jar PDFwithPRC.pdf output - uncompress | perl prcextract.pl
Perl script prcextract.pl
:
#!/usr/bin/perl
$prc=0;
$stream=0;
$cnt=0;
while(<>){
if(/^stream/) {$stream=1;}
elsif(/^endstream/) {$stream=0; if($prc){close $PRC;} $prc=0;}
elsif((/^PRC/ || $prc) && $stream) {
if(!$prc){open $PRC,">prc-".$cnt++.".prc";select $PRC} print; $prc=1;
}
}
Manual procedure, by PDFtk + text editor
First uncompress the PDF:
pdftk doc.pdf output doc.unc.pdf uncompress
Open doc.unc.pdf
in a text editor and scroll down to a line that starts with PRC
. This line appears just after a line with the PDF keyword stream
.
Delete everything from begin of the file up to and including the line containing the stream
keyword.
Delete everything beginning with the line starting with the endstream
keyword directly after the PRC stream upto the end of the file.
Save what has left as a file whose name ends in .prc
.
Best Answer
There's a conflict between
Sweave
andpdfpages
. Try this.Note this is a
.Rnw
file (Sweave file) which is being processed into tex via a call like this from R:Sweave("foo.Rnw")
. So, it's a specificSweave
issue. Anyhow, change your\usepackage
call forSweave
in your.Rnw
file to the following. Note the addition of[nogin]
What's going on.. So By default,
Sweave.sty
sets the width of all included graphics to:\setkeys{Gin}{width=0.8\textwidth}
, and it is treating the inserted pdf pages as graphics and setting the size according to the above. You need to override this. If you do this in the\usepackage
call, you do this for all graphics. If you don't want that, then you can use this (or something similar)