A PHP tool that helps you write eBooks in markdown and convert to PDF.

Related tags

PDF ibis
Overview

Ibis logo

Artwork by Eric L. Barnes and Caneco from Laravel News ❤️ .


This PHP tool helps you write eBooks in markdown. Run ibis build and an eBook will be generated with:

  1. A cover photo.
  2. Clickable auto-generated table of contents.
  3. Code syntax highlighting.
  4. Available in 2 themes. Light and dark.

Ibis was used to create Laravel Queues in Action, an eBook I published in August 2020. Click here for the sample.

Installation

Make sure you have PHP7.3 or above installed on your system and that your gd extension is enabled in your php.ini file.

First, install the composer package globally:

composer global require themsaid/ibis

Then, run this command inside an empty directory:

ibis init

This will create the following files and directories:

  • /assets
  • /assets/fonts
  • /assets/cover.jpg
  • /assets/theme-light.html
  • /assets/theme-dark.html
  • /content
  • /ibis.php

You may configure your book by editing the /ibis.php configuration file.

Writing Your eBook

The init command will create sample .md files inside the content folder. You can explore those files to see how you can write your book. This sample content is taken from Laravel Queues in Action.

Inside the content directory, you can write multiple .md files. Ibis uses the headings to divide the book into parts and chapters:

# Part 1

<h1> tags define the start of a part. A separate PDF page will be generated to print the part title and any content below.

## Chapter 1

<h2> tags define the start of a chapter. A chapter starts on a new page always.

### Starting with Ibis

<h3> tags define different titles inside a chapter.

Using images

Images can be stored in the content folder and then brought in like this:

![Screenshot 1](content/screenshot-1.png)

Using Fonts

Edit your /ibis.php configuration files to define the font files to be loaded from the /assets/fonts directory. After that you may use the defined fonts in your themes (/assets/theme-light.html & /assets/theme-dark.html).

Generating PDF eBook

ibis build

Ibis will parse the files in alphabetical order and store the PDF file in /export.

The default is to generate the PDF using the light theme, to generate a PDF using the dark theme:

ibis build dark

Generating A Sample

ibis sample

ibis sample dark

This command will use the generated files from the ibis build command to generate samples from your PDF eBook. You can configure which pages to include in the sample by updating the /ibis.php file.

Credits

License

The MIT License (MIT). Please see License File for more information.

