GNU TeXmacsUser manualReferenceAboutEnglish
PDF export

1.Introduction

TeXmacs writes PDF itself, without going through PostScript or LaTeX: the boxes of the typeset document are drawn on a renderer, pdf_hummus_renderer_rep, which turns the drawing commands into the content streams, fonts, images, links and outlines of a PDF file with the help of the PDFHummus library. When TeXmacs is built without this renderer, or when the user switches it off, the document is printed to PostScript and converted by Ghostscript.

This chapter follows a document from the File\(\rightarrow\)Export\(\rightarrow\)Pdf menu to the file: how it is typeset for printing, how the renderer is chosen and organized, how text and fonts are written so that the PDF can be searched and copied, and how links, bookmarks and metadata are produced. The images and attachments of PDF files are described in images in PDF and PostScript output, and the renderer interface common to all output devices in the renderer interface.

2.Overview

export-buffer / print-to-file (scheme)
  -> edit_main_rep::print_doc (name, conform, first, last)
       typeset_as_document with page-medium paper, printing dpi
       printer (name, dpi, pages, …)      -> pdf_hummus_renderer
       set_metadata (title, author, subject)
       for each page: box->redraw (ren); ren->next_page ()
         draw (glyphs)                  -> native font or Type 3 font
         line, fill, image, …         -> content stream, XObjects
         href, anchor, toc_entry   -> links, destinations, outlines
       tm_delete (ren)                 -> flush everything, EndPDF

The renderer writes the pages as it goes and keeps everything else (fonts, images, patterns, transparency states, destinations, outlines, annotations, metadata) in tables, which the destructor writes at the end.

3.Source files

Plugins/Pdf/pdf_hummus_renderer.cpp
,
pdf_hummus_renderer.hpp

The renderer: pages, graphics state, fonts and text, images and patterns, links, outlines and metadata.

Edit/Editor/edit_main.cpp

Printing: print_doc, use_pdf, use_ps, the metadata and the optional check of the result.

Plugins/Ghostscript/gs_utilities.cpp

The conversions between PostScript and PDF, the check of exported files and the PDF version.

texmacs/texmacs/tm-print.scm
,
texmacs/menus/preferences-widgets.scm

The printing preferences and their dialog.

Plugins/Pdf/PDFWriter
,
Plugins/Pdf/LibAesgm

The vendored PDFHummus library and the AES code it uses for encryption.

fonts/pdf-font-issues.scm

Font files which PDFHummus must not embed.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".