qtpdf.py 808 B

123456789101112131415161718192021222324252627282930
  1. """Export to PDF via a headless browser"""
  2. # Copyright (c) IPython Development Team.
  3. # Distributed under the terms of the Modified BSD License.
  4. from traitlets import Bool
  5. from .qt_exporter import QtExporter
  6. class QtPDFExporter(QtExporter):
  7. """Writer designed to write to PDF files.
  8. This inherits from :class:`HTMLExporter`. It creates the HTML using the
  9. template machinery, and then uses pyqtwebengine to create a pdf.
  10. """
  11. export_from_notebook = "PDF via HTML"
  12. format = "pdf"
  13. paginate = Bool( # type:ignore[assignment]
  14. True,
  15. help="""
  16. Split generated notebook into multiple pages.
  17. If False, a PDF with one long page will be generated.
  18. Set to True to match behavior of LaTeX based PDF generator
  19. """,
  20. ).tag(config=True)