Comments
  • How to include images

    How to include images

    Thanks your this package, I've been eagerly waiting for it!

    I'm wondering, how do I include images in my pages? Right now I'm trying:

    ![Image title](images/filename.jpg)
    

    Where I created a folder called "images" inside the "assets" folder. However, this image appears as broken in the PDF.

    Thanks for your time!

    opened by roelofjan-elsinga 5
  • Sample files

    Sample files

    Is there any chance of including the input files in the example zip file, as well as the output files? Or perhaps a separate simple example of some of the features used?

    opened by mattfletcher 4
  • Installation

    Installation

    First, Thanks for releasing this great tool!

    I've installed globally using

    composer global require themsaid/ibis
    

    Then went into an empty directory and ran:

    ibis init
    

    I then get:

    PHP Warning:  require(/Users/dave/.composer/vendor/themsaid/ibis/vendor/autoload.php): failed to open stream: No such file or directory in /Users/dave/.composer/vendor/themsaid/ibis/ibis on line 10
    
    Warning: require(/Users/dave/.composer/vendor/themsaid/ibis/vendor/autoload.php): failed to open stream: No such file or directory in /Users/dave/.composer/vendor/themsaid/ibis/ibis on line 10
    PHP Fatal error:  require(): Failed opening required '/Users/dave/.composer/vendor/themsaid/ibis/vendor/autoload.php' (include_path='.:/usr/local/Cellar/php/7.4.11/share/php/pear') in /Users/dave/.composer/vendor/themsaid/ibis/ibis on line 10
    
    Fatal error: require(): Failed opening required '/Users/dave/.composer/vendor/themsaid/ibis/vendor/autoload.php' (include_path='.:/usr/local/Cellar/php/7.4.11/share/php/pear') in /Users/dave/.composer/vendor/themsaid/ibis/ibis on line 10
    
    

    Have I missed a step?

    opened by dcblogdev 4
  • Arabic letters

    Arabic letters

    Hi, Mohamed Said,

    This is the first run through to keep in touch with you.

    I attempted to utilize Arabic letters in your task ibis, it is brilliant.

    In any case, is there any approach to set the direction from left to right when utilizing Arabic letters.

    Respects,

    Mostafa Gaber

    opened by mostnour 3
  • HTML based cover

    HTML based cover

    Hi, this tool is really simple to use compared to some other solutions I have tried so kudos on that 👍

    It would be great if it could support HTML based covers rather than just a JPG. I am hoping I will be able to use this tool for creating reports and the cover I had in mind was more textual with a different layout. Are you open to supporting this use case? I imagine as this project grows, some more configuration options in ibis.php would allow it to support many different document use cases in addition to ebooks.

    opened by eberkund 3
  • Code Standard Enforcement

    Code Standard Enforcement

    Hello - and thanks for creating this awesome project. :)

    I noticed your .php_cs configuration file and the composer command. However, I noticed some code could be out of standard. In addition, since everyone uses different code standard tools, they might not have php-cs-fixer installed globally. That being said, I'd like to propose the following:

    • Ensure all files are code standard compliant
    • Add php-cs-fixer as a local project install as a composer dev dependency
    • Add a script to composer to do a dry-run for people who'd like to review their code standard changes - and to be ran as part of CI
    • Add a github action to run the code standard on pushes and pull requests

    I'll submit a pull request with these suggested updates for your review.

    opened by aaronsaray 2
  • Valet requirement

    Valet requirement

    Perfect project for me because I write everything in Markdown. However I just got finished updating everything Composer needed in order to finally install it and after ibis init I got the error: Valet only supports the Mac operating system. I'm trying to run this in WSL 2 on Windows 10. I checked the composer.json in the Ibis repo and don't see Laravel or Valet as a dependency, so I'm wondering if this is a side effect of my setup or a dependency of a dependency.

    Any way to get this running on Windows or Linux?

    opened by wishinghand 2
  • [Feature Request]: Allow user to specify the markdown directory

    [Feature Request]: Allow user to specify the markdown directory

    Now the markdown files are loaded from : $currentPath.'/content' Where $currentPath is retrieved from getcwd().

    My proposal is to allow the user to define the directory (absolute or relative) where to load markdown files. The input argument could be --markdowndir=

    If you want i could open a PR.

    opened by roberto-butti 1
  • Allow Commonmark to be extended

    Allow Commonmark to be extended

    This PR looks for a configure_commonmark key in the config and if present, it will be called passing the $environment through.

    This will allow people to swap in new highlighters or any other commonmark extensions, of which there are many.

    Let me know what you think!

    opened by aarondfrancis 1
  • Conflicts with Laravel Valet

    Conflicts with Laravel Valet

    Trying to run the global installer composer global require themsaid/ibis I'm getting a conflict with the current Laravel Valet:

    Changed current directory to /Users/ericlbarnes/.composer
    Using version ^0.1.1 for themsaid/ibis
    ./composer.json has been updated
    Running composer update themsaid/ibis --with-all-dependencies
    Loading composer repositories with package information
    Updating dependencies
    Your requirements could not be resolved to an installable set of packages.
    
      Problem 1
        - illuminate/container v8.13.0 requires illuminate/contracts ^8.0 -> found illuminate/contracts[v8.0.0, ..., v8.13.0] but it conflicts with another require.
        - laravel/valet v2.12.0 requires illuminate/container ~5.1|^6.0|^7.0|^8.0 -> satisfiable by illuminate/container[v8.13.0].
        - laravel/valet is locked to version v2.12.0 and an update of this package was not requested.
    
    Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
    
    opened by ericlbarnes 1
  • Error: command `ibis` not found

    Error: command `ibis` not found

    Operating System: Linux Ubuntu 20.04

    I ran the command composer global require themsaid/ibis and completed the installation successfully. Upon running ibis init, I get an error.

    opened by ShafSpecs 0
  • Upgrade PHP 8.2 and packages

    Upgrade PHP 8.2 and packages

    • upgrade and check with PHP 8.2
    • upgrade code using new renderer of Commonmark
    • upgrade GitHub Actions workflow
    • using Pint with PSR12
    • added configuration for cover image (instead of using hardcoded cover.jpg, you can specify a new file name and format, for example, my-cover.png)
    opened by roberto-butti 0
  • Support for alternate markdown table notation

    Support for alternate markdown table notation

    Following this issue thread https://github.com/themsaid/ibis/issues/27 it appears that the following type of markdown tables are supported:

    | Command | Description | |-----------|-------------| | Test | Test |

    i.e. raw format:

    | Command | Description |
    |---------|-------------|
    | Test    | Test        |
    

    However, the following format is not supported:

    |Short Flag |Long Flag |Description | |:---|:---|:---| |-l|

    -
    |Show Results in long format|

    i.e. in raw code format:

    |**Short Flag**   |**Long Flag**   |**Description**   |
    |:---|:---|:---|
    |`-l`|<center>-</center>|Show Results in long format|
    

    This format is valid markdown that works here on Github, but when rendered in the PDF, it comes out as a literal string:

    Screen Shot 2021-10-09 at 11 38 07

    I could potentially do a PR to add this new type of parser, but would need some guidance on where to start.

    opened by princefishthrower 1
  • [Feature Request]: post cover

    [Feature Request]: post cover

    Now, there are:

    • cover (if exists) (image or html)
    • TOC
    • content (pages from markdown)

    I would like to suggest having an optional "post cover" after the cover and TOC. This may be useful for having the typical page with inscription "thanks to..." or some quotes.

    My proposal is:

    • if exists a /assets/post-cover.html file (with some content, like cover.html) (so not mandatory), append the post-cover.html file after the cover in buildPdf() function.

    If you want, I can open a PR for this.

    opened by roberto-butti 0
