grow
shrink
fade-out
fade-up (also down, left and right!)
visible only once
blue only once
highlight-red
highlight-green
highlight-blue
elements
{ src: 'plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } },
// Zoom in and out with Alt+click
{ src: 'plugin/zoom-js/zoom.js', async: true },
// Speaker notes
{ src: 'plugin/notes/notes.js', async: true },
// MathJax
{ src: 'plugin/math/math.js', async: true }
]
});
```
--------------------------------
### Get PDF as Buffer
Source: https://github.com/pdfmake/docs/blob/master/content/getting-started/client-side/methods.md
Retrieves the PDF document as a buffer.
```APIDOC
## Get PDF as Buffer
### Description
Retrieves the PDF document as a buffer.
### Method Signature
```javascript
pdfMake.createPdf(docDefinition).getBuffer()
```
### Response
#### Success Response
- **buffer** (Buffer) - The PDF document as a buffer.
```
--------------------------------
### Get PDF as Blob
Source: https://github.com/pdfmake/docs/blob/master/content/getting-started/client-side/methods.md
Retrieves the PDF document as a Blob object.
```APIDOC
## Get PDF as Blob
### Description
Retrieves the PDF document as a Blob object.
### Method Signature
```javascript
pdfMake.createPdf(docDefinition).getBlob()
```
### Response
#### Success Response
- **blob** (Blob) - The PDF document as a Blob object.
```
--------------------------------
### Deploy pdfmake Docs Webpages
Source: https://github.com/pdfmake/docs/blob/master/README.md
Build the static webpages for deployment using the Hugo build command.
```bash
hugo --cleanDestinationDir
```
--------------------------------
### Get PDF as URL Data
Source: https://github.com/pdfmake/docs/blob/master/content/getting-started/client-side/methods.md
Retrieves the PDF document as a data URL.
```APIDOC
## Get PDF as URL Data
### Description
Retrieves the PDF document as a data URL.
### Method Signature
```javascript
pdfMake.createPdf(docDefinition).getDataUrl()
```
### Response
#### Success Response
- **dataUrl** (string) - The PDF document as a data URL.
```
--------------------------------
### Get PDF as Base64 Data
Source: https://github.com/pdfmake/docs/blob/master/content/getting-started/client-side/methods.md
Retrieves the PDF document as a base64 encoded string.
```APIDOC
## Get PDF as Base64 Data
### Description
Retrieves the PDF document as a base64 encoded string.
### Method Signature
```javascript
pdfMake.createPdf(docDefinition).getBase64()
```
### Response
#### Success Response
- **data** (string) - The PDF document as a base64 encoded string.
```
--------------------------------
### Reveal.js Initialization with Dependencies
Source: https://github.com/pdfmake/docs/blob/master/themes/docdock/static/revealjs/demo.html
Initialize Reveal.js with various plugins and configurations. Ensure all necessary dependencies are loaded correctly for features like markdown support, syntax highlighting, and search.
```javascript
// More info https://github.com/hakimel/reveal.js#configuration
Reveal.initialize({
controls: true,
progress: true,
history: true,
center: true,
transition: 'slide', // none/fade/slide/convex/concave/zoom
// More info https://github.com/hakimel/reveal.js#dependencies
dependencies: [
{ src: 'lib/js/classList.js', condition: function() { return !document.body.classList; } },
{ src: 'plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } },
{ src: 'plugin/search/search.js', async: true },
{ src: 'plugin/zoom-js/zoom.js', async: true },
{ src: 'plugin/notes/notes.js', async: true }
]
});
```
--------------------------------
### Initialize Git Repository
Source: https://github.com/pdfmake/docs/blob/master/themes/docdock/README.md
After creating the Hugo site, initialize it as a git directory to track changes.
```bash
$ git init
```
--------------------------------
### Initialize Reveal.js with Default Configuration
Source: https://github.com/pdfmake/docs/blob/master/themes/docdock/static/revealjs/README.md
Use this code to initialize Reveal.js with a comprehensive set of default configuration options. All options are optional and will use their specified defaults if not provided.
```javascript
Reveal.initialize({
// Display presentation control arrows
controls: true,
// Help the user learn the controls by providing hints, for example by
// bouncing the down arrow when they first encounter a vertical slide
controlsTutorial: true,
// Determines where controls appear, "edges" or "bottom-right"
controlsLayout: 'bottom-right',
// Visibility rule for backwards navigation arrows; "faded", "hidden"
// or "visible"
controlsBackArrows: 'faded',
// Display a presentation progress bar
progress: true,
// Set default timing of 2 minutes per slide
defaultTiming: 120,
// Display the page number of the current slide
slideNumber: false,
// Push each slide change to the browser history
history: false,
// Enable keyboard shortcuts for navigation
keyboard: true,
// Enable the slide overview mode
overview: true,
// Vertical centering of slides
center: true,
// Enables touch navigation on devices with touch input
touch: true,
// Loop the presentation
loop: false,
// Change the presentation direction to be RTL
rtl: false,
// Randomizes the order of slides each time the presentation loads
shuffle: false,
// Turns fragments on and off globally
fragments: true,
// Flags if the presentation is running in an embedded mode,
// i.e. contained within a limited portion of the screen
embedded: false,
// Flags if we should show a help overlay when the questionmark
// key is pressed
help: true,
// Flags if speaker notes should be visible to all viewers
showNotes: false,
// Global override for autoplaying embedded media (video/audio/iframe)
// - null: Media will only autoplay if data-autoplay is present
// - true: All media will autoplay, regardless of individual setting
// - false: No media will autoplay, regardless of individual setting
autoPlayMedia: null,
// Number of milliseconds between automatically proceeding to the
// next slide, disabled when set to 0, this value can be overwritten
// by using a data-autoslide attribute on your slides
autoSlide: 0,
// Stop auto-sliding after user input
autoSlideStoppable: true,
// Use this method for navigation when auto-sliding
autoSlideMethod: Reveal.navigateNext,
// Enable slide navigation via mouse wheel
mouseWheel: false,
// Hides the address bar on mobile devices
hideAddressBar: true,
// Opens links in an iframe preview overlay
previewLinks: false,
// Transition style
transition: 'slide', // none/fade/slide/convex/concave/zoom
// Transition speed
transitionSpeed: 'default', // default/fast/slow
// Transition style for full page slide backgrounds
backgroundTransition: 'fade', // none/fade/slide/convex/concave/zoom
// Number of slides away from the current that are visible
viewDistance: 3,
// Parallax background image
parallaxBackgroundImage: '', // e.g. "'https://s3.amazonaws.com/hakim-static/reveal-js/reveal-parallax-1.jpg'"
// Parallax background size
parallaxBackgroundSize: '', // CSS syntax, e.g. "2100px 900px"
// Number of pixels to move the parallax background per slide
// - Calculated automatically unless specified
// - Set to 0 to disable movement along an axis
parallaxBackgroundHorizontal: null,
parallaxBackgroundVertical: null,
// The display mode that will be used to show slides
display: 'block'
});
```
--------------------------------
### Get PDF as Stream
Source: https://github.com/pdfmake/docs/blob/master/content/getting-started/client-side/methods.md
Retrieve the PDF document as a stream. Streams are efficient for handling large amounts of data.
```javascript
pdfMake.createPdf(docDefinition).getStream().then((stream) => {
// ...
}, err => {
console.error(err);
});
```
--------------------------------
### Get PDF as Blob
Source: https://github.com/pdfmake/docs/blob/master/content/getting-started/client-side/methods.md
Retrieve the PDF document as a Blob object. Blobs are useful for handling binary data.
```javascript
pdfMake.createPdf(docDefinition).getBlob().then((blob) => {
// ...
}, err => {
console.error(err);
});
```
--------------------------------
### Initialize Reveal.js with Dependencies
Source: https://github.com/pdfmake/docs/blob/master/themes/docdock/static/revealjs/index.html
Initialize reveal.js with essential plugins like Markdown support, notes, and syntax highlighting. The callback ensures syntax highlighting is initialized after the plugin loads.
```javascript
Reveal.initialize({
dependencies: [
{ src: 'plugin/markdown/marked.js' },
{ src: 'plugin/markdown/markdown.js' },
{ src: 'plugin/notes/notes.js', async: true },
{ src: 'plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } }
]
});
```
--------------------------------
### Get PDF as URL Data
Source: https://github.com/pdfmake/docs/blob/master/content/getting-started/client-side/methods.md
Retrieve the PDF document as a data URL, useful for embedding in iframes or other elements.
```javascript
pdfMake.createPdf(docDefinition).getDataUrl().then((dataUrl) => {
const targetElement = document.querySelector('#iframeContainer');
const iframe = document.createElement('iframe');
iframe.src = dataUrl;
targetElement.appendChild(iframe);
}, err => {
console.error(err);
});
```
--------------------------------
### Reveal.js Initialization with Dependencies
Source: https://github.com/pdfmake/docs/blob/master/themes/docdock/static/revealjs/plugin/markdown/example.html
Initializes Reveal.js with various configuration options and a list of dependencies for extending its functionality. Load order and conditions are important for plugin initialization.
```javascript
Reveal.initialize({
controls: true,
progress: true,
history: true,
center: true,
// Optional libraries used to extend on reveal.js
dependencies: [
{ src: '../../lib/js/classList.js', condition: function() { return !document.body.classList; } },
{ src: 'marked.js', condition: function() { return !!document.querySelector( '["data-markdown"]' ); } },
{ src: 'markdown.js', condition: function() { return !!document.querySelector( '["data-markdown"]' ); } },
{ src: '../highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } },
{ src: '../notes/notes.js' }
]
});
```
--------------------------------
### Get PDF as Buffer
Source: https://github.com/pdfmake/docs/blob/master/content/getting-started/client-side/methods.md
Retrieve the PDF document as a buffer. This is commonly used in Node.js environments or for specific data processing.
```javascript
pdfMake.createPdf(docDefinition).getBuffer().then((buffer) => {
// ...
}, err => {
console.error(err);
});
```
--------------------------------
### Import pdfmake and add vfs_fonts (ES Modules)
Source: https://github.com/pdfmake/docs/blob/master/content/getting-started/client-side/_index.md
Import pdfmake and its default fonts, then explicitly add the virtual file system using ES module syntax.
```javascript
import pdfMake from "pdfmake/build/pdfmake";
import pdfFonts from "pdfmake/build/vfs_fonts";
pdfMake.addVirtualFileSystem(pdfFonts);
```
--------------------------------
### Initialize Reveal.js with Basic Transition
Source: https://github.com/pdfmake/docs/blob/master/themes/docdock/static/revealjs/test/examples/embedded-media.html
This is a basic Reveal.js initialization. It sets the presentation transition to 'linear'.
```javascript
Reveal.initialize({ transition: 'linear' });
```
--------------------------------
### Get PDF as Base64 Data
Source: https://github.com/pdfmake/docs/blob/master/content/getting-started/client-side/methods.md
Retrieve the PDF document as a base64 encoded string. This is often used for data transmission.
```javascript
pdfMake.createPdf(docDefinition).getBase64().then((data) => {
alert(data);
}, err => {
console.error(err);
});
```
--------------------------------
### Initialize and Update Git Submodules
Source: https://github.com/pdfmake/docs/blob/master/themes/docdock/README.md
After adding the theme as a submodule, initialize and update it for the parent git repository.
```bash
$ git submodule init
$ git submodule update
```
--------------------------------
### PHP Function Example
Source: https://github.com/pdfmake/docs/blob/master/themes/docdock/static/revealjs/plugin/markdown/example.html
A basic PHP function definition with an array assignment. Ensure proper PHP syntax and context for execution.
```php
public function foo() {
$foo = array(
'bar' => 'bar'
)
}
```
--------------------------------
### Initialize Reveal.js Presentation
Source: https://github.com/pdfmake/docs/blob/master/themes/docdock/layouts/shortcodes/revealjs.html
Initializes Reveal.js with various configuration options. Use this to set up controls, centering, history, progress, and transitions. It also includes conditional loading of optional libraries like Markdown support, syntax highlighting, zoom, and notes.
```javascript
function initSlides() { Reveal.initialize({
embedded : true,
controls : {{with .Get "controls"}}{{.|safeHTML}}{{else}}false{{end}},
center: {{with .Get "center"}}{{.|safeHTML}}{{else}}true{{end}}
, history: {{with .Get "history"}}{{.|safeHTML}}{{else}}false{{end}}
, progress: {{with .Get "progress"}}{{.|safeHTML}}{{else}}false{{end}}
, transition: {{with .Get "transition"}}{{.}}{{else}}"concave"{{end}},
// theme: Reveal.getQueryHash().theme,
// available themes are in /css/theme
// Optional libraries used to extend on reveal.js
dependencies: [
{ src: '{{"revealjs/lib/js/classList.js"|relURL}}', condition: function() { return !document.body.classList; } },
{ src: '{{"revealjs/plugin/markdown/marked.js"|relURL}}', condition: function() { return !!document.querySelector( '[\[data-markdown\]]' ); } },
{ src: '{{"revealjs/plugin/markdown/markdown.js"|relURL}}', condition: function() { return !!document.querySelector( '[\[data-markdown\]]' ); } },
{ src: '{{"revealjs/plugin/highlight/highlight.js"|relURL}}', async: true, callback: function() { hljs.initHighlightingOnLoad(); } },
{ src: '{{"revealjs/plugin/zoom-js/zoom.js"|relURL}}', async: true, condition: function() { return !!document.body.classList; } },
{ src: '{{"revealjs/plugin/notes/notes.js"|relURL}}', async: true, condition: function() { return !!document.body.classList; } }
]
}); }
```
--------------------------------
### Reveal.js Initialization with Transitions
Source: https://github.com/pdfmake/docs/blob/master/themes/docdock/static/revealjs/test/examples/slide-transitions.html
Configure Reveal.js with options for centering slides, enabling history, and setting transition effects. Uncomment lines to enable specific transition types or speeds.
```javascript
Reveal.initialize({
center: true,
history: true,
// transition: 'slide',
// transitionSpeed: 'slow',
// backgroundTransition: 'slide'
});
```
--------------------------------
### Get PDF as Data URL (Node.js)
Source: https://context7.com/pdfmake/docs/llms.txt
Generate a data URL for the PDF, which can be directly used in web contexts, such as embedding in an `