Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I had inserted a pdf file in latex use this code

\documentclass[a4paper,12pt]{book}
\usepackage{mdframed}
\begin{document}
\includepdfmerge{hello.pdf,1}
\end{document}

I want to insert some text on the first page .

I want this text have background color green and it can be put at any location i want

so I found this code to have my second requirement .

\definecolor{Green}{rgb}{0.465,0.725,0}
\put(99,9){\fcolorbox{Green}{Green}{\textcolor{black}{hello}}}

How can I combine this ?

share|improve this question

migrated from stackoverflow.com Mar 12 '13 at 12:18

This question came from our site for professional and enthusiast programmers.

1  
Welcome to TeX.sx! Your post was migrated here from another Stack Exchange site. Please register on this site, too, and make sure that both accounts are associated with each other (by using the same OpenID), otherwise you won't be able to comment on or accept answers or edit your question. –  lockstep Mar 12 '13 at 12:24

1 Answer 1

You can start with this example:

\documentclass[a4paper,12pt]{book}
\usepackage{mdframed}
\usepackage{pdfpages}
\usepackage[left=0cm,right=0cm,top=0cm,bottom=0cm]{geometry}
\setlength\parindent{0pt}
\definecolor{Green}{rgb}{0.465,0.725,0}
\pagestyle{empty}
\begin{document}
\vbox{\includepdfmerge{hello.pdf,1}}%
\setlength{\unitlength}{1mm}%
\vfill
\begin{picture}(200,200)(0,0)%
\put(100,100){\fcolorbox{Green}{Green}{\textcolor{black}{hello}}}%
\end{picture}%
\end{document}

This MWE sets the page geometry and removes \parindent to get enough space for a A4 page to be included from the external pdf file. Also \pagestyle is set to empty to prevent typesetting of the page number. Command \includepdfmerge from the pdfpages package extracts the first page from hello.pdf (any A4 pdf file, not included in the MWE) and puts if into a vertical box by \vbox command. \unitlength defines the coordinate units (mm) to be used by the picture environment (default is 1pt). \vfill pushes the following picture to the bottom of the page, to be able to use the bottom left corner of the page as a reference point (0,0). The picture environment reserves space (200x200) for the picture drawing area and applies the command from the question to put a text box on a green background at the location (100,100) on top of the included pdf page.

share|improve this answer
    
Can you please explain what you are doing in your MWE? Consider that not the macros you use must be known by the op ... –  Kurt Mar 12 '13 at 18:45
    
@Kurt: explanation added. –  g.kov Mar 13 '13 at 1:53

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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