# How to put a textblock above the background image?

I'm trying to implement this solution while using textpos but the textblock*s seem to land below the "background" image instead of above. Can one overcome this?

A minimal example would be:

\documentclass[a4paper,landscape]{article}

\usepackage{lipsum, tikz}

\usepackage[absolute]{textpos}

\usepackage{eso-pic}
\newcommand\BackgroundPic{%
\put(0,0){
\parbox[b][\paperheight]{\paperwidth}{
\includegraphics[width=\textwidth]{somepic.png}
}
}
}

\begin{document}

\textblockcolour{black}

\begin{textblock*}{10cm}(2cm, 2cm)
Invisible \lipsum[1]
\end{textblock*}

\end{document}


Try

\usepackage[absolute,overlay]{textpos}


The overlay option is designed for this situation, where other packages use the same \shipout mechanism, and put things ‘on top of’ the boxes which the textpos package generates.

[overlay] When using the absolute-position mode, the textblocks are placed under any other text on the page. This is normally what you want, but if you have page contents, and they have something which obscures the textblocks (for example, a block of opaque colour), then the positioned textboxes disappear. In this case, specify the option [overlay], to request that the positioned blocks of text overlay any other page contents, rather than being overlaid.

I was unable to get textblock* to achieve your goal, so I wrote a substitute, using the everypage package, \mytextblock}{width}{x-pos}{y-pos}{content}.

The background is inserted with an \atxy{xpos}{ypos}{content}.

The current implementation only supports one textblock color per page. Let me know if that is sufficient.

In the MWE, after placing the background image, I lay down two text blocks, the second (of \lipsum[3]) is positioned to directly underlay an actual incarnation of \lipsum[3], so that one can observe that the dimensions match.

One thing that I don't know about the real textblock is whether it is supposed to overlay or underlay the actual page content. In my implementation, it underlays. If that is the incorrect behavior, then this effort is for naught.

\documentclass[a4paper,landscape]{article}
\usepackage{lipsum,everypage,xcolor,graphicx}
\def\PageTopMargin{1in}
\def\PageLeftMargin{1in}
\newcommand\atxy[3]{%
\raisebox{\dimexpr\PageTopMargin+\voffset-#2\relax}{#3}}}}
\newsavebox\blockbox
\newcommand\mytextblock[4]{%
\savebox\blockbox{\parbox[b]{#1}{#4}}%
\atxy{#2}{#3}{%
\textcolor{\themytextblockcolor}{\rule[-\ht\blockbox]{\wd\blockbox}{\ht\blockbox}}}%
}
\newcommand\mytextblockcolor[1]{\edef\themytextblockcolor{#1}}
\mytextblockcolor{black}
\begin{document}
\atxy{0pt}{\paperheight}{\includegraphics[width=\paperwidth]{example-image}}
\mytextblockcolor{green}
\mytextblock{10cm}{2cm}{2cm}{\lipsum[1]}
\mytextblock{\textwidth}{8.75cm}{12.65cm}{\lipsum[3]}

\lipsum[1-3]

\end{document}


A ConTeXt solution:

\usemodule [visual]

\definelayer
[fullpage]
[x=0mm, y=0mm, width=\paperwidth, height=\paperheight]

\setlayer [fullpage]
[hoffset=0mm,voffset=0mm]
{\externalfigure[mill][height=\paperheight,page=1]}

\setupbackgrounds [paper] [background=fullpage]

\starttext
\framed[background=color,backgroundcolor=yellow,align=normal]
{\fakewords{60}{80}}
\stoptext