7
$\begingroup$

I need to insert a PDF paragraph (from LaTeX) in a cell. I realized that the option "Insert file" does not work with PDF text.

Because I need resize the paragraph without quality loss, PNG image is not an option. So, my strategy is: Convert PDF to SVG with pdf2svg (Ubuntu's program)

pdf2svg pba.pdf  SALIDA%d.svg all

and text is converted to outlines, and after I save it in PDF format. The result is good and I can edit and make some adjusts with Drawing Tools.

enter image description here

But it no seems very efficent procedure. Is there another way to do it?

$\endgroup$
  • $\begingroup$ You could post that update as a self-answer (if you like). $\endgroup$ – Szabolcs Jan 3 '18 at 19:30
7
$\begingroup$

Mathematica always outlines text when Importing PDF as Graphics. There's no way around that. Update: There is the "TextOutlines" option, as Alexey notes in a comment below.

Some PDF files are not imported correctly by Mathematica. There can be multiple reasons for this. We would have to see your PDF file to see why it doesn't import correctly.

If the reason is indeed fonts, you can outline fonts using Ghostscript 9.15 or later. Example command line:

gs -o out.pdf -dNoOutputFonts -sDEVICE=pdfwrite in.pdf

I use this in MaTeX.

$\endgroup$
  • $\begingroup$ Thanks, I've tried your command line code and it works, I used the new PDF and I've been able to import the pdf without problems. To my purposes, the outlines text it's oK. I have also tried matex, and it is excellent for my purposes. Sincerely, thanks a lot $\endgroup$ – wmora2 Nov 3 '16 at 1:47
  • 1
    $\begingroup$ "Mathematica always outlines text when Importing PDF as Graphics." - this isn't correct: try Import[fileName, "PDF", "TextOutlines" -> False]. For importing ASCII text it usually works nicely. $\endgroup$ – Alexey Popkov Apr 30 '17 at 12:44
  • $\begingroup$ Ok, I already did $\endgroup$ – wmora2 Jan 3 '18 at 19:49
2
$\begingroup$

I use the tcolorbox package to work with paragraphs, examples, definitions, theorems, etc. Example:

enter image description here

<< MaTeX`
SetOptions[MaTeX, 
  "Preamble" -> {"\\usepackage[most,listings]{tcolorbox}", 
    "\\tcbset{colframe=white}"}];
MaTeX["\\mbox{\\begin{tcolorbox}[colback=white]
 Esta es una prueba con el paquete {\\tt tcolorbox }\\\\

 $f(x)=\\left\\{\\begin{array}{rcl}
 x^2       &si& x>0\\\\ \\\\
 \\sin x   &si& x<0
 \\end{array}\\right.
 $\\end{tcolorbox}}", Magnification -> 1.5]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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