5

Visio can export many different image formats but only .emf and .pdf as vector graphics. Tex can only handle .eps and .pdf vector graphics and therefor .pdf is the file format to go.

But there is the problem. All PDF exports allways have a big white margin around them and can't be imported in Tex like this.

How to export a Visio graphic properly to use it in Tex?

Spenhouet
  • 952
  • 3
    For a general way to crop PDF files (not just from Visio), use the pdfcrop command line utility as described here: http://tex.stackexchange.com/questions/5559/how-to-avoid-large-margins-around-matlab-plot-in-pdf – James Jun 22 '16 at 14:43
  • 5
    I'm voting to close this question as off-topic because it is a question about Visio not about TeX. – Schweinebacke Oct 30 '17 at 09:19
  • How to remove the margin for Visio is completely off topic. This question should have been closed. – Johannes_B Oct 30 '17 at 09:19
  • 1
    @Schweinebacke Actually you are wrong. Reading this question with it's answers after the fact does look like off-topic but this question actually looks for a solution within Tex. I couldn't find any and therefore posted my workaround outside of Tex. But this is not the desired solution. Therefore this question is actually not off-topic. It was made off-topic by the existing answers or the lack of solutions within tex. But as moha showed in ins answer (4h ago) there is a tex solution to this problem. – Spenhouet Oct 30 '17 at 12:42
  • So tge question is how to trim or clip a pdf file and is not related to Visio at all and is probably a duplicate. – Johannes_B Oct 30 '17 at 17:01
  • I usually do the exporting by doing a print and saving it to a PDF. The important part tough is that remember to increase the resolution and disable any compression before hitting the print button. And then include the PDF in your latex. – user144028 Sep 22 '17 at 09:38
  • @Johannes_B Yes, could be. – Spenhouet Oct 30 '17 at 18:09
  • @Spen: You question is: How to export a Visio graphic properly to use it in Tex? If you want to ask: How can I crop a PDF graphics, e. g., exported with Visio? you should have asked this. As long as you ask, how to export something from Visio, I'll say: it is off-topic. – Schweinebacke Oct 30 '17 at 19:30
  • @Schweinebacke It is often not easy to formulate the problem you are having and the solution you are searching for. What I searched for was a solution in Tex but yes, this wasn't formulated well. I have no problem with this question getting flaggt as duplicate to a "how to crop" question. At least everyone with the same problem, searching with the same bad formulation would find a solution. – Spenhouet Oct 31 '17 at 14:40
  • What you are describing is in fact a Visio problem. So maybe it should not have been asked in a TeX-related forum. But I just found out how to solve it in Visio 2016: Before exporting the PDF, select you whole drawing. Then in the export options select "Page range -> Selection". The created PDF page will still have the same dimensions as your Visio page, but the weird border around the page is not there! – Linus Sep 06 '18 at 08:36

2 Answers2

8

I was searching for a solution for some time so it's probably usefull for someone else.

You have to do the following in the same order:

In Visio:

  1. Go to options and open Customize Ribbon
  2. Add the developertools to the menu
  3. Go to the developer tab and open Show ShapeSheet -> Print Properties
  4. Edit PageLeftMargin, PageRightMargin, PageTopMargin and PageBottomMargin to 1
  5. Fit to Drawing using Design-->Size-->Fit to Drawing
  6. Export PDF
  7. options -> current page & don't show background
  8. Save PDF file

In Tex as usual:

\begin{figure}
    \centering
    \includegraphics{graphic.pdf}
    \caption{graphic} \label{fig:graphic}
\end{figure}

I hope this helps someone else struggling with this problem.

Danny G.
  • 3
  • 2
Spenhouet
  • 952
4

I had the same problem.

I found a simple way to deal with it.

  • Save the chart as svg file by Visio.
  • open the svg file by Inkscape.
  • Save as the .pdf format
  • On the next pop up window:
    • Embed Fonts
    • Use exported object's size
    • Margin 0.1
  • click ok

Next the generated pdf file will be imported by latex easily as same as png or eps.


But some times inkscape does not read the svg file properly and some mistakes are occurred. In this case the solution which works great and mentioned above is:

  • save the pdf file by visio

  • include the pdf file in latex

  • use trim for cropping the figure in latex

for example:

\includegraphics[width=0.8\textwidth, trim={1cm 3cm 1cm 8cm},clip]{Fig.pdf}
TeXnician
  • 33,589
moha
  • 332
  • I am sometimes terrified that it is 2022 and we still need to deal with these basic problems with such complicated solutions - thank you for sharing though! – Matthias Luh Feb 02 '22 at 13:21