Issues With Print PDF Exporting

This section covers issues (and, where know, their solutions) that are known to occur when exporting regular Pressbooks text to Print PDF format. For issues related to LaTeX not displaying properly in PDF exports, please see Math Typesetting: LaTeX.

Mysterious Spaces in PDF

If spaces are appearing in the PDF version of your text that are not present in the Pressbooks version, these may be caused by the NO-BREAK SPACE character (U+00A0, or <0xa0>). This character is not visible in the Pressbooks Visual or Text editors, but can be seen by copy/pasting the HTML text into a text editor such as Notepad++ or Sublime Text (you may have to ensure the editor is set to display all characters).

Issues With Tables (Sizing and Word Wrap)

  • Tables with fixed widths (“width: 987px” rather than “width: 100%”) sometimes overflow to the right of the page. These need to be adjusted in the Pressbooks Text Editor, with the overall table width as well as the column widths made dynamic (a percentage value) or the width property left out altogether.
  • There is a word wrap issue in tables when exporting to PDF. To prevent this, add the following CSS to Appearance->Custom Styles (make sure you navigate to the PDF page using the dropdown menu at the top). If you have added the boilerplate CSS to both the Web and PDF Custom Styles, you are already covered:

/*normal word wrap in tables*/

td, th {

  word-break: normal !important;

  overflow-wrap: normal !important;

}

Issues With TablePress Tables (Styling not showing)

By default, tables created in TablePress will render with very minimal styling when exported to PDF. In order to apply styling to these tables, you must apply custom styles (in the PDF section in Appearance->Custom Styles) to the classes generated by TablePress. You can discover these by previewing the table in your web page and inspecting it using your browser’s developer tools (in Chrome you would right click on the table and select “Inspect”).  Here is an example that renders a table with a heading having a black background and white lettering, followed by rows with background colour alternating between white and light gray:

/* TablePress styling*/
.tablepress thead tr {
background-color: black;
color: white;
}

.tablepress tbody tr.odd {
background-color: lightgray;
}

Awkward Page Breaks

Exporting to PDF sometimes causes page breaks to occur in awkward places.  For ways to exert more control over where page breaks occur, read on!

Pressbooks provides two special classes which can be used to produce section breaks in your PDF exports:

  • class=”section-break” can be applied to an element to create a section break
  • class=”section-break-page” can be applied to an element create a section break which includes a page break after the section break

You can also force a page break in your PDF exports before or after any block-level element (like a paragraph or heading) by adding class=”page-break-before” or class=”page-break-after” to the desired element.

<h2 class="page-break-before">A heading which will have a page break before it is rendered</h>

<p class="page-break-after">This is a paragraph which will have a page break after it is rendered!</p>

To add a blank page to your PDF export you can add the following markup:

<div class="blank-page">*</div>

Note: The “*” won’t be displayed and is simply included as placeholder text.

Images Appear Pixelated / Low Resolution

Unfortunately, as of the time of this writing, this issue remains unresolved. This may be prevented somewhat by using high quality images in the original Pressbook, but the disparity between the PDF image quality and the Pressbooks image quality appears to be caused at a level in the process to which we do not have access.

Apply Special Formatting” from Pressbooks User Guide by Pressbooks is licensed under a Creative Commons Attribution 4.0 International License, except where otherwise noted.

License

Icon for the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License

Fanshawe OER Training Guide Copyright © 2024 by Fanshawe College is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License, except where otherwise noted.

Share This Book