Zettlr: Exporting a project to PDF fails -- Cannot read property 'replace' of undefined

Created on 25 Jul 2020  路  8Comments  路  Source: Zettlr/Zettlr

Description

When exporting a project to PDF, I receive the following error message:

Cannot read property 'replace' of undefined

Exporting individual pages of the project still works fine. Also, exporting the exact same project to PDF with Zettlr 1.7.1 still works; it only stopped working after the new release.

Reproducing

The project I am trying to export consists primarily of plain text notes interspersed with LaTeX math, about 10 different Markdown files in the project. Using the latest version of Zettlr, 1.7.2, create a project like this and attempt to export; changing no other settings, downgrading to Zettlr 1.7.1 fixes this issue.

Expected behaviour

Proper PDF export of a project

Platform

  • OS and version: Windows 10 Pro 1909, OS Build 18363.720
  • Zettlr Version: 1.7.2
  • Screen Resolution: 1080p
bug [critical] confirmed high v1.7.x

Most helpful comment

Whoopsie, looking into it!

All 8 comments

Thanks so much for opening up your first issue here on the repository! 馃帀 We would like to warmly welcome you to the community behind the app! 鈽猴笍 We'll check in soon and have a look at your issue. In the meantime, you can check your issue and make sure it aligns with our contribution guidelines! Here's the comprehensive list:

Enhancements

An enhancement takes a feature and improves or alters its behaviour. Please make sure to argue how your proposition will aid non-technical text workers, and why it can't be emulated easily with other features or apps!

Feature requests

Feature requests introduce whole new features into the app. This requires a lot of work, so these might be turned down if the implementation costs supersede the benefits we expect to see from implementing it. Please do not be disappointed if that happens. It likely has nothing to do with your great request but simply with us and our missing resources!
You can of course always ask someone to implement this feature, because a PR with a working new feature has much higher chances of being merged! :)

Bug reports

Please note that one of the main reasons for why bug reports cannot be addressed is that there's not enough information for us to find and fix the bug you describe, so make sure you try to pinpoint the bug as close as possible.
The ideal bug report for us has two qualities:

  1. The bug is always reproducible, at least within a certain context. 2. We know exactly what specifically goes wrong, and there is consensus on
    what should happen instead.

Please note that if you encounter behaviour that does not align with your expectations of what would happen, this might as well be simply intended behaviour and we need to simply _clarify_ why the behaviour is the way it is. This is not to be considered a bug and such issues may be closed! Suggest an enhancement instead!
But now, have a great day and thank you again!

I am having this exact same issue.

Can replicate, export fails with 'Cannot read property 'replace' of undefined' in 1.7.2, however project builds successfully when downgraded to 1.7.1.

Can replicate the exact same issue after upgrade to 1.7.2.

Whoopsie, looking into it!

8a1f5274c8b79bf13d65be84b8bf79bc09951816 is the first bad commit
commit 8a1f5274c8b79bf13d65be84b8bf79bc09951816
Author: nathanlesage <[email protected]>
Date:   Fri Jul 10 12:22:40 2020 +0200

    Frontmatter support on PDF export

 CHANGELOG.md                                     |  1 +
 source/main/assets/export.tex                    |  4 +-
 source/main/commands/export.js                   | 50 ++++++++++++++++++++++--
 source/main/modules/export/prepare-pdf-export.js |  1 +
 4 files changed, 51 insertions(+), 5 deletions(-)

The reported error is thrown by sanitiseTexValue() because in prepare-pdf-export.js the property options.date is undefined.

    'PDF_DATE': (options.date === '\\today') ? options.date : sanitiseTexValue(options.date),

~My suspicion is that the options object in prepare-pdf-export.js is referring to the preference pane options and NOT to the options being defined in source/main/commands/export.js.~

The options building code in source/main/commands/export.js only runs if you "Export" an individual file. That code doesn't run if you "Export project".

Thanks y'all for looking into it and for @webbj74 for quickly fixing it! I'll see to releasing a fix this weekend so that it works again.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Kangie picture Kangie  路  4Comments

volt4ire picture volt4ire  路  4Comments

shanvrolijk picture shanvrolijk  路  5Comments

grst picture grst  路  4Comments

maehr picture maehr  路  3Comments