7
$\begingroup$

In the helpfile there is a nice axample of text analysis (example/LexicalAnalysis)

Text[Row[With[{data = 
     ExampleData[{"Text", "DeclarationOfIndependence"}, "Words"]}, 
   Table[Style[data[[i]], 
     10 N[Log[Count[Take[data, i], data[[i]]]]]], {i, Length[data]}]],
   " "]]

The result of this scripts isenter image description here

When I export this output as a pdf file, the result is a empty document. On the internet I found a suggestion to export first to the formmat 'eps' and then to 'pdf'. In my case I created onley the last page. Anybody a suggestion to export this analysis (in the way it's formatted) to somebody else who has no mathematica on his computer.

$\endgroup$
6
$\begingroup$

I checked the exported EPS from Mathematica on Windows 8.1. The whole contents are all included in the EPS file, but the page size / bounding box is quite unusual. So I guess it's possible the PS-to-PDF converter you used did not respect that page size, thus some contents are cropped. I found two ways working here:

  1. Using MMA's converter, i.e.

    Export["xx.pdf", 
           ImportString[ExportString[testText, "EPS"], "EPS"]
          ]
    

    MMA's PDF converter seems respect the page size (at least on my machine), so this will work. But it can be unstable once the testText getting large/complex.

  2. Exporting to EPS, then using third-party tools (like ps2pdf) to convert it to PDF. In this way, you can specify the page size in the tool manually.

In case you want to assign a page size at the very beginning, I found using Pane with fixed size is a handy trick. e.g.

Export["xxx.eps",
       Pane[exampleText, {500, 200}, ImageSizeAction -> "ShrinkToFit"]
      ]

Then in the console run

ps2pdf -dDEVICEWIDTHPOINTS=500 -dDEVICEHEIGHTPOINTS=200 xxx.eps xxx.pdf

The result will look somehow similar to exampleText in MMA's FrontEnd:

generated pdf

Finally there are some issues worth notice, e.g. EPS does not support transparency, etc. I would suggest searching the site for more details.

$\endgroup$
2
  • $\begingroup$ This works on Macs, too. Annoyingly, the ImportString trick doesn't work with "PDF" in this example, so "EPS" does indeed seem to be unavoidable. $\endgroup$
    – Jens
    Sep 22 '14 at 23:05
  • $\begingroup$ @Jens I think MMA's PDF converter is too slow and the result files are too large, and it always exist with a corrupted pdf (for this issue maybe I should try again when I have sufficient RAM). I would actually rather set up a special notebook then using whatever pdf virtual printer I have. $\endgroup$
    – Silvia
    Sep 22 '14 at 23:29
1
$\begingroup$

If in the notebook you Save Selection as a .PNG, it seems to work fine. the PDF (when viewed with Acrobat Pro) is NOT empty, but has a bunch of empty squares where letters ought to be - I don't know enough about the vagaries of PDF to interpret this.

$\endgroup$
1
  • 2
    $\begingroup$ The squares probably mean the font is unavailable to Acrobat. $\endgroup$
    – bill s
    Sep 22 '14 at 14:32

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.