3

I can insert pdf pages with the pdfpages. There are options to select pages ...

But I found nothing to select specific layers. Is there a possibility?

Details

PDF to be included

The following code creates a document with layers:

\documentclass[english,ngerman,latin]{scrartcl} 
\usepackage{babel} 
\usepackage{blindtext} 
\usepackage{ocgx2} 

%%%%%%%%%%%%%%%
\begin{document}
\section{Main}
\blindtext

%Parameter: {ocg}{name}{id}{visibility}
\begin{ocg}{German}{german}{1}
\section{German}
\selectlanguage{ngerman}\blindtext
\end{ocg}

\begin{ocg}{English}{english}{1}
\section{English}
\selectlanguage{english}\blindtext
\end{ocg}

\section{Main - continue}
\ldots
\end{document}

The result: enter image description here

In the viewer I can select, if I see the German/English layer.

File with pdfpages

Now I want to include my test document in another pdf. It works with \includepdf{test_ocg_article} but I found no possibility to include it with invisible German text.

\documentclass{scrartcl} 
\usepackage{pdfpages} 

\begin{document}
\includepdf{test_ocg_article}%Works fine, everything is shown

%Option to exclude a layer does not exist:
% \includepdf[layer=german]{test_ocg_article}
% \includepdf[invisible=german]{test_ocg_article}

\end{document}

Remarks

  • The pdf I want to include is not created with LaTeX. I'm looking for a solution for any pdf with layers.
  • I don't expect to get the layers in my main document. See Include PDF with OCGs for this topic.
  • I want to include the pdf multiple times. Everytimes with different layer visibilies. So it does not help, to set selected layers as invisible (I would need a pdf-file for each variant of layer settings).
  • can you please explain your final goal? if I understand you want to have 2 documents one without english section and second without german section? no? – touhami Mar 30 '16 at 22:56
  • @touhami I want to have one document. This document contains the pdf with layers multiple times, each time with different layers. (It's a kind of explanation: 'You can take document X and activate the layers 1,2,... and inactivate layer 8 and 9. Then you can see (figure XY)....'). Actually I have to make a screenshot of each figure I want. And If I understand AlexG correct, that's the only possibility. – knut Mar 31 '16 at 14:32
  • @AlexG That's what I suspected, but I wanted to be sure. Can you make an answer of your comment - so I can accept it and close the question. – knut Mar 31 '16 at 14:34
  • @knut exactly, but rather than screenshot one can try a trick like this – touhami Mar 31 '16 at 17:05
3

The initial visibility of layers is hard-wired in the /Catalog of the PDF file. None of the known drivers (pdfTeX, dvips, dvipdfmx, XeTeX) provide a means to override these settings upon file inclusion. Thus, it is (most likely) not possible.

|improve this answer|||||
  • I am not sure whether LuaTeX allows for low level PDF operations of such kind. – AlexG Mar 31 '16 at 15:03
1

Not with the current systems (although this may be possible with some Lua code in LuaTeX). There is an unmaintained fork of pdftex (made by me) at the pdftex repository that is able to do this (with some additional primitives).

|improve this answer|||||
  • Sounds promising! Lat's see, if it finds it way to the official release. – knut Apr 2 '16 at 18:47
  • @knut: Unlikely as nobody is working on it. – Reinstate Monica - M. Schröder Apr 2 '16 at 18:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.