I’ve just written a library called jsPDF which generates PDFs using Javascript alone. It’s still very young, and I’ll be adding features and bug fixes soon. Also got a few ideas for workarounds in browsers that do not support Data URIs. It’s licensed under a liberal MIT license.
I came across this question before I started writing it and thought I’d come back and let you know 🙂
Example create a “Hello World” PDF file.
// Default export is a4 paper, portrait, using milimeters for units var doc = new jsPDF() doc.text('Hello world!', 10, 10) doc.save('a4.pdf')
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.3.5/jspdf.debug.js"></script>
Related Posts:
- Print PDF directly from JavaScript
- Documentation for using JavaScript code inside a PDF file
- Start script missing error when running npm start
- Loop through an array in JavaScript
- What does this symbol () => mean in Javascript? [duplicate]
- What is Virtual DOM?
- How to you store data for each discord user in the discord server?
- Uncaught ReferenceError: $ is not defined?
- Open a URL in a new tab (and not a new window)
- Unexpected token u in JSON at position 0 (but only sometimes)
- Get the last item in an array
- Syntax for an async arrow function
- SyntaxError: Unexpected token o in JSON at position 1
- Syntax for an async arrow function
- What is a good regular expression to match a URL? [duplicate]
- React-Router only one child
- What is the most efficient way to deep clone an object in JavaScript?
- How to quickly test some javascript code?
- Mouseover & Mouseout w/ Javascript
- Most efficient way to convert an HTMLCollection to an Array
- React Uncaught Error: Target container is not a DOM element [duplicate]
- document.getElementByID is not a function
- What is the difference between node.js and io.js?
- module.exports vs exports in Node.js
- What does ‘:’ (colon) do in JavaScript?
- JavaScript getElementByID() not working
- How to send an email from JavaScript
- How can I check if an element exists in the visible DOM?
- XMLHttpRequest status 0 (responseText is empty)
- What is the meaning of || in javascript?
- Coin toss with JavaScript and HTML
- Does JavaScript support array/list comprehensions like Python?
- How to define Global Arrays?
- JavaScript post request like a form submit
- Is there a simple way to create a javascript lookup table?
- Disable Chrome strict MIME type checking
- Why am I getting “ReferenceError: getElementById is not defined”?
- Uncaught Invariant Violation: Rendered more hooks than during the previous render
- Get cookie by name
- jQuery equivalent of querySelector
- document.getElementById().value doesn’t set the value
- How to remove part of a string?
- How to run a function when the page is loaded?
- Convert normal date to unix timestamp
- jQuery replace one class with another
- Clearing my form inputs after submission
- Scope Chain in Javascript
- How to convert binary string to decimal?
- Set CSS property in JavaScript?
- how to write javascript code inside php
- javascript convert int to float
- Uncaught TypeError: Cannot read property ‘toLowerCase’ of undefined
- Get query string parameters url values with jQuery / Javascript (querystring)
- Add JavaScript object to JavaScript object
- “Uncaught TypeError: Illegal invocation” in Chrome
- What are the differences between JSON and JSONP?
- How do I call a JavaScript function on page load?
- REST API: Backbone and custom endpoint
- Gutenberg custom block plugin with custom image sizes
- Check user logged in with JS
- Can I make use of word-count.js in my own code?
- “Password Strength Unknown” Registration Issue
- WP REST – video and audio players
- Move all the JS files to the bottom|footer, the right way
- the Customizer – proper way to instantiate an image upload control via javascript
- How to handle Gutenberg wp.data async errors?
- How do I access site and block editor state data and use `useSelect()` or `withSelect()` to bind it to my components?
- Base64 & JSON Encode array in PHP, use as HTML data attribute, decode and parse in JavaScript …. with proper Escaping
- Any required callbacks to WP.com or WP.org?
- Search media with javascript
- What is the correct way to import the blocks-editor?
- Using apiFetch for retrieving post data in Gutenberg
- is_page_template() written in jquery/javascript
- How to load an additional script for a block in the block editor?
- wp_enqueue_scripts not enqueing correctly
- On click load iframe [closed]
- How to add a onclick attribute to a list of checkboxes?
- Script only works on wordpress home page & only when Jqurery is aded using
- download svg to png size image
- Including dependencies using @wordpress/dependency-extraction-webpack-plugin
- Open href in a new window with onclick
- Select parent from child class name then add another class name to the parent
- How are cookie values encoded?
- Hide CSS class only in single post pages
- I would like to retrive JSON value and display it in wordpress page or widget
- Where is fusion-gmap-container?
- adding script tag in head of specific pages
- WordPress text widget with onclick function
- Editing the source of a display for posts (to category recent)
- Dequeue set-post-thumbnail.min.js
- JavaScript file successfully registered but does not render correctly
- Why the images on mi javascript are not found?
- Browser is showing Javascript code instead of processing it [closed]
- How to delete child block for associated parent block
- Registration fields prefilled with URL parameters
- Divi Carousel/ Slider – How to slide two sliders with a single button
- WordPress adds and tags into HTML blocks after saving
- How do i fix type error
- CCF7 Field numbuer prefilled after Click event
- Access jQuery tabs from primary menu while adding/removing class on tab container elements (accessing diff. tabs/tab content via primary menu items)