Releases(v0.1.4)
Owner
Mohamed Said
Web developer at Laravel
Mohamed Said
Gravity PDF is a GPLv2-licensed WordPress plugin that allows you to automatically generate, email and download PDF documents using Gravity Forms.

Gravity PDF Gravity PDF is a GPLv2-licensed WordPress plugin that allows you to automatically generate, email and download PDF documents using the pop

Gravity PDF 90 Nov 14, 2022
Convert HTML to PDF using Webkit (QtWebKit)

wkhtmltopdf and wkhtmltoimage wkhtmltopdf and wkhtmltoimage are command line tools to render HTML into PDF and various image formats using the QT Webk

wkhtmltopdf 13k Jan 4, 2023
Convert html to an image, pdf or string

Convert a webpage to an image or pdf using headless Chrome The package can convert a webpage to an image or pdf. The conversion is done behind the sce

Spatie 4.1k Jan 1, 2023
Convert a pdf to an image

Convert a pdf to an image This package provides an easy to work with class to convert PDF's to images. Spatie is a webdesign agency in Antwerp, Belgiu

Spatie 1.1k Dec 29, 2022
Laravel package to convert HTML to PDF, supporting multiple drivers.

eve/pdf-converter A Laravel package to help convert HTML to PDF. Supports multiple drivers. Requirements and Installation eve/pdf-converter requires L

eve.io 11 Feb 15, 2022
Convert HTML to PDF using Webkit (QtWebKit)

wkhtmltopdf and wkhtmltoimage wkhtmltopdf and wkhtmltoimage are command line tools to render HTML into PDF and various image formats using the QT Webk

wkhtmltopdf 13k Jan 9, 2023
PDFExaminer Tool - Analyse PDF Malware

PDFExaminer Tool - Analyse PDF Malware PDFExaminer Command Line Scanner This document describes installation and usage of the PDF Examiner – command l

tylabs 28 Nov 18, 2022
Simple wrapper package around MPDF's setProtection method that allows you to set password on PDF files

Laravel PDF Protect (fork) Simple wrapper package around MPDF's setProtection method that allows you to set password on PDF files. Installation You ca

Raphael Planer 2 Jan 23, 2022
Official clone of PHP library to generate PDF documents and barcodes

TCPDF PHP PDF Library Please consider supporting this project by making a donation via PayPal category Library author Nicola Asuni [email protected] co

Tecnick.com LTD 3.6k Jan 6, 2023
Pdf and graphic files generator library written in php

Information Examples Sample documents are in the "examples" directory. "index.php" file is the web interface to browse examples, "cli.php" is a consol

Piotr Śliwa 335 Nov 26, 2022
FPDI is a collection of PHP classes facilitating developers to read pages from existing PDF documents and use them as templates in FPDF.

FPDI - Free PDF Document Importer ❗ This document refers to FPDI 2. Version 1 is deprecated and development is discontinued. ❗ FPDI is a collection of

Setasign 821 Jan 4, 2023
Official clone of PHP library to generate PDF documents and barcodes

TCPDF PHP PDF Library Please consider supporting this project by making a donation via PayPal category Library author Nicola Asuni [email protected] co

Tecnick.com LTD 3.6k Dec 26, 2022
A PDF conversion and form utility based on pdftk

php-pdftk A PDF conversion and form utility based on pdftk. Features php-pdftk brings the full power of pdftk to PHP - and more. Fill forms, either fr

Michael Härtl 800 Jan 9, 2023
HTML to PDF converter for PHP

Dompdf Dompdf is an HTML to PDF converter At its heart, dompdf is (mostly) a CSS 2.1 compliant HTML layout and rendering engine written in PHP. It is

null 9.3k Jan 1, 2023
PHP library generating PDF files from UTF-8 encoded HTML

mPDF is a PHP library which generates PDF files from UTF-8 encoded HTML. It is based on FPDF and HTML2FPDF (see CREDITS), with a number of enhancement

null 3.8k Jan 2, 2023
PHP library allowing thumbnail, snapshot or PDF generation from a url or a html page. Wrapper for wkhtmltopdf/wkhtmltoimage

Snappy Snappy is a PHP library allowing thumbnail, snapshot or PDF generation from a url or a html page. It uses the excellent webkit-based wkhtmltopd

KNP Labs 4.1k Dec 30, 2022
TCPDF - PHP PDF Library - https://tcpdf.org

tc-lib-pdf PHP PDF Library UNDER DEVELOPMENT (NOT READY) UPDATE: CURRENTLY ALL THE DEPENDENCY LIBRARIES ARE ALMOST COMPLETE BUT THE CORE LIBRARY STILL

Tecnick.com LTD 1.3k Dec 30, 2022
PdfParser, a standalone PHP library, provides various tools to extract data from a PDF file.

PdfParser Pdf Parser, a standalone PHP library, provides various tools to extract data from a PDF file. Website : https://www.pdfparser.org Test the A

Sebastien MALOT 1.9k Jan 2, 2023
Generate simple PDF invoices with PHP

InvoiScript Generate simple PDF invoices with PHP. Installation Run: composer require mzur/invoiscript Usage Example use Mzur\InvoiScript\Invoice; re

Martin Zurowietz 16 Aug 24, 2022