augmented-reality-pdf
v1.0.2
Published
A module to prepare PDF documents for AR. It automatically inserts a QR code and an image target of choice on each page of the document.
Downloads
1
Maintainers
Readme
augmented-reality-pdf
Prepare your PDF for Augmented Reality by adding a marker and a QR code to each page.
Before:
After:
Installation:
npm install augmented-reality-pdf --save
Required dependencies:
Docker: https://docs.docker.com/install/
wkhtmltopdf: https://wkhtmltopdf.org/downloads.html
Example:
const pdf = require('augmented-reality-pdf');
var options = {
input: 'sample.pdf',
output: 'done.pdf',
target: 'target.jpg',
text: 'Hello there!',
width: 100,
height: 100,
top: 1400,
left: 0,
useDocker: true
}
pdf.insertQRAndMarker(options);
Options:
input: Relative path of input. Must have .pdf extension if useDocker is set to true. Must have .html extension if useDocker is set to false.
output: Desired relative path of output file. Defaults to 'annotated.pdf'
target: Relative path of marker
width: Width of image target/QR code in pixels
height: Height of image target/QR code in pixel
text: Text to automatically generate QR code from
qr: Relative path of QR code image if not using automatically generated QR code from text
top: Offset from top of page of image target/QR code in pixels
left: Offset from left of page of image target/QR code in pixels
pages: Number of pages in the PDF document to place target/QR code on
useDocker: Whether to use Docker or not. If set to false, input has to be a html file. If set to true, input has to be a pdf file.
dockerOptions: Optional Docker Options, see https://www.npmjs.com/package/docker-cli-js
useImageTarget: Whether to embed a marker or not. Defaults to true.
useQRCode: Whether to embed a QR code or not. Defaults to true.
NB: Docker may require sudo priveleges on Linux.