Produce Exports
Fix Validation Errors
Pressbooks EPUB and PDF files are made to be compatible with the submission specifications at all major ebook stores and print-on-demand services. However, sometimes markup that isn’t compatible with the EPUB or PDF file formats can be imported into Pressbooks when you bring in your content. We recommend testing your files before you submit them to your distributor of choice to make sure they pass all specifications.
Email Yourself Validation Logs
You can decide whether or not you want to receive validation logs for all your exported files. To enable or modify this setting:
- Go to Settings > Export from the left sidebar menu in Pressbooks
- Next to “Email Validation Logs,” choose either “Yes” or “No”
- Click Save Changes
By default, all books’ Email Validation Log setting is set to “No. Ignore validation errors.” If you choose to receive validation logs (or error reports) from Pressbooks, all file validation error logs will be forwarded to the email address associated with your Pressbooks account.
Afterward, you’ll receive a message whenever any file you export has an error. You’ll know exported files contain errors if you see a banner at the top of the Export screen that reads: “Warning: The export has validation errors. See logs for more details.”
Each type of file is validated against different standards, so their validation logs will also differ.
Interpret EPUB Validation Logs
EPUB validation logs will appear in your email inbox with the following subject line: Pressbooks\Modules\Export\Epub\
Below is an example of what an error report may look like.
Array
(
[time] => Mon Dec 10 22:17:33 2018
[user] => tmcgrath
[site_url] => https://yourbooktitle.pressbook
[blog_id] => 107381
[theme] => Atwood
)
ERROR(RSC-020): /srv/www/pressbooks.com/releas
Check finished with errors.
This sample validation log can be broken down into parts. The initial Array includes specific metadata about your book. You’ll see the time the book was exported, the username of the person who exported the book, and the URL of the book in Pressbooks, its ID number, and theme. The error message itself includes several important pieces of information:
ERROR(RSC-020): The part in parenthesis refers to type of validation error produced by EPUBCheck. This particular error code is shown when the validator finds an invalid URL.
/srv/www/pressbooks.com/releases/20181205114740/web/app/uploads/sites/107381/pressbooks/exports/Test-Book-2-1544480239.epub/OEBPS/chapter-056-your-chapter.html: The bolded part of this string tells you which part of the EPUB file the validation error was found in. In this example, the message is telling us that the error occurred in chapter 35, which has been titled “Your Chapter.” If you saved a chapter before giving it a title, this URL will have the randomly generated slug instead of the chapter’s title.
(26,268): The last piece of data from this URL is the exact line and character the error occurs at in your EPUB file’s HTML. You can unzip your EPUB file and use a text editor (or Calibre) to open the file in question to inspect the exact location.
‘http://bit.ly/btb-v092″>http://bit.ly/btb-v092’ is not a valid URL: This part of the message gives us more information about the RSC-020 (invalid URL error). In this case, the error message has provided the offending text which should help you more quickly find and fix the problem in the relevant chapter.
Interpret PDF Validation Logs
PDF files tend to have fewer validation errors than ebook files. However, errors still sometimes occur. PDF validation logs will appear in your email inbox with the subject line: Pressbooks\Modules\Export\Prince\Pdf
Below is an example of what a PDF validation log may look like.
(
[time] => Tue Sep 19 01:09:21 2017
[user] => tmcgrath
[site_url] => https://yourbooktitle.pressbo
[blog_id] => 64631
[theme] => Adunis
[url] => http://yourbooktitle.pressboo
)
Mon Sep 18 21:09:16 2017: —- begin
Mon Sep 18 21:09:20 2017: page 163: warning: no font for Emoticons character U+1F609, fallback to ‘?’
Mon Sep 18 21:09:21 2017: finished: success
Mon Sep 18 21:09:21 2017: —- end
The PDF validation log is straightforward; you’ll see the date stamps for the beginning, the flagged errors, the successful finish, and the end of the process. The only part you’ll need to look at is the error.
Find an error by looking for the word “warning”. Each warning will begin with a timestamp. Afterward, you’ll see a description of the error. For the example above, on page 163, the PDF converter was unable to find a font in the file that supplied the emoticon character entered by the user.
To solve an error like the one above, a user can find the page number from the error report, go to its chapter in Pressbooks, and remove the emoticon that caused the problem.
SASS Error Validation Logs
SASS errors report problems with your book’s CSS (cascading style sheet). SASS errors appear in your email inbox with the subject line: SASS Error
Below is an example of what a SASS error may look like.
(
[time] => Sun Dec 9 23:44:51 2018
[user] => mcgratay
[site_url] => https://yourbooktitle.pressbooks.com/wp
[blog_id] => 112926
[Exception] => Array
(
=> 0
[error] => unclosed block: failed at `` (stdin) on line 49
[file] => /srv/www/pressbooks.com/releas
[line] => 128
[trace] => #0 /srv/www/pressbooks.com/releas
#1 /srv/www/pressbooks.com/releas
#2 /srv/www/pressbooks.com/releas
#3 /srv/www/pressbooks.com/releas
#4 /srv/www/pressbooks.com/releas
#5 /srv/www/pressbooks.com/releas
#6 /srv/www/pressbooks.com/releas
#7 /srv/www/pressbooks.com/releas
#8 /srv/www/pressbooks.com/releas
#9 /srv/www/pressbooks.com/releas
#10 /srv/www/pressbooks.com/releas
#11 /srv/www/pressbooks.com/releas
#12 /srv/www/pressbooks.com/releas
#13 /srv/www/pressbooks.com/releas
#14 {main}
))
SASS errors are produced by malformed CSS and are typically triggered by something you've added using the Custom Styles feature. The important part of the SASS error is the information that comes after:
[error] =>
In the example above, the error in the CSS is an "unclosed block." The error log states that the block has failed on line 49. You can go into your CSS, find line 49, and modify the CSS to resolve the error. With this error, the user forgot to add a closing bracket "}" to their custom styles. The W3C's CSS Validation tool can be very helpful in helping you figure out the source of errors in your custom CSS (and how to resolve them).