Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

epub generation fails with the sample project #19

Closed
johnblommers opened this issue Feb 1, 2024 · 3 comments
Closed

epub generation fails with the sample project #19

johnblommers opened this issue Feb 1, 2024 · 3 comments
Assignees

Comments

@johnblommers
Copy link

johnblommers commented Feb 1, 2024

Following along with the installation instructions we find we can easily generate a PDF file but epub generation errors out:

./vendor/bin/ibis-next epub
PHP Warning:  Module "curl" is already loaded in Unknown on line 0
PHP Warning:  Module "gd" is already loaded in Unknown on line 0
✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨
✨ EPUB generation is a Working in Progress!! ✨
✨                Stay tuned!!                ✨
✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨
Loading config/assets from: ./
Loading config file from: .//ibis.php
Loading content from: .//content
==> Preparing Export Directory ...
==> Parsing Markdown ...
==> Adding Book Cover .//assets/cover-ibis.webp ...
PHP Fatal error:  Uncaught Error: Class "DOMDocument" not found in /home/johnb/Desktop/my-first-ebook/vendor/hi-folks/phpepub/src/PHPePub/Core/EPub.php:397
Stack trace:
#0 /home/johnb/Desktop/my-first-ebook/vendor/hi-folks/phpepub/src/PHPePub/Core/EPub.php(420): PHPePub\Core\EPub->findIdAttributes()
#1 /home/johnb/Desktop/my-first-ebook/vendor/hi-folks/phpepub/src/PHPePub/Core/EPub.php(1424): PHPePub\Core\EPub->extractIdAttributes()
#2 /home/johnb/Desktop/my-first-ebook/vendor/hi-folks/phpepub/src/PHPePub/Core/EPub.php(1380): PHPePub\Core\EPub->addReferencePage()
#3 /home/johnb/Desktop/my-first-ebook/vendor/hi-folks/ibis-next/src/Commands/BuildEpubCommand.php(140): PHPePub\Core\EPub->setCoverImage()
#4 /home/johnb/Desktop/my-first-ebook/vendor/hi-folks/ibis-next/src/Commands/BuildEpubCommand.php(70): Ibis\Commands\BuildEpubCommand->buildEpub()
#5 /home/johnb/Desktop/my-first-ebook/vendor/symfony/console/Command/Command.php(326): Ibis\Commands\BuildEpubCommand->execute()
#6 /home/johnb/Desktop/my-first-ebook/vendor/symfony/console/Application.php(1078): Symfony\Component\Console\Command\Command->run()
#7 /home/johnb/Desktop/my-first-ebook/vendor/symfony/console/Application.php(324): Symfony\Component\Console\Application->doRunCommand()
#8 /home/johnb/Desktop/my-first-ebook/vendor/symfony/console/Application.php(175): Symfony\Component\Console\Application->doRun()
#9 /home/johnb/Desktop/my-first-ebook/vendor/hi-folks/ibis-next/ibis-next(31): Symfony\Component\Console\Application->run()
#10 /home/johnb/Desktop/my-first-ebook/vendor/bin/ibis-next(117): include('...')
#11 {main}
  thrown in /home/johnb/Desktop/my-first-ebook/vendor/hi-folks/phpepub/src/PHPePub/Core/EPub.php on line 397

The message does say that epub generation is a work in progress so perhaps I'm being impatient ??

@roberto-butti
Copy link

Hi @johnblommers thank you for the feedback. Really appreciated.
This tool uses DOMDocument in the process for converting markdown.
So DOMDocument is a dependency, and DOMDocument is shipped with a specific PHP Extension:
https://www.php.net/manual/en/dom.requirements.php

You need to install php-xml extension (or php-dom , in some operating system you have php-dom).

I will open a PR to set all the extension needed in the composer.json in order to provide a better message in the case the extension is missed.

You can run

composer check-platform-reqs

to see if something is missing.

If everything is fine you should see something like this:

ext-ctype    *          success provided by symfony/polyfill-ctype
ext-dom      20031129   success
ext-filter   8.3.2      success
ext-gd       8.3.2      success
ext-json     8.3.2      success
ext-mbstring *          success provided by symfony/polyfill-mbstring
ext-zlib     8.3.2      success
php          8.3.2      success

@roberto-butti roberto-butti self-assigned this Feb 2, 2024
@johnblommers
Copy link
Author

Aha, excellent! All I had to do was type:

sudo apt install php-xml

and ePub generation completed with success.

@roberto-butti
Copy link

Great, I am happy to know that you updated your environment. I just merged a PR to set all the ext-* dependencies in the composer.json file #20

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants