Skip to content

Mdbook + pdf.js : a book with pdf files

Notifications You must be signed in to change notification settings

Charles-depot/mdbook-pdf

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

97 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mdbook with pdf files

This repository demonstrates how to use pdf.js inside mdbook.

Get started with a simple example

Steps:

You can then see two pages:

  • src/ex_md.md, a sample markdown file
  • src/ex_pdf.md, loading src/paper.pdf inside a pdf.js viewer:
<script type="text/javascript" src="utils.js"></script>

<iframe id="pdf-js-viewer" src="" title="webviewer" frameborder="0" width="100%" height="800"></iframe>

<script>
    window.onload = () => document.getElementById("pdf-js-viewer").src = url("paper.pdf") + "#zoom=page-width&pagemode=none";
</script>

Just change url("paper.pdf") to load another pdf file.

The table of contents can be modified inside src/SUMMARY.md.

Publish to GitHub Pages

To publish on GitHub Pages, go to Settings -> Pages, select "Branch: gh-pages" and "Save". The next commit will publish your site (via .github/workflows/mdbook.yml)

Complete example

https://charles-depot.github.io/mdbook-pdf/introduction.html

Complete example for a course: https://fortierq.github.io/oc-m1-2021

About

Mdbook + pdf.js : a book with pdf files

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 81.8%
  • CSS 8.5%
  • Jupyter Notebook 4.8%
  • HTML 4.2%
  • Handlebars 0.7%