# Printing a table as PNG?

I wrote a whole latex file. Due to journal's restrictions, I am forced to submit a word file. Since I have pretty complex tables: I don't want to rebuild in Word and copying tables with snipping tool (Windows) from displayed PDF results in a pretty poor resulution, I wondered whether it is possible to print tables as PNG? Is there a more intelligent way to achieve better results?

Some toy table taken from https://en.wikibooks.org/wiki/LaTeX/Tables as MWE:

\documentclass{article}
\begin{document}
\begin{tabular}{l*{6}{c}r}
Team              & P & W & D & L & F  & A & Pts \\
\hline
Manchester United & 6 & 4 & 0 & 2 & 10 & 5 & 12  \\
Celtic            & 6 & 3 & 0 & 3 &  8 & 9 &  9  \\
Benfica           & 6 & 2 & 1 & 3 &  7 & 8 &  7  \\
FC Copenhagen     & 6 & 2 & 1 & 3 &  5 & 8 &  7  \\
\end{tabular}
\end{document}

• Quick and dirty: make a screenshot – user36296 Jul 28 '17 at 12:47
• Doesn't Word allow you to embed a SVG picture? I know LibreOffice admits it. – Andrea Lazzarotto Jul 28 '17 at 14:04
• There are plenty of ways to convert a PDF (be it LaTeX generated or not) to SVG. If Word allows you to insert a SVG file, you should consider taking this route. I did it with both LibreOffice Writer and LibreOffice Impress in the past and I was able to even retain the text content as searchable text. – Andrea Lazzarotto Jul 28 '17 at 17:49
• PS: woah, it seems that you can either use EMF or SVG (the latter only from Word 2016 onwards): superuser.com/q/397644/278831 You can then retain all the advantages of vector-quality output! – Andrea Lazzarotto Jul 28 '17 at 17:50
• You can also open a PDF document directly with Word 2016 onwards. Has saved me hours of work in similar situations. – Mace Jul 28 '17 at 18:54

For the sake of completeness, I'd like to add that the standalone class can export the document to PNG format (using ImageMagick's convert under the hood), provided that the engine is executed with the --shell-escape option:

\documentclass[convert]{standalone}
\begin{document}
\begin{tabular}{l*{6}{c}r}
Team              & P & W & D & L & F  & A & Pts \\
\hline
Manchester United & 6 & 4 & 0 & 2 & 10 & 5 & 12  \\
Celtic            & 6 & 3 & 0 & 3 &  8 & 9 &  9  \\
Benfica           & 6 & 2 & 1 & 3 &  7 & 8 &  7  \\
FC Copenhagen     & 6 & 2 & 1 & 3 &  5 & 8 &  7  \\
\end{tabular}
\end{document}


When invoked without any options, the used preset will be: PNG format, a density of 300 dpi, no explicit size and the output file name is given by \jobname + .png extension. The standalone class has other options, so I recommend taking a look at the documentation. :)

Others have provided good answers but I have one that is simpler, at least for me.

1. Compile the Tex file to a PDF
2. Open the PDF with Inkscape (or another vector graphics program like Adobe Illustrator)
3. Size the page to your needs and export a PNG.

Here is my exported PDF at 300 dpi. I like this method because it's easy to re-export your figures as any file format that you need. I think this solution is fairly elegant as it can allow you to save the vectorized graphics if you chose to save it as a PDF file.

Another way is to use the dvipng program which comes with miktex and texlive. Assuming your file is called mytable.tex you can use the following:

latex mytable.tex
dvipng -D 300 -bg Transparent -T tight -o mytable.tex.png mytable.tex.dvi


The first line will generate a .dvi file which is used to generate a .png file with a resolution of 300 dpi in the second line.

I prefer to use the standalone document class when creating images with latex, since it crops any white space around the content.

Definitely possible, I found some good reads:

3. Copy your pdf to the image magic folder. Lets call it tabular.pdf
4. On Windows: you press Ctrl+Rand then type cmd- this will open a command-line window for for you.
5. Change to the correct directory by typing cd **"**IMAGMAGICKPATH**"**. The IMAGMAGICKPATH should be the path were you unpacked your portable IMAGEMAGICK or wherever you installed IMAGEMAGICK. In my case I used cd "C:\Users\nhck\Downloads\ImageMagick-7.0.6-3-portable-Q16-x64".
6. No, to convert, type: convert -density 300 -quality 100 tabular.pdf tabular.png
edit: Maybe a comment on convert: You can find the handbook for convert here: http://www.imagemagick.org/script/convert.php In the example I set the densityoption to 300 - representing a resolution of 300dpi. This should be sufficient for print. If you plan to resize (enlarge the image) you should go for a higher resolution here. The qualityoption addresses image compression: The lower this value the lower the output file size and the image quality. In your case quality is most important and file size typically doesn't matter, so I set it to 100 - which is the upper limit.