Due to faulty representation of table lines when using colored cells (discussed in many topics e.g. here and here), I need a rasterized version of my PDF, since I have no influence on the client's PDF viewer.

I'm compiling using pdflatex. First tries using Gimp allowed me to save singular pages as a rasterized version - however, I'm looking for a (semi-)automated way to save large PDF files as a rasterized PDF.

Best case szenario would be a modification of the pdflatex options.

  • I normally redraw the lines on top of the colors if I need a perfect result. See e.g. tex.stackexchange.com/questions/134263/…. – Ulrike Fischer Apr 12 '16 at 8:00
  • Whoa fast answer. I'll have a look into that, I tried a similar approach which turned out unfeasible since I needed the exact heights of the table cells. Anyways - having the vectorized PDF with nice lines would definitely be awesome. – PSC Apr 12 '16 at 8:02
  • @Ulrike Hmm, From reading the comments, I don't see a solution for a longtable, which I am using (actually a longtabu, but that should make no difference), so the problem can only be solved partially I guess. – PSC Apr 12 '16 at 10:39
  • I redraw lines in longtables too. But it can be fiddling (in all tabulars). – Ulrike Fischer Apr 12 '16 at 10:50
  • Okay, Problem is, that I'm automatically creating tables from csv-data using pgfplotstable and while the number of columns is always the same, the number of rows differs almost always (the height of the cells as well). However, if you tell me, that your approach works once it is setup, I'll be glad to learn. – PSC Apr 12 '16 at 10:56
up vote 1 down vote accepted

It is not very difficult to redraw lines. You only need enought suitable \tikzmark/\pgfmarks -- you can create them automatically with some counter. You can even use them in tikz commands before they are set to draw backgrounds. In a setup with automatic breaks you should put the \tikz-commands inside the cells to that they don't get separated from their mark by a page break.



\tikz[overlay,remember picture]\fill[yellow,]  ({pic cs:tabstart} |- {pic cs:a1}) rectangle ({pic cs:tabend} |- {pic cs:a2});

abcxxxxxxxxxxxxxxx               \\\noalign{\pgfmark{a1}}

\tikz[overlay,remember picture]\draw[red,]  ({pic cs:tabstart} |- {pic cs:a1}) --({pic cs:tabend} |- {pic cs:a1});
\tikz[overlay,remember picture]\draw[green,]({pic cs:tabstart} |- {pic cs:a2}) --({pic cs:tabend} |- {pic cs:a2});


enter image description here

  • okay, this solution is indeed simple. However, I cannot yet see, how it can be automated with pgfplotstable so each pgfmark can get a unique number. – PSC Apr 12 '16 at 13:26
  • Use a counter and \stepcounter{counter}\pdfmark{XXX\thecounter}. – Ulrike Fischer Apr 12 '16 at 13:34
  • (Note: I think you meant pgfmark rather than pdfmark). I'm slowly getting there. Unfortunately, inserting the pgfmark at the BEGINNING of each line (seems to me to be easier to achieve using pgfplotstable) results in messed up vertical spacing in all rows. One row looks like this \hhline {--}\stepcounter {linespgf}\pgfmark {test\thelinespgf }aaaaaa:&bbbbbb\\% so I guess, the pgfmark has some kind of size (using \noalign might fix it, but that doesn't work in my tabu-environments) – PSC Apr 12 '16 at 14:21
  • In a cell use better \tikzmark, \pgfmark doesn't start a paragraph. But in a cell the mark is on the baseline of the cell which makes it difficult to find the borders. \noalign is better as it inserts the mark between the rows. – Ulrike Fischer Apr 12 '16 at 14:26
  • I figured that \noalign would be required, so it's back to square 1 for me, this time using \noalign... – PSC Apr 12 '16 at 14:27

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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