Skip to content
Flamenco edited this page Dec 16, 2014 · 8 revisions

#Dependency Management A config file mapping plug dependencies has been added.
Require.js can use this configuration to pull in all needed scripts.

https://github.com/Flamenco/jsPDF/blob/master/libs/require/config.js

By using this approach, plugins do not have to define themselves as modules, and host pages can still do things the old way (by manually including scripts).

Refactoring code will now be much easier, as code can be moved out of core and plugins and put in new files. Only the config file will need to be updated.

Use Case will simplify this dependency chain:

 html2pdf
    jspdf
    canvas-plugin
        c2d-plugin
            CssColors.js
            split-text plugin
            standard_fonts_plugin
        png-support
            add-image-plugin
            png-files-etc

All that is needed now is:

<script src='../libs/require/require.js'></script>

<script>
require(['../libs/require/config'], function() {
    require(['html2pdf'], function() {
        // put your code here
    }); // require
}); // require
</script>

#Internal jsPDF Changes

Additional Objects

Method to create pdf objects after page objects, This is needed for annotations. Page objects need annotation refs and annotation objects need page refs).

Font Fallback

Using a non-defined font or style will fallback gracefully instead of exploding.

##CSSColor.js Refactoring Common code has been shared between from_html and context2d plugins.

#html2pdf

This global method harness the power of jsPDF.js and html2canvas.js to create PDF files from HTML text and elements.
The bundled html2canvas.js library has been patched to allow hyperlinks, page breaks an bulleted lists.

see https://github.com/Flamenco/jsPDF/wiki/html2pdf for usage and demos.

#Annotations - Text Popup and FreeText annotations (in addition to link annotations) are now supported at a basic level.

Popup and FreeText Annotations

#Annotations - Link Named links are now supported. Internal and External HTML links will now work in the rendered PDF. (If using html2pdf).

(Open With Reader For Links To Work) http://rawgit.com/Flamenco/jsPDF/master/examples/html2pdf/showcase_supported_html.html

#Auto-Break A beta feature has been added to the context2plugin that allows for:

  • manual page breaks (AKA page-break-before:always)
  • auto page breaks when addressing a Y coordinate beyond the page height.

auto-break

page-break-before

#Canvas Plugin A beta canvas plugin wrapping the context2d plugin has been added. Its goal is to be a drop-in replacement for current canvas implementations.

Clone this wiki locally