Thanks to visit codestin.com
Credit goes to github.com

Skip to content

How to allow export to PDF? #25

@Naereen

Description

@Naereen

Hello there,

Description

First of all, I LOVE your extension, I really like it and plan to use it intensely for my teaching material from now on.
The support for HTML export (including in a Jupyter book, for instance here) is excellent.
Capture d’écran_2021-02-14_18-02-49

What I Did

But I would also like to be able to export the Tikz figures to PDF, but apparently it breaks the jupyter-nbconvert --to pdf command:

$ jupyter-nbconvert --to pdf ExamplePython.ipynb
[NbConvertApp] Converting notebook Exemple de notebook avec OCaml.ipynb to pdf
Warning: Option --without-gui= is deprecated
Warning: Option --export-pdf= is deprecated

** (org.inkscape.Inkscape:6978): WARNING **: 17:31:49.318: Can't open file: /tmp/tmphabmy2re/figure.svg (doesn't exist)

** (org.inkscape.Inkscape:6978): WARNING **: 17:31:49.318: Can't open file: /tmp/tmphabmy2re/figure.svg (doesn't exist)
ink_file_open: '/tmp/tmphabmy2re/figure.svg' cannot be opened!
InkscapeApplication::document_open: Failed to open: /tmp/tmphabmy2re/figure.svg
ConcreteInkscapeApplication::on_open: failed to create document!
Traceback (most recent call last):
  File "/usr/local/bin/jupyter-nbconvert", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.6/dist-packages/jupyter_core/application.py", line 270, in launch_instance
    return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/jupyter_core/application.py", line 270, in launch_instance
    return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/traitlets/config/application.py", line 664, in launch_instance
    app.start()
  File "/usr/local/lib/python3.6/dist-packages/nbconvert/nbconvertapp.py", line 340, in start
    self.convert_notebooks()
  File "/usr/local/lib/python3.6/dist-packages/nbconvert/nbconvertapp.py", line 510, in convert_notebooks
    self.convert_single_notebook(notebook_filename)
  File "/usr/local/lib/python3.6/dist-packages/nbconvert/nbconvertapp.py", line 481, in convert_single_notebook
    output, resources = self.export_single_notebook(notebook_filename, resources, input_buffer=input_buffer)
  File "/usr/local/lib/python3.6/dist-packages/nbconvert/nbconvertapp.py", line 410, in export_single_notebook
    output, resources = self.exporter.from_filename(notebook_filename, resources=resources)
  File "/usr/local/lib/python3.6/dist-packages/nbconvert/exporters/exporter.py", line 179, in from_filename
    return self.from_file(f, resources=resources, **kw)
  File "/usr/local/lib/python3.6/dist-packages/nbconvert/exporters/exporter.py", line 197, in from_file
    return self.from_notebook_node(nbformat.read(file_stream, as_version=4), resources=resources, **kw)
  File "/usr/local/lib/python3.6/dist-packages/nbconvert/exporters/pdf.py", line 171, in from_notebook_node
    nb, resources=resources, **kw
  File "/usr/local/lib/python3.6/dist-packages/nbconvert/exporters/latex.py", line 88, in from_notebook_node
    return super(LatexExporter, self).from_notebook_node(nb, resources, **kw)
  File "/usr/local/lib/python3.6/dist-packages/nbconvert/exporters/templateexporter.py", line 307, in from_notebook_node
    nb_copy, resources = super(TemplateExporter, self).from_notebook_node(nb, resources, **kw)
  File "/usr/local/lib/python3.6/dist-packages/nbconvert/exporters/exporter.py", line 139, in from_notebook_node
    nb_copy, resources = self._preprocess(nb_copy, resources)
  File "/usr/local/lib/python3.6/dist-packages/nbconvert/exporters/exporter.py", line 316, in _preprocess
    nbc, resc = preprocessor(nbc, resc)
  File "/usr/local/lib/python3.6/dist-packages/nbconvert/preprocessors/base.py", line 47, in __call__
    return self.preprocess(nb, resources)
  File "/usr/local/lib/python3.6/dist-packages/nbconvert/preprocessors/base.py", line 69, in preprocess
    nb.cells[index], resources = self.preprocess_cell(cell, resources, index)
  File "/usr/local/lib/python3.6/dist-packages/nbconvert/preprocessors/convertfigures.py", line 46, in preprocess_cell
    self.from_format, output.data[self.from_format])
  File "/usr/local/lib/python3.6/dist-packages/nbconvert/preprocessors/svg2pdf.py", line 110, in convert_figure
    raise TypeError("Inkscape svg to pdf conversion failed")
TypeError: Inkscape svg to pdf conversion failed

  • itikz version: 0.1.5
  • Python version: 3.6.9
  • Operating System: Ubuntu (GNU/Linux) 18.04

Thanks in advance! Regards, -- @Naereen

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions