2
$\begingroup$

I am using Mathematica through command line MathKernel. I am not trying to draw any graphics in the console. But I should be able to export things a CDF. Why can't I export a CDF through command line ? Why do we need a graphical font end to export a CDF ? Is there any way around ? Interestingly Show did not throw error. However silently suppressed the circle.

In[1]:= TabView[{Show[Graphics[Circle[]]]}]                                                                        

Out[1]= TabView[{-Graphics-}]

In[2]:= Export["/tmp/file.cdf", TabView[{Show[Graphics[Circle[]]]}]]                                               

FrontEndObject::notavail: A front end is not available; certain operations require a front end.

Export::errelem: The Export element NotebookObject
     contains a malformed data structure and could not be exported to CDF format.

Out[2]= $Failed

I am actually trying to do the same through WSTP and getting the same result. So I was curious to check whether same happens with MathKernel or not.

$\endgroup$
  • $\begingroup$ Have you tried using UsingFrontEnd @ Export[..]? $\endgroup$ – Carl Woll Nov 3 '17 at 21:25
  • $\begingroup$ What's that ? Never seen any thing like this. Will tomorrow and let you know. But what does it mean ? $\endgroup$ – Neel Basu Nov 3 '17 at 21:26
  • $\begingroup$ ?UsingFrontEnd UsingFrontEnd[expr] evaluates expr, making use of a front end if necessary. >> $\endgroup$ – Carl Woll Nov 3 '17 at 21:31
  • $\begingroup$ I think the issue is that you are typing CDF when you mean PDF (as you have in the title). If you change /tmp/file.cdf to /tmp/file.pdf everything works fine (Mathematica 11.1, Windows 7). $\endgroup$ – JimB Nov 3 '17 at 23:59
  • $\begingroup$ Sorry that was a typo $\endgroup$ – Neel Basu Nov 4 '17 at 5:45

Your Answer

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

Browse other questions tagged or ask your own question.