fplotlib_document module#
export_document(document, format, assets, dpi) exports finished pages
without plotting state or a filesystem. It returns one byte asset for PDF,
or one per page for SVG, PNG and EPS, the format named in any case. dpi
affects PNG only, and is 100 unless given, as for savefig.
save_document(document, filename, status, dpi) writes the same assets
directly to files. Both live here, not in the high-level plotting facade.
Writing a file is the one step that can fail at run time, so
save_document alone takes a status_t, optional as savefig’s is: with
it, a file that cannot be written is returned (ERROR_IO, with a message
naming the file); without it, the program stops with the message and exit
code 2. A multi-file export is not a filesystem transaction: the pages
before the file that failed have been written. An unknown format, a
document without pages, or, exporting PNG, a dpi that is not finite and
positive is a bug in the caller and stops the program. So is a PNG page
with more than MAX_PNG_PIXELS pixels: a page’s size is known before it
is exported (page_size, and png_pixels in fplotlib_backend_png to
count it at a dpi), unlike a figure cropped tight by savefig. A page may
be of no size, as the frame of a formula of negative space alone is: it is
written as such, which some PDF viewers decline to show.
The exporters do not lay out text or math. Glyph source mappings
are preserved in frames; ordinary PDF text carries ActualText, while
TeX formula source is not presented as a Unicode replacement string.
fplotlib_document (module)#
Types
document_asset_t (type)#
-
document_asset_t (type) - Attributes:
- pageinteger, Default = 0
- bytescharacter(len=:), allocatable
Procedures
export_document (subroutine)#
-
subroutine export_document(document, format, assets, dpi) - Arguments:
- documenttype(paged_document_t), intent(in)
- formatcharacter(len=*), intent(in)
- assetstype(document_asset_t), allocatable, intent(out), dimension(:)
- dpireal(kind=dp), intent(in), optional
save_document (subroutine)#
-
subroutine save_document(document, filename, status, dpi) - Arguments:
- documenttype(paged_document_t), intent(in)
- filenamecharacter(len=*), intent(in)
- statustype(status_t), intent(out), optional
- dpireal(kind=dp), intent(in), optional