Take the 2-minute tour ×

I am trying to get a dynamic \psbarcode barcode (it changes based on the page) to display in the top right corner of every single page and I would also like the text of the page to wrap around this. I am working with some nasty code and wondering what the best way of doing this is.

First I decided to put the barcode inside a header. This worked but fancyhdr complained about \headheight and ended up changing the next pages automatically and screwed up the formatting. Even though I am aware of the dangers of this incorrect \headheight, I actually wished fancyhdr wouldn't give me that warning. In the end though, I thought the header wouldn't be the best option because I want the text to wrap around it. Being in a header removes this possibility.

The code I had for the barcode and word wrapping was:

\begin{pspicture}(0,0)\psbarcode{sample text \thepage}{width=1.5 height=1.5}{qrcode}\end{pspicture}



Then I decided to use \put and \parbox to put an image on every page, as if it were some overlay. This worked great but then I realized the wrapfigure code only works on the first page. I tried using the everyshi package to execute the wrapfigure code on every page but it has not worked. I saw some posts already on here about just word wrapping around one figure but it didn't seem to help me. I did see about using the tikzpicture package but I am not sure if that's what I need.

My ideal solution (for every page):

ideal solution

Any ideas?

share|improve this question

1 Answer 1

If it is in the header, I do not understand how you want the text wrap around it. Here is solution without a fancyhdr warning. Placing it automatically on every page with wrapfig is not easy. Placing it into the text margin may be possible.

\geometry{headheight=0.6in}%  > than the barcode!
\fancyhf{}% clear all
 \begin{pspicture}(0.5in,0.5in)% save the space
  \psbarcode{sample text \thepage}{width=0.5 height=0.5}{qrcode}%





enter image description here

enter image description here

share|improve this answer
Thanks Herbert for your help. I'm able to successfully implement that part. Sorry, I was not very clear at all when I talked about the headers. I want the text to go above and wrap around. So really it's not a header at all, but I tried doing it that way (a nasty implementation) because this would force the image to be where I want it and on every page, like a header is. This image is my ideal implementation. I edited my post to add this. –  fubukada Jan 12 '12 at 13:51
@fubukada: see my edited answer –  Herbert Jan 12 '12 at 14:30
Thanks. That is what I have. The problem is on the third page of your example (the 2nd page of the Lorem ipsum) there is no barcode anymore. I am generating this latex code from an unknown amount of text and each page must have a barcode. –  fubukada Jan 12 '12 at 16:53
As I already wrote, it is possible in the margin. –  Herbert Jan 12 '12 at 17:05
I don't understand what you mean. How would that help me? That's a one time thing. I need the barcode on every page. –  fubukada Jan 12 '12 at 17:25

Your Answer


