Documentation
¶
Overview ¶
Package printpdf prints a web page to PDF with the system's own web engine, offscreen: WebKit through WKWebView on macOS, WebKitGTK on Linux (spec_desktop_024). The desktop app's Export as PDF prints the Markdown preview this way, so the PDF looks as the preview does, highlighted code and Mermaid diagrams included, with no browser to install.
The engine runs on the UI thread: inside the app that's Wails's; a program without Wails (a test) starts one with InitUI and RunMainLoop.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrTimeout = errors.New("printing the page took too long")
ErrTimeout is returned when the page didn't print in time.
var ErrUnsupported = errors.New("printing to PDF isn't supported on this system")
ErrUnsupported is returned where the system has no engine to print with.
Functions ¶
func InitUI ¶
func InitUI() bool
InitUI readies GTK for a program without Wails, such as this package's tests, on the main thread; false where there's no display.
func Print ¶
Print renders html (a whole page, its styles and pictures inline) on pages of pageSize ("A4" or "Letter"; A4 otherwise) and returns the PDF. Scripts don't run, and the page can't navigate anywhere.
func RunMainLoop ¶
func RunMainLoop()
RunMainLoop runs GTK's main loop on the calling thread, which must be the main one, after InitUI, and never returns.
Types ¶
This section is empty.