Dear Contexers, I have succeeded in creating letters on my pdf stationary-1. Beautiful. Now I want to print the second and following pages on paper with on a slightly different stationary (stationary-2), as is costumary. Does anyone how to set this up? (The example on the wiki is too complicated for me. I sticked to sample files from Hans Hagen, which makes it possible to use an xml address database.) The present set up for the background is given below. Kind regards, Robert Ermers \useexternalfigure[achtergrond][stationary-1.pdf][] \definelayer[achtergrond] \setupbackgrounds[page][state=repeat,background={achtergrond}] \setlayer[achtergrond][x=0in,y=0in]{\externalfigure[stationary-1.pdf]}
Rob Ermers wrote:
Dear Contexers,
I have succeeded in creating letters on my pdf stationary-1. Beautiful.
Now I want to print the second and following pages on paper with on a slightly different stationary (stationary-2), as is costumary.
Does anyone how to set this up?
(The example on the wiki is too complicated for me. I sticked to sample files from Hans Hagen, which makes it possible to use an xml address database.)
The present set up for the background is given below.
Kind regards,
Robert Ermers
\useexternalfigure[achtergrond][stationary-1.pdf][] \definelayer[achtergrond]
\setupbackgrounds[page][state=repeat,background={achtergrond}]
\setlayer[achtergrond][x=0in,y=0in]{\externalfigure[stationary-1.pdf]}
An option is to use the logo features but since layers are more fun i will probably turn that into an optional module some day (is anyone using it?) put this in cont-new.tex: \unprotect \unexpanded\def\flushlayer[#1]% {\doifelsevalue{\??ll#1\c!state}\v!next {\global\letvalue{\??ll#1\c!state}\v!start} % dangerous, stack-built-up {\doifelsevalue{\??ll#1\c!state}\v!continue {\global\letvalue{\??ll#1\c!state}\v!repeat} % dangerous, stack-built-up {\doifelsevalue{\??ll#1\c!doublesided}\v!yes {\doifundefinedelse{\@@layerbox#1}% {\dodoflushlayerA[#1]} {\doifbothsidesoverruled \dodoflushlayerB\v!left [#1]% left \orsideone \dodoflushlayerB\v!right[#1]% right \orsidetwo \dodoflushlayerB\v!left [#1]% left \od}} {\dodoflushlayerA[#1]}}}} \protect Then you can say: \definelayer[achtergrond-1][width=\paperwidth,height=\paperheight] \definelayer[achtergrond-2][width=\paperwidth,height=\paperheight,state=continue] \setupbackgrounds[page][background={achtergrond-1,achtergrond-2}] \setlayer[achtergrond-1][preset=lefttop] {\externalfigure[stationary-1.pdf]} \setlayer[achtergrond-2][preset=leftbottom]{\externalfigure[stationary-2.pdf]} \starttext test \page test \page test \page test \page \stoptext (i added the 'continue' option) Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
Hans, Thank you very much for your code. Both types of the stationary come out smoothly. There is however a small bug in it. I need a different stationary starting from every second page of my letter. If my file contains 4 letters consisting of 8 pages, his means the following: letter 1 -- page 1 -- stationary-1.pdf letter 1 -- page 2 -- stationary-2.pdf letter 2 -- page 1 -- stationary-1.pdf letter 2 -- page 2 -- stationary-2.pdf ... The code, however, does the following: letter 1 -- page 1 -- stationary-1.pdf letter 1 -- page 2 -- stationary-2.pdf letter 2 -- page 1 -- stationary-2.pdf letter 2 -- page 2 -- stationary-2.pdf ... That's to say, there is only one sheet with stationary-1, all other pages are printed on stationary-2. Do you see a possibility to adapt this? Thanks in advance. Kind regards, Robert
Rob Ermers wrote:
Dear Contexers,
I have succeeded in creating letters on my pdf stationary-1. Beautiful.
Now I want to print the second and following pages on paper with on a slightly different stationary (stationary-2), as is costumary.
Does anyone how to set this up?
(The example on the wiki is too complicated for me. I sticked to sample files from Hans Hagen, which makes it possible to use an xml address database.)
The present set up for the background is given below.
Kind regards,
Robert Ermers
\useexternalfigure[achtergrond][stationary-1.pdf][] \definelayer[achtergrond]
\setupbackgrounds[page][state=repeat,background={achtergrond}]
\setlayer[achtergrond][x=0in,y=0in]{\externalfigure[stationary-1.pdf]}
An option is to use the logo features but since layers are more fun i will probably turn that into an optional module some day (is anyone using it?)
put this in cont-new.tex:
\unprotect \unexpanded\def\flushlayer[#1]% {\doifelsevalue{\??ll#1\c!state}\v!next {\global\letvalue{\??ll#1\c!state}\v!start} % dangerous, stack-built-up {\doifelsevalue{\??ll#1\c!state}\v!continue {\global\letvalue{\??ll#1\c!state}\v!repeat} % dangerous, stack-built-up {\doifelsevalue{\??ll#1\c!doublesided}\v!yes {\doifundefinedelse{\@@layerbox#1}% {\dodoflushlayerA[#1]} {\doifbothsidesoverruled \dodoflushlayerB\v!left [#1]% left \orsideone \dodoflushlayerB\v!right[#1]% right \orsidetwo \dodoflushlayerB\v!left [#1]% left \od}} {\dodoflushlayerA[#1]}}}} \protect
Then you can say:
\definelayer[achtergrond-1][width=\paperwidth,height=\paperheight] \definelayer[achtergrond-2][width=\paperwidth,height=\paperheight,state=continue]
\setupbackgrounds[page][background={achtergrond-1,achtergrond-2}]
\setlayer[achtergrond-1][preset=lefttop] {\externalfigure[stationary-1.pdf]} \setlayer[achtergrond-2][preset=leftbottom]{\externalfigure[stationary-2.pdf]}
\starttext
test \page test \page test \page test \page
\stoptext
(i added the 'continue' option)
Hans
Rob Ermers wrote:
Hans,
Thank you very much for your code. Both types of the stationary come out smoothly. There is however a small bug in it.
I need a different stationary starting from every second page of my letter. If my file contains 4 letters consisting of 8 pages, his means the following:
letter 1 -- page 1 -- stationary-1.pdf letter 1 -- page 2 -- stationary-2.pdf
letter 2 -- page 1 -- stationary-1.pdf letter 2 -- page 2 -- stationary-2.pdf ...
The code, however, does the following: letter 1 -- page 1 -- stationary-1.pdf letter 1 -- page 2 -- stationary-2.pdf
letter 2 -- page 1 -- stationary-2.pdf letter 2 -- page 2 -- stationary-2.pdf ...
That's to say, there is only one sheet with stationary-1, all other pages are printed on stationary-2.
Do you see a possibility to adapt this?
quick answer: \setlayer[page][odd][...]{...} ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
h h extern wrote:
Rob Ermers wrote:
Hans,
Thank you very much for your code. Both types of the stationary come out smoothly. There is however a small bug in it.
I need a different stationary starting from every second page of my letter. If my file contains 4 letters consisting of 8 pages, his means the following:
letter 1 -- page 1 -- stationary-1.pdf letter 1 -- page 2 -- stationary-2.pdf
letter 2 -- page 1 -- stationary-1.pdf letter 2 -- page 2 -- stationary-2.pdf ...
The code, however, does the following: letter 1 -- page 1 -- stationary-1.pdf letter 1 -- page 2 -- stationary-2.pdf
letter 2 -- page 1 -- stationary-2.pdf letter 2 -- page 2 -- stationary-2.pdf ...
That's to say, there is only one sheet with stationary-1, all other pages are printed on stationary-2.
Do you see a possibility to adapt this?
quick answer:
\setlayer[page][odd][...]{...}
Thanks Hans for your suggestion. I'm sorry, I tried to apply the code in various ways, but I cannot get it running. The variables are all gone now [page] has taken their place. How do I have to apply this code? Thanks again in advance. Kind regards, Robert
Rob Ermers wrote:
I'm sorry, I tried to apply the code in various ways, but I cannot get it running. The variables are all gone now [page] has taken their place. How do I have to apply this code?
\definelayer[test][doublesided=yes,state=repeat] \setupbackgrounds[page][background=test] \setlayer[test][left] []{VERY ODD} \setlayer[test][right][]{VERY EVEN} \starttext test \page test \page test \page test \page test \page test \page \stoptext ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
participants (3)
-
h h extern
-
Hans Hagen
-
Rob Ermers