wxMaxima
Loading...
Searching...
No Matches
Data Structures | Public Member Functions | Static Public Member Functions | Static Public Attributes
PdfExport Class Reference

Writes a worksheet to a PDF file. More...

#include <PdfExport.h>

Data Structures

class  Impl
 
struct  Options
 What goes into the PDF besides the worksheet. More...
 

Public Member Functions

 PdfExport (GroupCell *tree, const Configuration *source, const Options &options)
 Prepares the export of a worksheet.
 
bool Write (const wxString &file)
 Writes the PDF. Returns false if the file could not be written.
 
std::size_t GetPageCount () const
 The number of pages the last Write() produced.
 

Static Public Member Functions

static bool Available ()
 Was wxMaxima built with the PDF export?
 
static wxString Diagnosis ()
 What Help > Troubleshooting says about the PDF export.
 
static wxPaperSize PaperFromName (const wxString &name)
 The paper size a name like "a4" or "letter" stands for.
 
static wxString DocumentTitle (GroupCell *tree, const wxString &fallback)
 A title for the PDF: the worksheet's first title cell.
 
static wxString UiLanguageTag ()
 The BCP 47 language tag of wxMaxima's user interface, e.g.
 

Static Public Attributes

static constexpr int LayoutPpi = 720
 The resolution of the coordinates the worksheet is laid out in.
 
static constexpr int ReferencePpi = 96
 The resolution wxMaxima's font sizes and lengths are meant for (see Printout)
 

Detailed Description

Writes a worksheet to a PDF file.

The worksheet is drawn by the cells' own Draw() methods onto a wxPdfDC, so the PDF looks like the printout – but unlike a printout through a "print to PDF" driver:

The drawing needs wxPdfDocument (thirdparty/wxpdfdoc, see cmake/WxmPdfDoc.cmake): without it, Available() is false and Write() fails.

The export uses a copy of the worksheet laid out with a configuration of its own, the way Printout does, so the worksheet itself is left alone.

Constructor & Destructor Documentation

◆ PdfExport()

PdfExport::PdfExport ( GroupCell *  tree,
const Configuration *  source,
const Options &  options 
)

Prepares the export of a worksheet.

Parameters
treeThe first GroupCell of the worksheet. Only read: the export works on a copy.
sourceThe worksheet's configuration. The settings that decide what is shown (code cells, the print scale and margins, the styles) are taken from the user's configuration, as printing does.

Member Function Documentation

◆ Diagnosis()

wxString PdfExport::Diagnosis ( )
static

What Help > Troubleshooting says about the PDF export.

Without it, this names the reason CMake found when configuring the build (the git submodule wasn't checked out, fontconfig is missing, ...), the same reason the configure step's feature summary prints.

◆ DocumentTitle()

wxString PdfExport::DocumentTitle ( GroupCell *  tree,
const wxString &  fallback 
)
static

A title for the PDF: the worksheet's first title cell.

Parameters
fallbackWhat to use if the worksheet has no title cell, e.g. the file name

◆ PaperFromName()

wxPaperSize PdfExport::PaperFromName ( const wxString &  name)
static

The paper size a name like "a4" or "letter" stands for.

Returns
wxPAPER_NONE for an unknown name

◆ UiLanguageTag()

wxString PdfExport::UiLanguageTag ( )
static

The BCP 47 language tag of wxMaxima's user interface, e.g.

"de-DE"

Falls back to "en" for the C/POSIX locale.

Field Documentation

◆ LayoutPpi

constexpr int PdfExport::LayoutPpi = 720
staticconstexpr

The resolution of the coordinates the worksheet is laid out in.

wxMaxima's geometry is integer, so this is also the precision of every position in the PDF: 1/720 inch, 1/10 of a point. Pdfout uses it, too.


The documentation for this class was generated from the following files: