first commit

This commit is contained in:
2026-01-16 14:13:44 +08:00
commit 903ff8d495
34603 changed files with 8585054 additions and 0 deletions

1700
WebRoot/node_modules/pdf/jsPDF-1.3.2/plugins/acroform.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

116
WebRoot/node_modules/pdf/jsPDF-1.3.2/plugins/addhtml.js generated vendored Normal file
View File

@ -0,0 +1,116 @@
/**
* jsPDF addHTML PlugIn
* Copyright (c) 2014 Diego Casorran
*
* Licensed under the MIT License.
* http://opensource.org/licenses/mit-license
*/
(function (jsPDFAPI) {
'use strict';
/**
* Renders an HTML element to canvas object which added to the PDF
*
* This PlugIn requires html2canvas: https://github.com/niklasvh/html2canvas
* OR rasterizeHTML: https://github.com/cburgmer/rasterizeHTML.js
*
* @public
* @function
* @param element {Mixed} HTML Element, or anything supported by html2canvas.
* @param x {Number} starting X coordinate in jsPDF instance's declared units.
* @param y {Number} starting Y coordinate in jsPDF instance's declared units.
* @param options {Object} Additional options, check the code below.
* @param callback {Function} to call when the rendering has finished.
*
* NOTE: Every parameter is optional except 'element' and 'callback', in such
* case the image is positioned at 0x0 covering the whole PDF document
* size. Ie, to easily take screenshots of webpages saving them to PDF.
*/
jsPDFAPI.addHTML = function (element, x, y, options, callback) {
'use strict';
if(typeof html2canvas === 'undefined' && typeof rasterizeHTML === 'undefined')
throw new Error('You need either '
+'https://github.com/niklasvh/html2canvas'
+' or https://github.com/cburgmer/rasterizeHTML.js');
if(typeof x !== 'number') {
options = x;
callback = y;
}
if(typeof options === 'function') {
callback = options;
options = null;
}
var I = this.internal, K = I.scaleFactor, W = I.pageSize.width, H = I.pageSize.height;
options = options || {};
options.onrendered = function(obj) {
x = parseInt(x) || 0;
y = parseInt(y) || 0;
var dim = options.dim || {};
var h = dim.h || 0;
var w = dim.w || Math.min(W,obj.width/K) - x;
var format = 'JPEG';
if(options.format)
format = options.format;
if(obj.height > H && options.pagesplit) {
var crop = function() {
var cy = 0;
while(1) {
var canvas = document.createElement('canvas');
canvas.width = Math.min(W*K,obj.width);
canvas.height = Math.min(H*K,obj.height-cy);
var ctx = canvas.getContext('2d');
ctx.drawImage(obj,0,cy,obj.width,canvas.height,0,0,canvas.width,canvas.height);
var args = [canvas, x,cy?0:y,canvas.width/K,canvas.height/K, format,null,'SLOW'];
this.addImage.apply(this, args);
cy += canvas.height;
if(cy >= obj.height) break;
this.addPage();
}
callback(w,cy,null,args);
}.bind(this);
if(obj.nodeName === 'CANVAS') {
var img = new Image();
img.onload = crop;
img.src = obj.toDataURL("image/png");
obj = img;
} else {
crop();
}
} else {
var alias = Math.random().toString(35);
var args = [obj, x,y,w,h, format,alias,'SLOW'];
this.addImage.apply(this, args);
callback(w,h,alias,args);
}
}.bind(this);
if(typeof html2canvas !== 'undefined' && !options.rstz) {
return html2canvas(element, options);
}
if(typeof rasterizeHTML !== 'undefined') {
var meth = 'drawDocument';
if(typeof element === 'string') {
meth = /^http/.test(element) ? 'drawURL' : 'drawHTML';
}
options.width = options.width || (W*K);
return rasterizeHTML[meth](element, void 0, options).then(function(r) {
options.onrendered(r.image);
}, function(e) {
callback(null,e);
});
}
return null;
};
})(jsPDF.API);

View File

@ -0,0 +1,732 @@
/** @preserve
* jsPDF addImage plugin
* Copyright (c) 2012 Jason Siefken, https://github.com/siefkenj/
* 2013 Chris Dowling, https://github.com/gingerchris
* 2013 Trinh Ho, https://github.com/ineedfat
* 2013 Edwin Alejandro Perez, https://github.com/eaparango
* 2013 Norah Smith, https://github.com/burnburnrocket
* 2014 Diego Casorran, https://github.com/diegocr
* 2014 James Robb, https://github.com/jamesbrobb
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
;(function(jsPDFAPI) {
'use strict'
var namespace = 'addImage_',
supported_image_types = ['jpeg', 'jpg', 'png'];
// Image functionality ported from pdf.js
var putImage = function(img) {
var objectNumber = this.internal.newObject()
, out = this.internal.write
, putStream = this.internal.putStream
img['n'] = objectNumber
out('<</Type /XObject')
out('/Subtype /Image')
out('/Width ' + img['w'])
out('/Height ' + img['h'])
if (img['cs'] === this.color_spaces.INDEXED) {
out('/ColorSpace [/Indexed /DeviceRGB '
// if an indexed png defines more than one colour with transparency, we've created a smask
+ (img['pal'].length / 3 - 1) + ' ' + ('smask' in img ? objectNumber + 2 : objectNumber + 1)
+ ' 0 R]');
} else {
out('/ColorSpace /' + img['cs']);
if (img['cs'] === this.color_spaces.DEVICE_CMYK) {
out('/Decode [1 0 1 0 1 0 1 0]');
}
}
out('/BitsPerComponent ' + img['bpc']);
if ('f' in img) {
out('/Filter /' + img['f']);
}
if ('dp' in img) {
out('/DecodeParms <<' + img['dp'] + '>>');
}
if ('trns' in img && img['trns'].constructor == Array) {
var trns = '',
i = 0,
len = img['trns'].length;
for (; i < len; i++)
trns += (img['trns'][i] + ' ' + img['trns'][i] + ' ');
out('/Mask [' + trns + ']');
}
if ('smask' in img) {
out('/SMask ' + (objectNumber + 1) + ' 0 R');
}
out('/Length ' + img['data'].length + '>>');
putStream(img['data']);
out('endobj');
// Soft mask
if ('smask' in img) {
var dp = '/Predictor '+ img['p'] +' /Colors 1 /BitsPerComponent ' + img['bpc'] + ' /Columns ' + img['w'];
var smask = {'w': img['w'], 'h': img['h'], 'cs': 'DeviceGray', 'bpc': img['bpc'], 'dp': dp, 'data': img['smask']};
if ('f' in img)
smask.f = img['f'];
putImage.call(this, smask);
}
//Palette
if (img['cs'] === this.color_spaces.INDEXED) {
this.internal.newObject();
//out('<< /Filter / ' + img['f'] +' /Length ' + img['pal'].length + '>>');
//putStream(zlib.compress(img['pal']));
out('<< /Length ' + img['pal'].length + '>>');
putStream(this.arrayBufferToBinaryString(new Uint8Array(img['pal'])));
out('endobj');
}
}
, putResourcesCallback = function() {
var images = this.internal.collections[namespace + 'images']
for ( var i in images ) {
putImage.call(this, images[i])
}
}
, putXObjectsDictCallback = function(){
var images = this.internal.collections[namespace + 'images']
, out = this.internal.write
, image
for (var i in images) {
image = images[i]
out(
'/I' + image['i']
, image['n']
, '0'
, 'R'
)
}
}
, checkCompressValue = function(value) {
if(value && typeof value === 'string')
value = value.toUpperCase();
return value in jsPDFAPI.image_compression ? value : jsPDFAPI.image_compression.NONE;
}
, getImages = function() {
var images = this.internal.collections[namespace + 'images'];
//first run, so initialise stuff
if(!images) {
this.internal.collections[namespace + 'images'] = images = {};
this.internal.events.subscribe('putResources', putResourcesCallback);
this.internal.events.subscribe('putXobjectDict', putXObjectsDictCallback);
}
return images;
}
, getImageIndex = function(images) {
var imageIndex = 0;
if (images){
// this is NOT the first time this method is ran on this instance of jsPDF object.
imageIndex = Object.keys ?
Object.keys(images).length :
(function(o){
var i = 0
for (var e in o){if(o.hasOwnProperty(e)){ i++ }}
return i
})(images)
}
return imageIndex;
}
, notDefined = function(value) {
return typeof value === 'undefined' || value === null;
}
, generateAliasFromData = function(data) {
return typeof data === 'string' && jsPDFAPI.sHashCode(data);
}
, doesNotSupportImageType = function(type) {
return supported_image_types.indexOf(type) === -1;
}
, processMethodNotEnabled = function(type) {
return typeof jsPDFAPI['process' + type.toUpperCase()] !== 'function';
}
, isDOMElement = function(object) {
return typeof object === 'object' && object.nodeType === 1;
}
, createDataURIFromElement = function(element, format, angle) {
//if element is an image which uses data url definition, just return the dataurl
if (element.nodeName === 'IMG' && element.hasAttribute('src')) {
var src = ''+element.getAttribute('src');
if (!angle && src.indexOf('data:image/') === 0) return src;
// only if the user doesn't care about a format
if (!format && /\.png(?:[?#].*)?$/i.test(src)) format = 'png';
}
if(element.nodeName === 'CANVAS') {
var canvas = element;
} else {
var canvas = document.createElement('canvas');
canvas.width = element.clientWidth || element.width;
canvas.height = element.clientHeight || element.height;
var ctx = canvas.getContext('2d');
if (!ctx) {
throw ('addImage requires canvas to be supported by browser.');
}
if (angle) {
var x, y, b, c, s, w, h, to_radians = Math.PI/180, angleInRadians;
if (typeof angle === 'object') {
x = angle.x;
y = angle.y;
b = angle.bg;
angle = angle.angle;
}
angleInRadians = angle*to_radians;
c = Math.abs(Math.cos(angleInRadians));
s = Math.abs(Math.sin(angleInRadians));
w = canvas.width;
h = canvas.height;
canvas.width = h * s + w * c;
canvas.height = h * c + w * s;
if (isNaN(x)) x = canvas.width / 2;
if (isNaN(y)) y = canvas.height / 2;
ctx.clearRect(0,0,canvas.width, canvas.height);
ctx.fillStyle = b || 'white';
ctx.fillRect(0, 0, canvas.width, canvas.height);
ctx.save();
ctx.translate(x, y);
ctx.rotate(angleInRadians);
ctx.drawImage(element, -(w/2), -(h/2));
ctx.rotate(-angleInRadians);
ctx.translate(-x, -y);
ctx.restore();
} else {
ctx.drawImage(element, 0, 0, canvas.width, canvas.height);
}
}
return canvas.toDataURL((''+format).toLowerCase() == 'png' ? 'image/png' : 'image/jpeg');
}
,checkImagesForAlias = function(alias, images) {
var cached_info;
if(images) {
for(var e in images) {
if(alias === images[e].alias) {
cached_info = images[e];
break;
}
}
}
return cached_info;
}
,determineWidthAndHeight = function(w, h, info) {
if (!w && !h) {
w = -96;
h = -96;
}
if (w < 0) {
w = (-1) * info['w'] * 72 / w / this.internal.scaleFactor;
}
if (h < 0) {
h = (-1) * info['h'] * 72 / h / this.internal.scaleFactor;
}
if (w === 0) {
w = h * info['w'] / info['h'];
}
if (h === 0) {
h = w * info['h'] / info['w'];
}
return [w, h];
}
, writeImageToPDF = function(x, y, w, h, info, index, images) {
var dims = determineWidthAndHeight.call(this, w, h, info),
coord = this.internal.getCoordinateString,
vcoord = this.internal.getVerticalCoordinateString;
w = dims[0];
h = dims[1];
images[index] = info;
this.internal.write(
'q'
, coord(w)
, '0 0'
, coord(h) // TODO: check if this should be shifted by vcoord
, coord(x)
, vcoord(y + h)
, 'cm /I'+info['i']
, 'Do Q'
)
};
/**
* COLOR SPACES
*/
jsPDFAPI.color_spaces = {
DEVICE_RGB:'DeviceRGB',
DEVICE_GRAY:'DeviceGray',
DEVICE_CMYK:'DeviceCMYK',
CAL_GREY:'CalGray',
CAL_RGB:'CalRGB',
LAB:'Lab',
ICC_BASED:'ICCBased',
INDEXED:'Indexed',
PATTERN:'Pattern',
SEPARATION:'Separation',
DEVICE_N:'DeviceN'
};
/**
* DECODE METHODS
*/
jsPDFAPI.decode = {
DCT_DECODE:'DCTDecode',
FLATE_DECODE:'FlateDecode',
LZW_DECODE:'LZWDecode',
JPX_DECODE:'JPXDecode',
JBIG2_DECODE:'JBIG2Decode',
ASCII85_DECODE:'ASCII85Decode',
ASCII_HEX_DECODE:'ASCIIHexDecode',
RUN_LENGTH_DECODE:'RunLengthDecode',
CCITT_FAX_DECODE:'CCITTFaxDecode'
};
/**
* IMAGE COMPRESSION TYPES
*/
jsPDFAPI.image_compression = {
NONE: 'NONE',
FAST: 'FAST',
MEDIUM: 'MEDIUM',
SLOW: 'SLOW'
};
jsPDFAPI.sHashCode = function(str) {
return Array.prototype.reduce && str.split("").reduce(function(a,b){a=((a<<5)-a)+b.charCodeAt(0);return a&a},0);
};
jsPDFAPI.isString = function(object) {
return typeof object === 'string';
};
/**
* Strips out and returns info from a valid base64 data URI
* @param {String[dataURI]} a valid data URI of format 'data:[<MIME-type>][;base64],<data>'
* @returns an Array containing the following
* [0] the complete data URI
* [1] <MIME-type>
* [2] format - the second part of the mime-type i.e 'png' in 'image/png'
* [4] <data>
*/
jsPDFAPI.extractInfoFromBase64DataURI = function(dataURI) {
return /^data:([\w]+?\/([\w]+?));base64,(.+?)$/g.exec(dataURI);
};
/**
* Check to see if ArrayBuffer is supported
*/
jsPDFAPI.supportsArrayBuffer = function() {
return typeof ArrayBuffer !== 'undefined' && typeof Uint8Array !== 'undefined';
};
/**
* Tests supplied object to determine if ArrayBuffer
* @param {Object[object]}
*/
jsPDFAPI.isArrayBuffer = function(object) {
if(!this.supportsArrayBuffer())
return false;
return object instanceof ArrayBuffer;
};
/**
* Tests supplied object to determine if it implements the ArrayBufferView (TypedArray) interface
* @param {Object[object]}
*/
jsPDFAPI.isArrayBufferView = function(object) {
if(!this.supportsArrayBuffer())
return false;
if(typeof Uint32Array === 'undefined')
return false;
return (object instanceof Int8Array ||
object instanceof Uint8Array ||
(typeof Uint8ClampedArray !== 'undefined' && object instanceof Uint8ClampedArray) ||
object instanceof Int16Array ||
object instanceof Uint16Array ||
object instanceof Int32Array ||
object instanceof Uint32Array ||
object instanceof Float32Array ||
object instanceof Float64Array );
};
/**
* Exactly what it says on the tin
*/
jsPDFAPI.binaryStringToUint8Array = function(binary_string) {
/*
* not sure how efficient this will be will bigger files. Is there a native method?
*/
var len = binary_string.length;
var bytes = new Uint8Array( len );
for (var i = 0; i < len; i++) {
bytes[i] = binary_string.charCodeAt(i);
}
return bytes;
};
/**
* @see this discussion
* http://stackoverflow.com/questions/6965107/converting-between-strings-and-arraybuffers
*
* As stated, i imagine the method below is highly inefficent for large files.
*
* Also of note from Mozilla,
*
* "However, this is slow and error-prone, due to the need for multiple conversions (especially if the binary data is not actually byte-format data, but, for example, 32-bit integers or floats)."
*
* https://developer.mozilla.org/en-US/Add-ons/Code_snippets/StringView
*
* Although i'm strugglig to see how StringView solves this issue? Doesn't appear to be a direct method for conversion?
*
* Async method using Blob and FileReader could be best, but i'm not sure how to fit it into the flow?
*/
jsPDFAPI.arrayBufferToBinaryString = function(buffer) {
/*if('TextDecoder' in window){
var decoder = new TextDecoder('ascii');
return decoder.decode(buffer);
}*/
if(this.isArrayBuffer(buffer))
buffer = new Uint8Array(buffer);
var binary_string = '';
var len = buffer.byteLength;
for (var i = 0; i < len; i++) {
binary_string += String.fromCharCode(buffer[i]);
}
return binary_string;
/*
* Another solution is the method below - convert array buffer straight to base64 and then use atob
*/
//return atob(this.arrayBufferToBase64(buffer));
};
/**
* Converts an ArrayBuffer directly to base64
*
* Taken from here
*
* http://jsperf.com/encoding-xhr-image-data/31
*
* Need to test if this is a better solution for larger files
*
*/
jsPDFAPI.arrayBufferToBase64 = function(arrayBuffer) {
var base64 = ''
var encodings = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
var bytes = new Uint8Array(arrayBuffer)
var byteLength = bytes.byteLength
var byteRemainder = byteLength % 3
var mainLength = byteLength - byteRemainder
var a, b, c, d
var chunk
// Main loop deals with bytes in chunks of 3
for (var i = 0; i < mainLength; i = i + 3) {
// Combine the three bytes into a single integer
chunk = (bytes[i] << 16) | (bytes[i + 1] << 8) | bytes[i + 2]
// Use bitmasks to extract 6-bit segments from the triplet
a = (chunk & 16515072) >> 18 // 16515072 = (2^6 - 1) << 18
b = (chunk & 258048) >> 12 // 258048 = (2^6 - 1) << 12
c = (chunk & 4032) >> 6 // 4032 = (2^6 - 1) << 6
d = chunk & 63 // 63 = 2^6 - 1
// Convert the raw binary segments to the appropriate ASCII encoding
base64 += encodings[a] + encodings[b] + encodings[c] + encodings[d]
}
// Deal with the remaining bytes and padding
if (byteRemainder == 1) {
chunk = bytes[mainLength]
a = (chunk & 252) >> 2 // 252 = (2^6 - 1) << 2
// Set the 4 least significant bits to zero
b = (chunk & 3) << 4 // 3 = 2^2 - 1
base64 += encodings[a] + encodings[b] + '=='
} else if (byteRemainder == 2) {
chunk = (bytes[mainLength] << 8) | bytes[mainLength + 1]
a = (chunk & 64512) >> 10 // 64512 = (2^6 - 1) << 10
b = (chunk & 1008) >> 4 // 1008 = (2^6 - 1) << 4
// Set the 2 least significant bits to zero
c = (chunk & 15) << 2 // 15 = 2^4 - 1
base64 += encodings[a] + encodings[b] + encodings[c] + '='
}
return base64
};
jsPDFAPI.createImageInfo = function(data, wd, ht, cs, bpc, f, imageIndex, alias, dp, trns, pal, smask, p) {
var info = {
alias:alias,
w : wd,
h : ht,
cs : cs,
bpc : bpc,
i : imageIndex,
data : data
// n: objectNumber will be added by putImage code
};
if(f) info.f = f;
if(dp) info.dp = dp;
if(trns) info.trns = trns;
if(pal) info.pal = pal;
if(smask) info.smask = smask;
if(p) info.p = p;// predictor parameter for PNG compression
return info;
};
jsPDFAPI.addImage = function(imageData, format, x, y, w, h, alias, compression, rotation) {
'use strict'
if(typeof format !== 'string') {
var tmp = h;
h = w;
w = y;
y = x;
x = format;
format = tmp;
}
if (typeof imageData === 'object' && !isDOMElement(imageData) && "imageData" in imageData) {
var options = imageData;
imageData = options.imageData;
format = options.format || format;
x = options.x || x || 0;
y = options.y || y || 0;
w = options.w || w;
h = options.h || h;
alias = options.alias || alias;
compression = options.compression || compression;
rotation = options.rotation || options.angle || rotation;
}
if (isNaN(x) || isNaN(y))
{
console.error('jsPDF.addImage: Invalid coordinates', arguments);
throw new Error('Invalid coordinates passed to jsPDF.addImage');
}
var images = getImages.call(this), info;
if (!(info = checkImagesForAlias(imageData, images))) {
var dataAsBinaryString;
if(isDOMElement(imageData))
imageData = createDataURIFromElement(imageData, format, rotation);
if(notDefined(alias))
alias = generateAliasFromData(imageData);
if (!(info = checkImagesForAlias(alias, images))) {
if(this.isString(imageData)) {
var base64Info = this.extractInfoFromBase64DataURI(imageData);
if(base64Info) {
format = base64Info[2];
imageData = atob(base64Info[3]);//convert to binary string
} else {
if (imageData.charCodeAt(0) === 0x89 &&
imageData.charCodeAt(1) === 0x50 &&
imageData.charCodeAt(2) === 0x4e &&
imageData.charCodeAt(3) === 0x47 ) format = 'png';
}
}
format = (format || 'JPEG').toLowerCase();
if(doesNotSupportImageType(format))
throw new Error('addImage currently only supports formats ' + supported_image_types + ', not \''+format+'\'');
if(processMethodNotEnabled(format))
throw new Error('please ensure that the plugin for \''+format+'\' support is added');
/**
* need to test if it's more efficient to convert all binary strings
* to TypedArray - or should we just leave and process as string?
*/
if(this.supportsArrayBuffer()) {
// no need to convert if imageData is already uint8array
if(!(imageData instanceof Uint8Array)){
dataAsBinaryString = imageData;
imageData = this.binaryStringToUint8Array(imageData);
}
}
info = this['process' + format.toUpperCase()](
imageData,
getImageIndex(images),
alias,
checkCompressValue(compression),
dataAsBinaryString
);
if(!info)
throw new Error('An unkwown error occurred whilst processing the image');
}
}
writeImageToPDF.call(this, x, y, w, h, info, info.i, images);
return this
};
/**
* JPEG SUPPORT
**/
//takes a string imgData containing the raw bytes of
//a jpeg image and returns [width, height]
//Algorithm from: http://www.64lines.com/jpeg-width-height
var getJpegSize = function(imgData) {
'use strict'
var width, height, numcomponents;
// Verify we have a valid jpeg header 0xff,0xd8,0xff,0xe0,?,?,'J','F','I','F',0x00
if (!imgData.charCodeAt(0) === 0xff ||
!imgData.charCodeAt(1) === 0xd8 ||
!imgData.charCodeAt(2) === 0xff ||
!imgData.charCodeAt(3) === 0xe0 ||
!imgData.charCodeAt(6) === 'J'.charCodeAt(0) ||
!imgData.charCodeAt(7) === 'F'.charCodeAt(0) ||
!imgData.charCodeAt(8) === 'I'.charCodeAt(0) ||
!imgData.charCodeAt(9) === 'F'.charCodeAt(0) ||
!imgData.charCodeAt(10) === 0x00) {
throw new Error('getJpegSize requires a binary string jpeg file')
}
var blockLength = imgData.charCodeAt(4)*256 + imgData.charCodeAt(5);
var i = 4, len = imgData.length;
while ( i < len ) {
i += blockLength;
if (imgData.charCodeAt(i) !== 0xff) {
throw new Error('getJpegSize could not find the size of the image');
}
if (imgData.charCodeAt(i+1) === 0xc0 || //(SOF) Huffman - Baseline DCT
imgData.charCodeAt(i+1) === 0xc1 || //(SOF) Huffman - Extended sequential DCT
imgData.charCodeAt(i+1) === 0xc2 || // Progressive DCT (SOF2)
imgData.charCodeAt(i+1) === 0xc3 || // Spatial (sequential) lossless (SOF3)
imgData.charCodeAt(i+1) === 0xc4 || // Differential sequential DCT (SOF5)
imgData.charCodeAt(i+1) === 0xc5 || // Differential progressive DCT (SOF6)
imgData.charCodeAt(i+1) === 0xc6 || // Differential spatial (SOF7)
imgData.charCodeAt(i+1) === 0xc7) {
height = imgData.charCodeAt(i+5)*256 + imgData.charCodeAt(i+6);
width = imgData.charCodeAt(i+7)*256 + imgData.charCodeAt(i+8);
numcomponents = imgData.charCodeAt(i+9);
return [width, height, numcomponents];
} else {
i += 2;
blockLength = imgData.charCodeAt(i)*256 + imgData.charCodeAt(i+1)
}
}
}
, getJpegSizeFromBytes = function(data) {
var hdr = (data[0] << 8) | data[1];
if(hdr !== 0xFFD8)
throw new Error('Supplied data is not a JPEG');
var len = data.length,
block = (data[4] << 8) + data[5],
pos = 4,
bytes, width, height, numcomponents;
while(pos < len) {
pos += block;
bytes = readBytes(data, pos);
block = (bytes[2] << 8) + bytes[3];
if((bytes[1] === 0xC0 || bytes[1] === 0xC2) && bytes[0] === 0xFF && block > 7) {
bytes = readBytes(data, pos + 5);
width = (bytes[2] << 8) + bytes[3];
height = (bytes[0] << 8) + bytes[1];
numcomponents = bytes[4];
return {width:width, height:height, numcomponents: numcomponents};
}
pos+=2;
}
throw new Error('getJpegSizeFromBytes could not find the size of the image');
}
, readBytes = function(data, offset) {
return data.subarray(offset, offset+ 5);
};
jsPDFAPI.processJPEG = function(data, index, alias, compression, dataAsBinaryString) {
'use strict'
var colorSpace = this.color_spaces.DEVICE_RGB,
filter = this.decode.DCT_DECODE,
bpc = 8,
dims;
if(this.isString(data)) {
dims = getJpegSize(data);
return this.createImageInfo(data, dims[0], dims[1], dims[3] == 1 ? this.color_spaces.DEVICE_GRAY:colorSpace, bpc, filter, index, alias);
}
if(this.isArrayBuffer(data))
data = new Uint8Array(data);
if(this.isArrayBufferView(data)) {
dims = getJpegSizeFromBytes(data);
// if we already have a stored binary string rep use that
data = dataAsBinaryString || this.arrayBufferToBinaryString(data);
return this.createImageInfo(data, dims.width, dims.height, dims.numcomponents == 1 ? this.color_spaces.DEVICE_GRAY:colorSpace, bpc, filter, index, alias);
}
return null;
};
jsPDFAPI.processJPG = function(/*data, index, alias, compression, dataAsBinaryString*/) {
return this.processJPEG.apply(this, arguments);
}
})(jsPDF.API);

View File

@ -0,0 +1,290 @@
/**
* jsPDF Annotations PlugIn
* Copyright (c) 2014 Steven Spungin (TwelveTone LLC) steven@twelvetone.tv
*
* Licensed under the MIT License.
* http://opensource.org/licenses/mit-license
*/
/**
* There are many types of annotations in a PDF document. Annotations are placed
* on a page at a particular location. They are not 'attached' to an object.
* <br />
* This plugin current supports <br />
* <li> Goto Page (set pageNumber and top in options)
* <li> Goto Name (set name and top in options)
* <li> Goto URL (set url in options)
* <p>
* The destination magnification factor can also be specified when goto is a page number or a named destination. (see documentation below)
* (set magFactor in options). XYZ is the default.
* </p>
* <p>
* Links, Text, Popup, and FreeText are supported.
* </p>
* <p>
* Options In PDF spec Not Implemented Yet
* <li> link border
* <li> named target
* <li> page coordinates
* <li> destination page scaling and layout
* <li> actions other than URL and GotoPage
* <li> background / hover actions
* </p>
*/
/*
Destination Magnification Factors
See PDF 1.3 Page 386 for meanings and options
[supported]
XYZ (options; left top zoom)
Fit (no options)
FitH (options: top)
FitV (options: left)
[not supported]
FitR
FitB
FitBH
FitBV
*/
(function(jsPDFAPI) {
'use strict';
var annotationPlugin = {
/**
* An array of arrays, indexed by <em>pageNumber</em>.
*/
annotations : [],
f2 : function(number) {
return number.toFixed(2);
},
notEmpty : function(obj) {
if (typeof obj != 'undefined') {
if (obj != '') {
return true;
}
}
}
};
jsPDF.API.annotationPlugin = annotationPlugin;
jsPDF.API.events.push([ 'addPage', function(info) {
this.annotationPlugin.annotations[info.pageNumber] = [];
} ]);
jsPDFAPI.events.push([ 'putPage', function(info) {
//TODO store annotations in pageContext so reorder/remove will not affect them.
var pageAnnos = this.annotationPlugin.annotations[info.pageNumber];
var found = false;
for (var a = 0; a < pageAnnos.length && !found; a++) {
var anno = pageAnnos[a];
switch (anno.type) {
case 'link':
if (annotationPlugin.notEmpty(anno.options.url) || annotationPlugin.notEmpty(anno.options.pageNumber)) {
found = true;
break;
}
case 'reference':
case 'text':
case 'freetext':
found = true;
break;
}
}
if (found == false) {
return;
}
this.internal.write("/Annots [");
var f2 = this.annotationPlugin.f2;
var k = this.internal.scaleFactor;
var pageHeight = this.internal.pageSize.height;
var pageInfo = this.internal.getPageInfo(info.pageNumber);
for (var a = 0; a < pageAnnos.length; a++) {
var anno = pageAnnos[a];
switch (anno.type) {
case 'reference':
// References to Widget Anotations (for AcroForm Fields)
this.internal.write(' ' + anno.object.objId + ' 0 R ');
break;
case 'text':
// Create a an object for both the text and the popup
var objText = this.internal.newAdditionalObject();
var objPopup = this.internal.newAdditionalObject();
var title = anno.title || 'Note';
var rect = "/Rect [" + f2(anno.bounds.x * k) + " " + f2(pageHeight - (anno.bounds.y + anno.bounds.h) * k) + " " + f2((anno.bounds.x + anno.bounds.w) * k) + " " + f2((pageHeight - anno.bounds.y) * k) + "] ";
line = '<</Type /Annot /Subtype /' + 'Text' + ' ' + rect + '/Contents (' + anno.contents + ')';
line += ' /Popup ' + objPopup.objId + " 0 R";
line += ' /P ' + pageInfo.objId + " 0 R";
line += ' /T (' + title + ') >>';
objText.content = line;
var parent = objText.objId + ' 0 R';
var popoff = 30;
var rect = "/Rect [" + f2((anno.bounds.x + popoff) * k) + " " + f2(pageHeight - (anno.bounds.y + anno.bounds.h) * k) + " " + f2((anno.bounds.x + anno.bounds.w + popoff) * k) + " " + f2((pageHeight - anno.bounds.y) * k) + "] ";
//var rect2 = "/Rect [" + f2(anno.bounds.x * k) + " " + f2((pageHeight - anno.bounds.y) * k) + " " + f2(anno.bounds.x + anno.bounds.w * k) + " " + f2(pageHeight - (anno.bounds.y + anno.bounds.h) * k) + "] ";
line = '<</Type /Annot /Subtype /' + 'Popup' + ' ' + rect + ' /Parent ' + parent;
if (anno.open) {
line += ' /Open true';
}
line += ' >>';
objPopup.content = line;
this.internal.write(objText.objId, '0 R', objPopup.objId, '0 R');
break;
case 'freetext':
var rect = "/Rect [" + f2(anno.bounds.x * k) + " " + f2((pageHeight - anno.bounds.y) * k) + " " + f2(anno.bounds.x + anno.bounds.w * k) + " " + f2(pageHeight - (anno.bounds.y + anno.bounds.h) * k) + "] ";
var color = anno.color || '#000000';
line = '<</Type /Annot /Subtype /' + 'FreeText' + ' ' + rect + '/Contents (' + anno.contents + ')';
line += ' /DS(font: Helvetica,sans-serif 12.0pt; text-align:left; color:#' + color + ')';
line += ' /Border [0 0 0]';
line += ' >>';
this.internal.write(line);
break;
case 'link':
if (anno.options.name) {
var loc = this.annotations._nameMap[anno.options.name];
anno.options.pageNumber = loc.page;
anno.options.top = loc.y;
} else {
if (!anno.options.top) {
anno.options.top = 0;
}
}
//var pageHeight = this.internal.pageSize.height * this.internal.scaleFactor;
var rect = "/Rect [" + f2(anno.x * k) + " " + f2((pageHeight - anno.y) * k) + " " + f2(anno.x + anno.w * k) + " " + f2(pageHeight - (anno.y + anno.h) * k) + "] ";
var line = '';
if (anno.options.url) {
line = '<</Type /Annot /Subtype /Link ' + rect + '/Border [0 0 0] /A <</S /URI /URI (' + anno.options.url + ') >>';
} else if (anno.options.pageNumber) {
// first page is 0
var info = this.internal.getPageInfo(anno.options.pageNumber);
line = '<</Type /Annot /Subtype /Link ' + rect + '/Border [0 0 0] /Dest [' + info.objId + " 0 R";
anno.options.magFactor = anno.options.magFactor || "XYZ";
switch (anno.options.magFactor) {
case 'Fit':
line += ' /Fit]';
break;
case 'FitH':
//anno.options.top = anno.options.top || f2(pageHeight * k);
line += ' /FitH ' + anno.options.top + ']';
break;
case 'FitV':
anno.options.left = anno.options.left || 0;
line += ' /FitV ' + anno.options.left + ']';
break;
case 'XYZ':
default:
var top = f2((pageHeight - anno.options.top) * k);// || f2(pageHeight * k);
anno.options.left = anno.options.left || 0;
// 0 or null zoom will not change zoom factor
if (typeof anno.options.zoom === 'undefined') {
anno.options.zoom = 0;
}
line += ' /XYZ ' + anno.options.left + ' ' + top + ' ' + anno.options.zoom + ']';
break;
}
} else {
// TODO error - should not be here
}
if (line != '') {
line += " >>";
this.internal.write(line);
}
break;
}
}
this.internal.write("]");
} ]);
jsPDFAPI.createAnnotation = function(options) {
switch (options.type) {
case 'link':
this.link(options.bounds.x, options.bounds.y, options.bounds.w, options.bounds.h, options);
break;
case 'text':
case 'freetext':
this.annotationPlugin.annotations[this.internal.getCurrentPageInfo().pageNumber].push(options);
break;
}
}
/**
* valid options
* <li> pageNumber or url [required]
* <p>If pageNumber is specified, top and zoom may also be specified</p>
*/
jsPDFAPI.link = function(x,y,w,h,options) {
'use strict';
this.annotationPlugin.annotations[this.internal.getCurrentPageInfo().pageNumber].push({
x : x,
y : y,
w : w,
h : h,
options : options,
type : 'link'
});
};
/**
* valid options
* <li> pageNumber or url [required]
* <p>If pageNumber is specified, top and zoom may also be specified</p>
*/
jsPDFAPI.link = function(x,y,w,h,options) {
'use strict';
this.annotationPlugin.annotations[this.internal.getCurrentPageInfo().pageNumber].push({
x : x,
y : y,
w : w,
h : h,
options : options,
type : 'link'
});
};
/**
* Currently only supports single line text.
* Returns the width of the text/link
*/
jsPDFAPI.textWithLink = function(text,x,y,options) {
'use strict';
var width = this.getTextWidth(text);
var height = this.internal.getLineHeight();
this.text(text, x, y);
//TODO We really need the text baseline height to do this correctly.
// Or ability to draw text on top, bottom, center, or baseline.
y += height * .2;
this.link(x, y - height, width, height, options);
return width;
};
//TODO move into external library
jsPDFAPI.getTextWidth = function(text) {
'use strict';
var fontSize = this.internal.getFontSize();
var txtWidth = this.getStringUnitWidth(text) * fontSize / this.internal.scaleFactor;
return txtWidth;
};
//TODO move into external library
jsPDFAPI.getLineHeight = function() {
return this.internal.getLineHeight();
};
return this;
})(jsPDF.API);

View File

@ -0,0 +1,25 @@
/**
* jsPDF Autoprint Plugin
*
* Licensed under the MIT License.
* http://opensource.org/licenses/mit-license
*/
(function (jsPDFAPI) {
'use strict';
jsPDFAPI.autoPrint = function () {
'use strict'
var refAutoPrintTag;
this.internal.events.subscribe('postPutResources', function () {
refAutoPrintTag = this.internal.newObject()
this.internal.write("<< /S/Named /Type/Action /N/Print >>", "endobj");
});
this.internal.events.subscribe("putCatalog", function () {
this.internal.write("/OpenAction " + refAutoPrintTag + " 0" + " R");
});
return this;
};
})(jsPDF.API);

53
WebRoot/node_modules/pdf/jsPDF-1.3.2/plugins/canvas.js generated vendored Normal file
View File

@ -0,0 +1,53 @@
/**
* jsPDF Canvas PlugIn
* Copyright (c) 2014 Steven Spungin (TwelveTone LLC) steven@twelvetone.tv
*
* Licensed under the MIT License.
* http://opensource.org/licenses/mit-license
*/
/**
* This plugin mimics the HTML5 Canvas
*
* The goal is to provide a way for current canvas users to print directly to a PDF.
*/
(function(jsPDFAPI) {
'use strict';
jsPDFAPI.events.push([
'initialized', function() {
this.canvas.pdf = this;
}
]);
jsPDFAPI.canvas = {
getContext : function(name) {
this.pdf.context2d._canvas = this;
return this.pdf.context2d;
},
style : {}
}
Object.defineProperty(jsPDFAPI.canvas, 'width', {
get : function() {
return this._width;
},
set : function(value) {
this._width = value;
this.getContext('2d').pageWrapX = value + 1;
}
});
Object.defineProperty(jsPDFAPI.canvas, 'height', {
get : function() {
return this._height;
},
set : function(value) {
this._height = value;
this.getContext('2d').pageWrapY = value + 1;
}
});
return this;
})(jsPDF.API);

412
WebRoot/node_modules/pdf/jsPDF-1.3.2/plugins/cell.js generated vendored Normal file
View File

@ -0,0 +1,412 @@
/** ====================================================================
* jsPDF Cell plugin
* Copyright (c) 2013 Youssef Beddad, youssef.beddad@gmail.com
* 2013 Eduardo Menezes de Morais, eduardo.morais@usp.br
* 2013 Lee Driscoll, https://github.com/lsdriscoll
* 2014 Juan Pablo Gaviria, https://github.com/juanpgaviria
* 2014 James Hall, james@parall.ax
* 2014 Diego Casorran, https://github.com/diegocr
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* ====================================================================
*/
(function (jsPDFAPI) {
'use strict';
/*jslint browser:true */
/*global document: false, jsPDF */
var fontName,
fontSize,
fontStyle,
padding = 3,
margin = 13,
headerFunction,
lastCellPos = { x: undefined, y: undefined, w: undefined, h: undefined, ln: undefined },
pages = 1,
setLastCellPosition = function (x, y, w, h, ln) {
lastCellPos = { 'x': x, 'y': y, 'w': w, 'h': h, 'ln': ln };
},
getLastCellPosition = function () {
return lastCellPos;
},
NO_MARGINS = {left:0, top:0, bottom: 0};
jsPDFAPI.setHeaderFunction = function (func) {
headerFunction = func;
};
jsPDFAPI.getTextDimensions = function (txt) {
fontName = this.internal.getFont().fontName;
fontSize = this.table_font_size || this.internal.getFontSize();
fontStyle = this.internal.getFont().fontStyle;
// 1 pixel = 0.264583 mm and 1 mm = 72/25.4 point
var px2pt = 0.264583 * 72 / 25.4,
dimensions,
text;
text = document.createElement('font');
text.id = "jsPDFCell";
try {
text.style.fontStyle = fontStyle;
} catch(e) {
text.style.fontWeight = fontStyle;
}
text.style.fontName = fontName;
text.style.fontSize = fontSize + 'pt';
try {
text.textContent = txt;
} catch(e) {
text.innerText = txt;
}
document.body.appendChild(text);
dimensions = { w: (text.offsetWidth + 1) * px2pt, h: (text.offsetHeight + 1) * px2pt};
document.body.removeChild(text);
return dimensions;
};
jsPDFAPI.cellAddPage = function () {
var margins = this.margins || NO_MARGINS;
this.addPage();
setLastCellPosition(margins.left, margins.top, undefined, undefined);
//setLastCellPosition(undefined, undefined, undefined, undefined, undefined);
pages += 1;
};
jsPDFAPI.cellInitialize = function () {
lastCellPos = { x: undefined, y: undefined, w: undefined, h: undefined, ln: undefined };
pages = 1;
};
jsPDFAPI.cell = function (x, y, w, h, txt, ln, align) {
var curCell = getLastCellPosition();
var pgAdded = false;
// If this is not the first cell, we must change its position
if (curCell.ln !== undefined) {
if (curCell.ln === ln) {
//Same line
x = curCell.x + curCell.w;
y = curCell.y;
} else {
//New line
var margins = this.margins || NO_MARGINS;
if ((curCell.y + curCell.h + h + margin) >= this.internal.pageSize.height - margins.bottom) {
this.cellAddPage();
pgAdded = true;
if (this.printHeaders && this.tableHeaderRow) {
this.printHeaderRow(ln, true);
}
}
//We ignore the passed y: the lines may have different heights
y = (getLastCellPosition().y + getLastCellPosition().h);
if (pgAdded) y = margin + 10;
}
}
if (txt[0] !== undefined) {
if (this.printingHeaderRow) {
this.rect(x, y, w, h, 'FD');
} else {
this.rect(x, y, w, h);
}
if (align === 'right') {
if (!(txt instanceof Array)) {
txt = [txt];
}
for (var i = 0; i < txt.length; i++) {
var currentLine = txt[i];
var textSize = this.getStringUnitWidth(currentLine) * this.internal.getFontSize();
this.text(currentLine, x + w - textSize - padding, y + this.internal.getLineHeight()*(i+1));
}
} else {
this.text(txt, x + padding, y + this.internal.getLineHeight());
}
}
setLastCellPosition(x, y, w, h, ln);
return this;
};
/**
* Return the maximum value from an array
* @param array
* @param comparisonFn
* @returns {*}
*/
jsPDFAPI.arrayMax = function (array, comparisonFn) {
var max = array[0],
i,
ln,
item;
for (i = 0, ln = array.length; i < ln; i += 1) {
item = array[i];
if (comparisonFn) {
if (comparisonFn(max, item) === -1) {
max = item;
}
} else {
if (item > max) {
max = item;
}
}
}
return max;
};
/**
* Create a table from a set of data.
* @param {Integer} [x] : left-position for top-left corner of table
* @param {Integer} [y] top-position for top-left corner of table
* @param {Object[]} [data] As array of objects containing key-value pairs corresponding to a row of data.
* @param {String[]} [headers] Omit or null to auto-generate headers at a performance cost
* @param {Object} [config.printHeaders] True to print column headers at the top of every page
* @param {Object} [config.autoSize] True to dynamically set the column widths to match the widest cell value
* @param {Object} [config.margins] margin values for left, top, bottom, and width
* @param {Object} [config.fontSize] Integer fontSize to use (optional)
*/
jsPDFAPI.table = function (x,y, data, headers, config) {
if (!data) {
throw 'No data for PDF table';
}
var headerNames = [],
headerPrompts = [],
header,
i,
ln,
cln,
columnMatrix = {},
columnWidths = {},
columnData,
column,
columnMinWidths = [],
j,
tableHeaderConfigs = [],
model,
jln,
func,
//set up defaults. If a value is provided in config, defaults will be overwritten:
autoSize = false,
printHeaders = true,
fontSize = 12,
margins = NO_MARGINS;
margins.width = this.internal.pageSize.width;
if (config) {
//override config defaults if the user has specified non-default behavior:
if(config.autoSize === true) {
autoSize = true;
}
if(config.printHeaders === false) {
printHeaders = false;
}
if(config.fontSize){
fontSize = config.fontSize;
}
if (config.css && typeof(config.css['font-size']) !== "undefined") {
fontSize = config.css['font-size'] * 16;
}
if(config.margins){
margins = config.margins;
}
}
/**
* @property {Number} lnMod
* Keep track of the current line number modifier used when creating cells
*/
this.lnMod = 0;
lastCellPos = { x: undefined, y: undefined, w: undefined, h: undefined, ln: undefined },
pages = 1;
this.printHeaders = printHeaders;
this.margins = margins;
this.setFontSize(fontSize);
this.table_font_size = fontSize;
// Set header values
if (headers === undefined || (headers === null)) {
// No headers defined so we derive from data
headerNames = Object.keys(data[0]);
} else if (headers[0] && (typeof headers[0] !== 'string')) {
var px2pt = 0.264583 * 72 / 25.4;
// Split header configs into names and prompts
for (i = 0, ln = headers.length; i < ln; i += 1) {
header = headers[i];
headerNames.push(header.name);
headerPrompts.push(header.prompt);
columnWidths[header.name] = header.width *px2pt;
}
} else {
headerNames = headers;
}
if (autoSize) {
// Create a matrix of columns e.g., {column_title: [row1_Record, row2_Record]}
func = function (rec) {
return rec[header];
};
for (i = 0, ln = headerNames.length; i < ln; i += 1) {
header = headerNames[i];
columnMatrix[header] = data.map(
func
);
// get header width
columnMinWidths.push(this.getTextDimensions(headerPrompts[i] || header).w);
column = columnMatrix[header];
// get cell widths
for (j = 0, cln = column.length; j < cln; j += 1) {
columnData = column[j];
columnMinWidths.push(this.getTextDimensions(columnData).w);
}
// get final column width
columnWidths[header] = jsPDFAPI.arrayMax(columnMinWidths);
//have to reset
columnMinWidths = [];
}
}
// -- Construct the table
if (printHeaders) {
var lineHeight = this.calculateLineHeight(headerNames, columnWidths, headerPrompts.length?headerPrompts:headerNames);
// Construct the header row
for (i = 0, ln = headerNames.length; i < ln; i += 1) {
header = headerNames[i];
tableHeaderConfigs.push([x, y, columnWidths[header], lineHeight, String(headerPrompts.length ? headerPrompts[i] : header)]);
}
// Store the table header config
this.setTableHeaderRow(tableHeaderConfigs);
// Print the header for the start of the table
this.printHeaderRow(1, false);
}
// Construct the data rows
for (i = 0, ln = data.length; i < ln; i += 1) {
var lineHeight;
model = data[i];
lineHeight = this.calculateLineHeight(headerNames, columnWidths, model);
for (j = 0, jln = headerNames.length; j < jln; j += 1) {
header = headerNames[j];
this.cell(x, y, columnWidths[header], lineHeight, model[header], i + 2, header.align);
}
}
this.lastCellPos = lastCellPos;
this.table_x = x;
this.table_y = y;
return this;
};
/**
* Calculate the height for containing the highest column
* @param {String[]} headerNames is the header, used as keys to the data
* @param {Integer[]} columnWidths is size of each column
* @param {Object[]} model is the line of data we want to calculate the height of
*/
jsPDFAPI.calculateLineHeight = function (headerNames, columnWidths, model) {
var header, lineHeight = 0;
for (var j = 0; j < headerNames.length; j++) {
header = headerNames[j];
model[header] = this.splitTextToSize(String(model[header]), columnWidths[header] - padding);
var h = this.internal.getLineHeight() * model[header].length + padding;
if (h > lineHeight)
lineHeight = h;
}
return lineHeight;
};
/**
* Store the config for outputting a table header
* @param {Object[]} config
* An array of cell configs that would define a header row: Each config matches the config used by jsPDFAPI.cell
* except the ln parameter is excluded
*/
jsPDFAPI.setTableHeaderRow = function (config) {
this.tableHeaderRow = config;
};
/**
* Output the store header row
* @param lineNumber The line number to output the header at
*/
jsPDFAPI.printHeaderRow = function (lineNumber, new_page) {
if (!this.tableHeaderRow) {
throw 'Property tableHeaderRow does not exist.';
}
var tableHeaderCell,
tmpArray,
i,
ln;
this.printingHeaderRow = true;
if (headerFunction !== undefined) {
var position = headerFunction(this, pages);
setLastCellPosition(position[0], position[1], position[2], position[3], -1);
}
this.setFontStyle('bold');
var tempHeaderConf = [];
for (i = 0, ln = this.tableHeaderRow.length; i < ln; i += 1) {
this.setFillColor(200,200,200);
tableHeaderCell = this.tableHeaderRow[i];
if (new_page) {
this.margins.top = margin;
tableHeaderCell[1] = this.margins && this.margins.top || 0;
tempHeaderConf.push(tableHeaderCell);
}
tmpArray = [].concat(tableHeaderCell);
this.cell.apply(this, tmpArray.concat(lineNumber));
}
if (tempHeaderConf.length > 0){
this.setTableHeaderRow(tempHeaderConf);
}
this.setFontStyle('normal');
this.printingHeaderRow = false;
};
})(jsPDF.API);

1615
WebRoot/node_modules/pdf/jsPDF-1.3.2/plugins/context2d.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

1090
WebRoot/node_modules/pdf/jsPDF-1.3.2/plugins/from_html.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,52 @@
/** ====================================================================
* jsPDF JavaScript plugin
* Copyright (c) 2013 Youssef Beddad, youssef.beddad@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* ====================================================================
*/
/*global jsPDF */
(function (jsPDFAPI) {
'use strict';
var jsNamesObj, jsJsObj, text;
jsPDFAPI.addJS = function (txt) {
text = txt;
this.internal.events.subscribe(
'postPutResources',
function (txt) {
jsNamesObj = this.internal.newObject();
this.internal.write('<< /Names [(EmbeddedJS) ' + (jsNamesObj + 1) + ' 0 R] >>', 'endobj');
jsJsObj = this.internal.newObject();
this.internal.write('<< /S /JavaScript /JS (', text, ') >>', 'endobj');
}
);
this.internal.events.subscribe(
'putCatalog',
function () {
if (jsNamesObj !== undefined && jsJsObj !== undefined) {
this.internal.write('/Names <</JavaScript ' + jsNamesObj + ' 0 R>>');
}
}
);
return this;
};
}(jsPDF.API));

242
WebRoot/node_modules/pdf/jsPDF-1.3.2/plugins/outline.js generated vendored Normal file
View File

@ -0,0 +1,242 @@
/**
* jsPDF Outline PlugIn
* Copyright (c) 2014 Steven Spungin (TwelveTone LLC) steven@twelvetone.tv
*
* Licensed under the MIT License.
* http://opensource.org/licenses/mit-license
*/
/**
* Generates a PDF Outline
*/
;
(function(jsPDFAPI) {
'use strict';
jsPDFAPI.events.push([
'postPutResources', function() {
var pdf = this;
var rx = /^(\d+) 0 obj$/;
// Write action goto objects for each page
// this.outline.destsGoto = [];
// for (var i = 0; i < totalPages; i++) {
// var id = pdf.internal.newObject();
// this.outline.destsGoto.push(id);
// pdf.internal.write("<</D[" + (i * 2 + 3) + " 0 R /XYZ null
// null null]/S/GoTo>> endobj");
// }
//
// for (var i = 0; i < dests.length; i++) {
// pdf.internal.write("(page_" + (i + 1) + ")" + dests[i] + " 0
// R");
// }
//
if (this.outline.root.children.length > 0) {
var lines = pdf.outline.render().split(/\r\n/);
for (var i = 0; i < lines.length; i++) {
var line = lines[i];
var m = rx.exec(line);
if (m != null) {
var oid = m[1];
pdf.internal.newObjectDeferredBegin(oid);
}
pdf.internal.write(line);
}
}
// This code will write named destination for each page reference
// (page_1, etc)
if (this.outline.createNamedDestinations) {
var totalPages = this.internal.pages.length;
// WARNING: this assumes jsPDF starts on page 3 and pageIDs
// follow 5, 7, 9, etc
// Write destination objects for each page
var dests = [];
for (var i = 0; i < totalPages; i++) {
var id = pdf.internal.newObject();
dests.push(id);
var info = pdf.internal.getPageInfo(i+1);
pdf.internal.write("<< /D[" + info.objId + " 0 R /XYZ null null null]>> endobj");
}
// assign a name for each destination
var names2Oid = pdf.internal.newObject();
pdf.internal.write('<< /Names [ ');
for (var i = 0; i < dests.length; i++) {
pdf.internal.write("(page_" + (i + 1) + ")" + dests[i] + " 0 R");
}
pdf.internal.write(' ] >>', 'endobj');
// var kids = pdf.internal.newObject();
// pdf.internal.write('<< /Kids [ ' + names2Oid + ' 0 R');
// pdf.internal.write(' ] >>', 'endobj');
var namesOid = pdf.internal.newObject();
pdf.internal.write('<< /Dests ' + names2Oid + " 0 R");
pdf.internal.write('>>', 'endobj');
}
}
]);
jsPDFAPI.events.push([
'putCatalog', function() {
var pdf = this;
if (pdf.outline.root.children.length > 0) {
pdf.internal.write("/Outlines", this.outline.makeRef(this.outline.root));
if (this.outline.createNamedDestinations) {
pdf.internal.write("/Names " + namesOid + " 0 R");
}
// Open with Bookmarks showing
// pdf.internal.write("/PageMode /UseOutlines");
}
}
]);
jsPDFAPI.events.push([
'initialized', function() {
var pdf = this;
pdf.outline = {
createNamedDestinations : false,
root : {
children : []
}
};
var namesOid;
var destsGoto = [];
/**
* Options: pageNumber
*/
pdf.outline.add = function(parent,title,options) {
var item = {
title : title,
options : options,
children : []
};
if (parent == null) {
parent = this.root;
}
parent.children.push(item);
return item;
}
pdf.outline.render = function() {
this.ctx = {};
this.ctx.val = '';
this.ctx.pdf = pdf;
this.genIds_r(this.root);
this.renderRoot(this.root);
this.renderItems(this.root);
return this.ctx.val;
};
pdf.outline.genIds_r = function(node) {
node.id = pdf.internal.newObjectDeferred();
for (var i = 0; i < node.children.length; i++) {
this.genIds_r(node.children[i]);
}
};
pdf.outline.renderRoot = function(node) {
this.objStart(node);
this.line('/Type /Outlines');
if (node.children.length > 0) {
this.line('/First ' + this.makeRef(node.children[0]));
this.line('/Last ' + this.makeRef(node.children[node.children.length - 1]));
}
this.line('/Count ' + this.count_r({
count : 0
}, node));
this.objEnd();
};
pdf.outline.renderItems = function(node) {
for (var i = 0; i < node.children.length; i++) {
var item = node.children[i];
this.objStart(item);
this.line('/Title ' + this.makeString(item.title));
this.line('/Parent ' + this.makeRef(node));
if (i > 0) {
this.line('/Prev ' + this.makeRef(node.children[i - 1]));
}
if (i < node.children.length - 1) {
this.line('/Next ' + this.makeRef(node.children[i + 1]));
}
if (item.children.length > 0) {
this.line('/First ' + this.makeRef(item.children[0]));
this.line('/Last ' + this.makeRef(item.children[item.children.length - 1]));
}
var count = this.count = this.count_r({
count : 0
}, item);
if (count > 0) {
this.line('/Count ' + count);
}
if (item.options) {
if (item.options.pageNumber) {
// Explicit Destination
//WARNING this assumes page ids are 3,5,7, etc.
var info = pdf.internal.getPageInfo(item.options.pageNumber)
this.line('/Dest ' + '[' + info.objId + ' 0 R /XYZ 0 ' + this.ctx.pdf.internal.pageSize.height + ' 0]');
// this line does not work on all clients (pageNumber instead of page ref)
//this.line('/Dest ' + '[' + (item.options.pageNumber - 1) + ' /XYZ 0 ' + this.ctx.pdf.internal.pageSize.height + ' 0]');
// Named Destination
// this.line('/Dest (page_' + (item.options.pageNumber) + ')');
// Action Destination
// var id = pdf.internal.newObject();
// pdf.internal.write('<</D[' + (item.options.pageNumber - 1) + ' /XYZ null null null]/S/GoTo>> endobj');
// this.line('/A ' + id + ' 0 R' );
}
}
this.objEnd();
}
for (var i = 0; i < node.children.length; i++) {
var item = node.children[i];
this.renderItems(item);
}
};
pdf.outline.line = function(text) {
this.ctx.val += text + '\r\n';
};
pdf.outline.makeRef = function(node) {
return node.id + ' 0 R';
};
pdf.outline.makeString = function(val) {
return '(' + pdf.internal.pdfEscape(val) + ')';
};
pdf.outline.objStart = function(node) {
this.ctx.val += '\r\n' + node.id + ' 0 obj' + '\r\n<<\r\n';
};
pdf.outline.objEnd = function(node) {
this.ctx.val += '>> \r\n' + 'endobj' + '\r\n';
};
pdf.outline.count_r = function(ctx,node) {
for (var i = 0; i < node.children.length; i++) {
ctx.count++;
this.count_r(ctx, node.children[i]);
}
return ctx.count;
};
}
]);
return this;
})(jsPDF.API);

View File

@ -0,0 +1,535 @@
/**@preserve
* ====================================================================
* jsPDF PNG PlugIn
* Copyright (c) 2014 James Robb, https://github.com/jamesbrobb
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* ====================================================================
*/
(function(jsPDFAPI) {
'use strict'
/*
* @see http://www.w3.org/TR/PNG-Chunks.html
*
Color Allowed Interpretation
Type Bit Depths
0 1,2,4,8,16 Each pixel is a grayscale sample.
2 8,16 Each pixel is an R,G,B triple.
3 1,2,4,8 Each pixel is a palette index;
a PLTE chunk must appear.
4 8,16 Each pixel is a grayscale sample,
followed by an alpha sample.
6 8,16 Each pixel is an R,G,B triple,
followed by an alpha sample.
*/
/*
* PNG filter method types
*
* @see http://www.w3.org/TR/PNG-Filters.html
* @see http://www.libpng.org/pub/png/book/chapter09.html
*
* This is what the value 'Predictor' in decode params relates to
*
* 15 is "optimal prediction", which means the prediction algorithm can change from line to line.
* In that case, you actually have to read the first byte off each line for the prediction algorthim (which should be 0-4, corresponding to PDF 10-14) and select the appropriate unprediction algorithm based on that byte.
*
0 None
1 Sub
2 Up
3 Average
4 Paeth
*/
var doesNotHavePngJS = function() {
return typeof PNG !== 'function' || typeof FlateStream !== 'function';
}
, canCompress = function(value) {
return value !== jsPDFAPI.image_compression.NONE && hasCompressionJS();
}
, hasCompressionJS = function() {
var inst = typeof Deflater === 'function';
if(!inst)
throw new Error("requires deflate.js for compression")
return inst;
}
, compressBytes = function(bytes, lineLength, colorsPerPixel, compression) {
var level = 5,
filter_method = filterUp;
switch(compression) {
case jsPDFAPI.image_compression.FAST:
level = 3;
filter_method = filterSub;
break;
case jsPDFAPI.image_compression.MEDIUM:
level = 6;
filter_method = filterAverage;
break;
case jsPDFAPI.image_compression.SLOW:
level = 9;
filter_method = filterPaeth;//uses to sum to choose best filter for each line
break;
}
bytes = applyPngFilterMethod(bytes, lineLength, colorsPerPixel, filter_method);
var header = new Uint8Array(createZlibHeader(level));
var checksum = adler32(bytes);
var deflate = new Deflater(level);
var a = deflate.append(bytes);
var cBytes = deflate.flush();
var len = header.length + a.length + cBytes.length;
var cmpd = new Uint8Array(len + 4);
cmpd.set(header);
cmpd.set(a, header.length);
cmpd.set(cBytes, header.length + a.length);
cmpd[len++] = (checksum >>> 24) & 0xff;
cmpd[len++] = (checksum >>> 16) & 0xff;
cmpd[len++] = (checksum >>> 8) & 0xff;
cmpd[len++] = checksum & 0xff;
return jsPDFAPI.arrayBufferToBinaryString(cmpd);
}
, createZlibHeader = function(bytes, level){
/*
* @see http://www.ietf.org/rfc/rfc1950.txt for zlib header
*/
var cm = 8;
var cinfo = Math.LOG2E * Math.log(0x8000) - 8;
var cmf = (cinfo << 4) | cm;
var hdr = cmf << 8;
var flevel = Math.min(3, ((level - 1) & 0xff) >> 1);
hdr |= (flevel << 6);
hdr |= 0;//FDICT
hdr += 31 - (hdr % 31);
return [cmf, (hdr & 0xff) & 0xff];
}
, adler32 = function(array, param) {
var adler = 1;
var s1 = adler & 0xffff,
s2 = (adler >>> 16) & 0xffff;
var len = array.length;
var tlen;
var i = 0;
while (len > 0) {
tlen = len > param ? param : len;
len -= tlen;
do {
s1 += array[i++];
s2 += s1;
} while (--tlen);
s1 %= 65521;
s2 %= 65521;
}
return ((s2 << 16) | s1) >>> 0;
}
, applyPngFilterMethod = function(bytes, lineLength, colorsPerPixel, filter_method) {
var lines = bytes.length / lineLength,
result = new Uint8Array(bytes.length + lines),
filter_methods = getFilterMethods(),
i = 0, line, prevLine, offset;
for(; i < lines; i++) {
offset = i * lineLength;
line = bytes.subarray(offset, offset + lineLength);
if(filter_method) {
result.set(filter_method(line, colorsPerPixel, prevLine), offset + i);
}else{
var j = 0,
len = filter_methods.length,
results = [];
for(; j < len; j++)
results[j] = filter_methods[j](line, colorsPerPixel, prevLine);
var ind = getIndexOfSmallestSum(results.concat());
result.set(results[ind], offset + i);
}
prevLine = line;
}
return result;
}
, filterNone = function(line, colorsPerPixel, prevLine) {
/*var result = new Uint8Array(line.length + 1);
result[0] = 0;
result.set(line, 1);*/
var result = Array.apply([], line);
result.unshift(0);
return result;
}
, filterSub = function(line, colorsPerPixel, prevLine) {
var result = [],
i = 0,
len = line.length,
left;
result[0] = 1;
for(; i < len; i++) {
left = line[i - colorsPerPixel] || 0;
result[i + 1] = (line[i] - left + 0x0100) & 0xff;
}
return result;
}
, filterUp = function(line, colorsPerPixel, prevLine) {
var result = [],
i = 0,
len = line.length,
up;
result[0] = 2;
for(; i < len; i++) {
up = prevLine && prevLine[i] || 0;
result[i + 1] = (line[i] - up + 0x0100) & 0xff;
}
return result;
}
, filterAverage = function(line, colorsPerPixel, prevLine) {
var result = [],
i = 0,
len = line.length,
left,
up;
result[0] = 3;
for(; i < len; i++) {
left = line[i - colorsPerPixel] || 0;
up = prevLine && prevLine[i] || 0;
result[i + 1] = (line[i] + 0x0100 - ((left + up) >>> 1)) & 0xff;
}
return result;
}
, filterPaeth = function(line, colorsPerPixel, prevLine) {
var result = [],
i = 0,
len = line.length,
left,
up,
upLeft,
paeth;
result[0] = 4;
for(; i < len; i++) {
left = line[i - colorsPerPixel] || 0;
up = prevLine && prevLine[i] || 0;
upLeft = prevLine && prevLine[i - colorsPerPixel] || 0;
paeth = paethPredictor(left, up, upLeft);
result[i + 1] = (line[i] - paeth + 0x0100) & 0xff;
}
return result;
}
,paethPredictor = function(left, up, upLeft) {
var p = left + up - upLeft,
pLeft = Math.abs(p - left),
pUp = Math.abs(p - up),
pUpLeft = Math.abs(p - upLeft);
return (pLeft <= pUp && pLeft <= pUpLeft) ? left : (pUp <= pUpLeft) ? up : upLeft;
}
, getFilterMethods = function() {
return [filterNone, filterSub, filterUp, filterAverage, filterPaeth];
}
,getIndexOfSmallestSum = function(arrays) {
var i = 0,
len = arrays.length,
sum, min, ind;
while(i < len) {
sum = absSum(arrays[i].slice(1));
if(sum < min || !min) {
min = sum;
ind = i;
}
i++;
}
return ind;
}
, absSum = function(array) {
var i = 0,
len = array.length,
sum = 0;
while(i < len)
sum += Math.abs(array[i++]);
return sum;
}
, getPredictorFromCompression = function (compression) {
var predictor;
switch (compression) {
case jsPDFAPI.image_compression.FAST:
predictor = 11;
break;
case jsPDFAPI.image_compression.MEDIUM:
predictor = 13;
break;
case jsPDFAPI.image_compression.SLOW:
predictor = 14;
break;
}
return predictor;
}
, logImg = function(img) {
console.log("width: " + img.width);
console.log("height: " + img.height);
console.log("bits: " + img.bits);
console.log("colorType: " + img.colorType);
console.log("transparency:");
console.log(img.transparency);
console.log("text:");
console.log(img.text);
console.log("compressionMethod: " + img.compressionMethod);
console.log("filterMethod: " + img.filterMethod);
console.log("interlaceMethod: " + img.interlaceMethod);
console.log("imgData:");
console.log(img.imgData);
console.log("palette:");
console.log(img.palette);
console.log("colors: " + img.colors);
console.log("colorSpace: " + img.colorSpace);
console.log("pixelBitlength: " + img.pixelBitlength);
console.log("hasAlphaChannel: " + img.hasAlphaChannel);
};
jsPDFAPI.processPNG = function(imageData, imageIndex, alias, compression, dataAsBinaryString) {
'use strict'
var colorSpace = this.color_spaces.DEVICE_RGB,
decode = this.decode.FLATE_DECODE,
bpc = 8,
img, dp, trns,
colors, pal, smask;
/* if(this.isString(imageData)) {
}*/
if(this.isArrayBuffer(imageData))
imageData = new Uint8Array(imageData);
if(this.isArrayBufferView(imageData)) {
if(doesNotHavePngJS())
throw new Error("PNG support requires png.js and zlib.js");
img = new PNG(imageData);
imageData = img.imgData;
bpc = img.bits;
colorSpace = img.colorSpace;
colors = img.colors;
//logImg(img);
/*
* colorType 6 - Each pixel is an R,G,B triple, followed by an alpha sample.
*
* colorType 4 - Each pixel is a grayscale sample, followed by an alpha sample.
*
* Extract alpha to create two separate images, using the alpha as a sMask
*/
if([4,6].indexOf(img.colorType) !== -1) {
/*
* processes 8 bit RGBA and grayscale + alpha images
*/
if(img.bits === 8) {
var pixels = img.pixelBitlength == 32 ? new Uint32Array(img.decodePixels().buffer) : img.pixelBitlength == 16 ? new Uint16Array(img.decodePixels().buffer) : new Uint8Array(img.decodePixels().buffer),
len = pixels.length,
imgData = new Uint8Array(len * img.colors),
alphaData = new Uint8Array(len),
pDiff = img.pixelBitlength - img.bits,
i = 0, n = 0, pixel, pbl;
for(; i < len; i++) {
pixel = pixels[i];
pbl = 0;
while(pbl < pDiff) {
imgData[n++] = ( pixel >>> pbl ) & 0xff;
pbl = pbl + img.bits;
}
alphaData[i] = ( pixel >>> pbl ) & 0xff;
}
}
/*
* processes 16 bit RGBA and grayscale + alpha images
*/
if(img.bits === 16) {
var pixels = new Uint32Array(img.decodePixels().buffer),
len = pixels.length,
imgData = new Uint8Array((len * (32 / img.pixelBitlength) ) * img.colors),
alphaData = new Uint8Array(len * (32 / img.pixelBitlength) ),
hasColors = img.colors > 1,
i = 0, n = 0, a = 0, pixel;
while(i < len) {
pixel = pixels[i++];
imgData[n++] = (pixel >>> 0) & 0xFF;
if(hasColors) {
imgData[n++] = (pixel >>> 16) & 0xFF;
pixel = pixels[i++];
imgData[n++] = (pixel >>> 0) & 0xFF;
}
alphaData[a++] = (pixel >>> 16) & 0xFF;
}
bpc = 8;
}
if(canCompress(compression)) {
imageData = compressBytes(imgData, img.width * img.colors, img.colors, compression);
smask = compressBytes(alphaData, img.width, 1, compression);
}else{
imageData = imgData;
smask = alphaData;
decode = null;
}
}
/*
* Indexed png. Each pixel is a palette index.
*/
if(img.colorType === 3) {
colorSpace = this.color_spaces.INDEXED;
pal = img.palette;
if(img.transparency.indexed) {
var trans = img.transparency.indexed;
var total = 0,
i = 0,
len = trans.length;
for(; i<len; ++i)
total += trans[i];
total = total / 255;
/*
* a single color is specified as 100% transparent (0),
* so we set trns to use a /Mask with that index
*/
if(total === len - 1 && trans.indexOf(0) !== -1) {
trns = [trans.indexOf(0)];
/*
* there's more than one colour within the palette that specifies
* a transparency value less than 255, so we unroll the pixels to create an image sMask
*/
}else if(total !== len){
var pixels = img.decodePixels(),
alphaData = new Uint8Array(pixels.length),
i = 0,
len = pixels.length;
for(; i < len; i++)
alphaData[i] = trans[pixels[i]];
smask = compressBytes(alphaData, img.width, 1);
}
}
}
var predictor = getPredictorFromCompression(compression);
if(decode === this.decode.FLATE_DECODE)
dp = '/Predictor '+ predictor +' /Colors '+ colors +' /BitsPerComponent '+ bpc +' /Columns '+ img.width;
else
//remove 'Predictor' as it applies to the type of png filter applied to its IDAT - we only apply with compression
dp = '/Colors '+ colors +' /BitsPerComponent '+ bpc +' /Columns '+ img.width;
if(this.isArrayBuffer(imageData) || this.isArrayBufferView(imageData))
imageData = this.arrayBufferToBinaryString(imageData);
if(smask && this.isArrayBuffer(smask) || this.isArrayBufferView(smask))
smask = this.arrayBufferToBinaryString(smask);
return this.createImageInfo(imageData, img.width, img.height, colorSpace,
bpc, decode, imageIndex, alias, dp, trns, pal, smask, predictor);
}
throw new Error("Unsupported PNG image data, try using JPEG instead.");
}
})(jsPDF.API);

View File

@ -0,0 +1,25 @@
/**
* jsPDF Autoprint Plugin
*
* Licensed under the MIT License.
* http://opensource.org/licenses/mit-license
*/
(function (jsPDFAPI) {
'use strict';
jsPDFAPI.autoPrint = function () {
'use strict'
var refAutoPrintTag;
this.internal.events.subscribe('postPutResources', function () {
refAutoPrintTag = this.internal.newObject()
this.internal.write("<< /S/Named /Type/Action /N/Print >>", "endobj");
});
this.internal.events.subscribe("putCatalog", function () {
this.internal.write("/OpenAction " + refAutoPrintTag + " 0" + " R");
});
return this;
};
})(jsPDF.API);

View File

@ -0,0 +1,325 @@
/** @preserve
* jsPDF split_text_to_size plugin - MIT license.
* Copyright (c) 2012 Willow Systems Corporation, willow-systems.com
* 2014 Diego Casorran, https://github.com/diegocr
*/
/**
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* ====================================================================
*/
;(function(API) {
'use strict'
/**
Returns an array of length matching length of the 'word' string, with each
cell ocupied by the width of the char in that position.
@function
@param word {String}
@param widths {Object}
@param kerning {Object}
@returns {Array}
*/
var getCharWidthsArray = API.getCharWidthsArray = function(text, options){
if (!options) {
options = {}
}
var widths = options.widths ? options.widths : this.internal.getFont().metadata.Unicode.widths
, widthsFractionOf = widths.fof ? widths.fof : 1
, kerning = options.kerning ? options.kerning : this.internal.getFont().metadata.Unicode.kerning
, kerningFractionOf = kerning.fof ? kerning.fof : 1
// console.log("widths, kergnings", widths, kerning)
var i, l
, char_code
, prior_char_code = 0 // for kerning
, default_char_width = widths[0] || widthsFractionOf
, output = []
for (i = 0, l = text.length; i < l; i++) {
char_code = text.charCodeAt(i)
output.push(
( widths[char_code] || default_char_width ) / widthsFractionOf +
( kerning[char_code] && kerning[char_code][prior_char_code] || 0 ) / kerningFractionOf
)
prior_char_code = char_code
}
return output
}
var getArraySum = function(array){
var i = array.length
, output = 0
while(i){
;i--;
output += array[i]
}
return output
}
/**
Returns a widths of string in a given font, if the font size is set as 1 point.
In other words, this is "proportional" value. For 1 unit of font size, the length
of the string will be that much.
Multiply by font size to get actual width in *points*
Then divide by 72 to get inches or divide by (72/25.6) to get 'mm' etc.
@public
@function
@param
@returns {Type}
*/
var getStringUnitWidth = API.getStringUnitWidth = function(text, options) {
return getArraySum(getCharWidthsArray.call(this, text, options))
}
/**
returns array of lines
*/
var splitLongWord = function(word, widths_array, firstLineMaxLen, maxLen){
var answer = []
// 1st, chop off the piece that can fit on the hanging line.
var i = 0
, l = word.length
, workingLen = 0
while (i !== l && workingLen + widths_array[i] < firstLineMaxLen){
workingLen += widths_array[i]
;i++;
}
// this is first line.
answer.push(word.slice(0, i))
// 2nd. Split the rest into maxLen pieces.
var startOfLine = i
workingLen = 0
while (i !== l){
if (workingLen + widths_array[i] > maxLen) {
answer.push(word.slice(startOfLine, i))
workingLen = 0
startOfLine = i
}
workingLen += widths_array[i]
;i++;
}
if (startOfLine !== i) {
answer.push(word.slice(startOfLine, i))
}
return answer
}
// Note, all sizing inputs for this function must be in "font measurement units"
// By default, for PDF, it's "point".
var splitParagraphIntoLines = function(text, maxlen, options){
// at this time works only on Western scripts, ones with space char
// separating the words. Feel free to expand.
if (!options) {
options = {}
}
var line = []
, lines = [line]
, line_length = options.textIndent || 0
, separator_length = 0
, current_word_length = 0
, word
, widths_array
, words = text.split(' ')
, spaceCharWidth = getCharWidthsArray(' ', options)[0]
, i, l, tmp, lineIndent
if(options.lineIndent === -1) {
lineIndent = words[0].length +2;
} else {
lineIndent = options.lineIndent || 0;
}
if(lineIndent) {
var pad = Array(lineIndent).join(" "), wrds = [];
words.map(function(wrd) {
wrd = wrd.split(/\s*\n/);
if(wrd.length > 1) {
wrds = wrds.concat(wrd.map(function(wrd, idx) {
return (idx && wrd.length ? "\n":"") + wrd;
}));
} else {
wrds.push(wrd[0]);
}
});
words = wrds;
lineIndent = getStringUnitWidth(pad, options);
}
for (i = 0, l = words.length; i < l; i++) {
var force = 0;
word = words[i]
if(lineIndent && word[0] == "\n") {
word = word.substr(1);
force = 1;
}
widths_array = getCharWidthsArray(word, options)
current_word_length = getArraySum(widths_array)
if (line_length + separator_length + current_word_length > maxlen || force) {
if (current_word_length > maxlen) {
// this happens when you have space-less long URLs for example.
// we just chop these to size. We do NOT insert hiphens
tmp = splitLongWord(word, widths_array, maxlen - (line_length + separator_length), maxlen)
// first line we add to existing line object
line.push(tmp.shift()) // it's ok to have extra space indicator there
// last line we make into new line object
line = [tmp.pop()]
// lines in the middle we apped to lines object as whole lines
while(tmp.length){
lines.push([tmp.shift()]) // single fragment occupies whole line
}
current_word_length = getArraySum( widths_array.slice(word.length - line[0].length) )
} else {
// just put it on a new line
line = [word]
}
// now we attach new line to lines
lines.push(line)
line_length = current_word_length + lineIndent
separator_length = spaceCharWidth
} else {
line.push(word)
line_length += separator_length + current_word_length
separator_length = spaceCharWidth
}
}
if(lineIndent) {
var postProcess = function(ln, idx) {
return (idx ? pad : '') + ln.join(" ");
};
} else {
var postProcess = function(ln) { return ln.join(" ")};
}
return lines.map(postProcess);
}
/**
Splits a given string into an array of strings. Uses 'size' value
(in measurement units declared as default for the jsPDF instance)
and the font's "widths" and "Kerning" tables, where available, to
determine display length of a given string for a given font.
We use character's 100% of unit size (height) as width when Width
table or other default width is not available.
@public
@function
@param text {String} Unencoded, regular JavaScript (Unicode, UTF-16 / UCS-2) string.
@param size {Number} Nominal number, measured in units default to this instance of jsPDF.
@param options {Object} Optional flags needed for chopper to do the right thing.
@returns {Array} with strings chopped to size.
*/
API.splitTextToSize = function(text, maxlen, options) {
'use strict'
if (!options) {
options = {}
}
var fsize = options.fontSize || this.internal.getFontSize()
, newOptions = (function(options){
var widths = {0:1}
, kerning = {}
if (!options.widths || !options.kerning) {
var f = this.internal.getFont(options.fontName, options.fontStyle)
, encoding = 'Unicode'
// NOT UTF8, NOT UTF16BE/LE, NOT UCS2BE/LE
// Actual JavaScript-native String's 16bit char codes used.
// no multi-byte logic here
if (f.metadata[encoding]) {
return {
widths: f.metadata[encoding].widths || widths
, kerning: f.metadata[encoding].kerning || kerning
}
}
} else {
return {
widths: options.widths
, kerning: options.kerning
}
}
// then use default values
return {
widths: widths
, kerning: kerning
}
}).call(this, options)
// first we split on end-of-line chars
var paragraphs
if(Array.isArray(text)) {
paragraphs = text;
} else {
paragraphs = text.split(/\r?\n/);
}
// now we convert size (max length of line) into "font size units"
// at present time, the "font size unit" is always 'point'
// 'proportional' means, "in proportion to font size"
var fontUnit_maxLen = 1.0 * this.internal.scaleFactor * maxlen / fsize
// at this time, fsize is always in "points" regardless of the default measurement unit of the doc.
// this may change in the future?
// until then, proportional_maxlen is likely to be in 'points'
// If first line is to be indented (shorter or longer) than maxLen
// we indicate that by using CSS-style "text-indent" option.
// here it's in font units too (which is likely 'points')
// it can be negative (which makes the first line longer than maxLen)
newOptions.textIndent = options.textIndent ?
options.textIndent * 1.0 * this.internal.scaleFactor / fsize :
0
newOptions.lineIndent = options.lineIndent;
var i, l
, output = []
for (i = 0, l = paragraphs.length; i < l; i++) {
output = output.concat(
splitParagraphIntoLines(
paragraphs[i]
, fontUnit_maxLen
, newOptions
)
)
}
return output
}
})(jsPDF.API);

View File

@ -0,0 +1,372 @@
/** @preserve
jsPDF standard_fonts_metrics plugin
Copyright (c) 2012 Willow Systems Corporation, willow-systems.com
MIT license.
*/
/**
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* ====================================================================
*/
;(function(API) {
'use strict'
/*
# reference (Python) versions of 'compress' and 'uncompress'
# only 'uncompress' function is featured lower as JavaScript
# if you want to unit test "roundtrip", just transcribe the reference
# 'compress' function from Python into JavaScript
def compress(data):
keys = '0123456789abcdef'
values = 'klmnopqrstuvwxyz'
mapping = dict(zip(keys, values))
vals = []
for key in data.keys():
value = data[key]
try:
keystring = hex(key)[2:]
keystring = keystring[:-1] + mapping[keystring[-1:]]
except:
keystring = key.join(["'","'"])
#print('Keystring is %s' % keystring)
try:
if value < 0:
valuestring = hex(value)[3:]
numberprefix = '-'
else:
valuestring = hex(value)[2:]
numberprefix = ''
valuestring = numberprefix + valuestring[:-1] + mapping[valuestring[-1:]]
except:
if type(value) == dict:
valuestring = compress(value)
else:
raise Exception("Don't know what to do with value type %s" % type(value))
vals.append(keystring+valuestring)
return '{' + ''.join(vals) + '}'
def uncompress(data):
decoded = '0123456789abcdef'
encoded = 'klmnopqrstuvwxyz'
mapping = dict(zip(encoded, decoded))
sign = +1
stringmode = False
stringparts = []
output = {}
activeobject = output
parentchain = []
keyparts = ''
valueparts = ''
key = None
ending = set(encoded)
i = 1
l = len(data) - 1 # stripping starting, ending {}
while i != l: # stripping {}
# -, {, }, ' are special.
ch = data[i]
i += 1
if ch == "'":
if stringmode:
# end of string mode
stringmode = False
key = ''.join(stringparts)
else:
# start of string mode
stringmode = True
stringparts = []
elif stringmode == True:
#print("Adding %s to stringpart" % ch)
stringparts.append(ch)
elif ch == '{':
# start of object
parentchain.append( [activeobject, key] )
activeobject = {}
key = None
#DEBUG = True
elif ch == '}':
# end of object
parent, key = parentchain.pop()
parent[key] = activeobject
key = None
activeobject = parent
#DEBUG = False
elif ch == '-':
sign = -1
else:
# must be number
if key == None:
#debug("In Key. It is '%s', ch is '%s'" % (keyparts, ch))
if ch in ending:
#debug("End of key")
keyparts += mapping[ch]
key = int(keyparts, 16) * sign
sign = +1
keyparts = ''
else:
keyparts += ch
else:
#debug("In value. It is '%s', ch is '%s'" % (valueparts, ch))
if ch in ending:
#debug("End of value")
valueparts += mapping[ch]
activeobject[key] = int(valueparts, 16) * sign
sign = +1
key = None
valueparts = ''
else:
valueparts += ch
#debug(activeobject)
return output
*/
/**
Uncompresses data compressed into custom, base16-like format.
@public
@function
@param
@returns {Type}
*/
var uncompress = function(data){
var decoded = '0123456789abcdef'
, encoded = 'klmnopqrstuvwxyz'
, mapping = {}
for (var i = 0; i < encoded.length; i++){
mapping[encoded[i]] = decoded[i]
}
var undef
, output = {}
, sign = 1
, stringparts // undef. will be [] in string mode
, activeobject = output
, parentchain = []
, parent_key_pair
, keyparts = ''
, valueparts = ''
, key // undef. will be Truthy when Key is resolved.
, datalen = data.length - 1 // stripping ending }
, ch
i = 1 // stripping starting {
while (i != datalen){
// - { } ' are special.
ch = data[i]
i += 1
if (ch == "'"){
if (stringparts){
// end of string mode
key = stringparts.join('')
stringparts = undef
} else {
// start of string mode
stringparts = []
}
} else if (stringparts){
stringparts.push(ch)
} else if (ch == '{'){
// start of object
parentchain.push( [activeobject, key] )
activeobject = {}
key = undef
} else if (ch == '}'){
// end of object
parent_key_pair = parentchain.pop()
parent_key_pair[0][parent_key_pair[1]] = activeobject
key = undef
activeobject = parent_key_pair[0]
} else if (ch == '-'){
sign = -1
} else {
// must be number
if (key === undef) {
if (mapping.hasOwnProperty(ch)){
keyparts += mapping[ch]
key = parseInt(keyparts, 16) * sign
sign = +1
keyparts = ''
} else {
keyparts += ch
}
} else {
if (mapping.hasOwnProperty(ch)){
valueparts += mapping[ch]
activeobject[key] = parseInt(valueparts, 16) * sign
sign = +1
key = undef
valueparts = ''
} else {
valueparts += ch
}
}
}
} // end while
return output
}
// encoding = 'Unicode'
// NOT UTF8, NOT UTF16BE/LE, NOT UCS2BE/LE. NO clever BOM behavior
// Actual 16bit char codes used.
// no multi-byte logic here
// Unicode characters to WinAnsiEncoding:
// {402: 131, 8211: 150, 8212: 151, 8216: 145, 8217: 146, 8218: 130, 8220: 147, 8221: 148, 8222: 132, 8224: 134, 8225: 135, 8226: 149, 8230: 133, 8364: 128, 8240:137, 8249: 139, 8250: 155, 710: 136, 8482: 153, 338: 140, 339: 156, 732: 152, 352: 138, 353: 154, 376: 159, 381: 142, 382: 158}
// as you can see, all Unicode chars are outside of 0-255 range. No char code conflicts.
// this means that you can give Win cp1252 encoded strings to jsPDF for rendering directly
// as well as give strings with some (supported by these fonts) Unicode characters and
// these will be mapped to win cp1252
// for example, you can send char code (cp1252) 0x80 or (unicode) 0x20AC, getting "Euro" glyph displayed in both cases.
var encodingBlock = {
'codePages': ['WinAnsiEncoding']
, 'WinAnsiEncoding': uncompress("{19m8n201n9q201o9r201s9l201t9m201u8m201w9n201x9o201y8o202k8q202l8r202m9p202q8p20aw8k203k8t203t8v203u9v2cq8s212m9t15m8w15n9w2dw9s16k8u16l9u17s9z17x8y17y9y}")
}
, encodings = {'Unicode':{
'Courier': encodingBlock
, 'Courier-Bold': encodingBlock
, 'Courier-BoldOblique': encodingBlock
, 'Courier-Oblique': encodingBlock
, 'Helvetica': encodingBlock
, 'Helvetica-Bold': encodingBlock
, 'Helvetica-BoldOblique': encodingBlock
, 'Helvetica-Oblique': encodingBlock
, 'Times-Roman': encodingBlock
, 'Times-Bold': encodingBlock
, 'Times-BoldItalic': encodingBlock
, 'Times-Italic': encodingBlock
// , 'Symbol'
// , 'ZapfDingbats'
}}
/**
Resources:
Font metrics data is reprocessed derivative of contents of
"Font Metrics for PDF Core 14 Fonts" package, which exhibits the following copyright and license:
Copyright (c) 1989, 1990, 1991, 1992, 1993, 1997 Adobe Systems Incorporated. All Rights Reserved.
This file and the 14 PostScript(R) AFM files it accompanies may be used,
copied, and distributed for any purpose and without charge, with or without
modification, provided that all copyright notices are retained; that the AFM
files are not distributed without this file; that all modifications to this
file or any of the AFM files are prominently noted in the modified file(s);
and that this paragraph is not modified. Adobe Systems has no responsibility
or obligation to support the use of the AFM files.
*/
, fontMetrics = {'Unicode':{
// all sizing numbers are n/fontMetricsFractionOf = one font size unit
// this means that if fontMetricsFractionOf = 1000, and letter A's width is 476, it's
// width is 476/1000 or 47.6% of its height (regardless of font size)
// At this time this value applies to "widths" and "kerning" numbers.
// char code 0 represents "default" (average) width - use it for chars missing in this table.
// key 'fof' represents the "fontMetricsFractionOf" value
'Courier-Oblique': uncompress("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}")
, 'Times-BoldItalic': uncompress("{'widths'{k3o2q4ycx2r201n3m201o6o201s2l201t2l201u2l201w3m201x3m201y3m2k1t2l2r202m2n2n3m2o3m2p5n202q6o2r1w2s2l2t2l2u3m2v3t2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v2l3w3t3x3t3y3t3z3m4k5n4l4m4m4m4n4m4o4s4p4m4q4m4r4s4s4y4t2r4u3m4v4m4w3x4x5t4y4s4z4s5k3x5l4s5m4m5n3r5o3x5p4s5q4m5r5t5s4m5t3x5u3x5v2l5w1w5x2l5y3t5z3m6k2l6l3m6m3m6n2w6o3m6p2w6q2l6r3m6s3r6t1w6u1w6v3m6w1w6x4y6y3r6z3m7k3m7l3m7m2r7n2r7o1w7p3r7q2w7r4m7s3m7t2w7u2r7v2n7w1q7x2n7y3t202l3mcl4mal2ram3man3mao3map3mar3mas2lat4uau1uav3maw3way4uaz2lbk2sbl3t'fof'6obo2lbp3tbq3mbr1tbs2lbu1ybv3mbz3mck4m202k3mcm4mcn4mco4mcp4mcq5ycr4mcs4mct4mcu4mcv4mcw2r2m3rcy2rcz2rdl4sdm4sdn4sdo4sdp4sdq4sds4sdt4sdu4sdv4sdw4sdz3mek3mel3mem3men3meo3mep3meq4ser2wes2wet2weu2wev2wew1wex1wey1wez1wfl3rfm3mfn3mfo3mfp3mfq3mfr3tfs3mft3rfu3rfv3rfw3rfz2w203k6o212m6o2dw2l2cq2l3t3m3u2l17s3x19m3m}'kerning'{cl{4qu5kt5qt5rs17ss5ts}201s{201ss}201t{cks4lscmscnscoscpscls2wu2yu201ts}201x{2wu2yu}2k{201ts}2w{4qx5kx5ou5qx5rs17su5tu}2x{17su5tu5ou}2y{4qx5kx5ou5qx5rs17ss5ts}'fof'-6ofn{17sw5tw5ou5qw5rs}7t{cksclscmscnscoscps4ls}3u{17su5tu5os5qs}3v{17su5tu5os5qs}7p{17su5tu}ck{4qu5kt5qt5rs17ss5ts}4l{4qu5kt5qt5rs17ss5ts}cm{4qu5kt5qt5rs17ss5ts}cn{4qu5kt5qt5rs17ss5ts}co{4qu5kt5qt5rs17ss5ts}cp{4qu5kt5qt5rs17ss5ts}6l{4qu5ou5qw5rt17su5tu}5q{ckuclucmucnucoucpu4lu}5r{ckuclucmucnucoucpu4lu}7q{cksclscmscnscoscps4ls}6p{4qu5ou5qw5rt17sw5tw}ek{4qu5ou5qw5rt17su5tu}el{4qu5ou5qw5rt17su5tu}em{4qu5ou5qw5rt17su5tu}en{4qu5ou5qw5rt17su5tu}eo{4qu5ou5qw5rt17su5tu}ep{4qu5ou5qw5rt17su5tu}es{17ss5ts5qs4qu}et{4qu5ou5qw5rt17sw5tw}eu{4qu5ou5qw5rt17ss5ts}ev{17ss5ts5qs4qu}6z{17sw5tw5ou5qw5rs}fm{17sw5tw5ou5qw5rs}7n{201ts}fo{17sw5tw5ou5qw5rs}fp{17sw5tw5ou5qw5rs}fq{17sw5tw5ou5qw5rs}7r{cksclscmscnscoscps4ls}fs{17sw5tw5ou5qw5rs}ft{17su5tu}fu{17su5tu}fv{17su5tu}fw{17su5tu}fz{cksclscmscnscoscps4ls}}}")
, 'Helvetica-Bold': uncompress("{'widths'{k3s2q4scx1w201n3r201o6o201s1w201t1w201u1w201w3m201x3m201y3m2k1w2l2l202m2n2n3r2o3r2p5t202q6o2r1s2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v2l3w3u3x3u3y3u3z3x4k6l4l4s4m4s4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3r4v4s4w3x4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v2l5w1w5x2l5y3u5z3r6k2l6l3r6m3x6n3r6o3x6p3r6q2l6r3x6s3x6t1w6u1w6v3r6w1w6x5t6y3x6z3x7k3x7l3x7m2r7n3r7o2l7p3x7q3r7r4y7s3r7t3r7u3m7v2r7w1w7x2r7y3u202l3rcl4sal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3xbq3rbr1wbs2lbu2obv3rbz3xck4s202k3rcm4scn4sco4scp4scq6ocr4scs4mct4mcu4mcv4mcw1w2m2zcy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3res3ret3reu3rev3rew1wex1wey1wez1wfl3xfm3xfn3xfo3xfp3xfq3xfr3ufs3xft3xfu3xfv3xfw3xfz3r203k6o212m6o2dw2l2cq2l3t3r3u2l17s4m19m3r}'kerning'{cl{4qs5ku5ot5qs17sv5tv}201t{2ww4wy2yw}201w{2ks}201x{2ww4wy2yw}2k{201ts201xs}2w{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}2x{5ow5qs}2y{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}'fof'-6o7p{17su5tu5ot}ck{4qs5ku5ot5qs17sv5tv}4l{4qs5ku5ot5qs17sv5tv}cm{4qs5ku5ot5qs17sv5tv}cn{4qs5ku5ot5qs17sv5tv}co{4qs5ku5ot5qs17sv5tv}cp{4qs5ku5ot5qs17sv5tv}6l{17st5tt5os}17s{2kwclvcmvcnvcovcpv4lv4wwckv}5o{2kucltcmtcntcotcpt4lt4wtckt}5q{2ksclscmscnscoscps4ls4wvcks}5r{2ks4ws}5t{2kwclvcmvcnvcovcpv4lv4wwckv}eo{17st5tt5os}fu{17su5tu5ot}6p{17ss5ts}ek{17st5tt5os}el{17st5tt5os}em{17st5tt5os}en{17st5tt5os}6o{201ts}ep{17st5tt5os}es{17ss5ts}et{17ss5ts}eu{17ss5ts}ev{17ss5ts}6z{17su5tu5os5qt}fm{17su5tu5os5qt}fn{17su5tu5os5qt}fo{17su5tu5os5qt}fp{17su5tu5os5qt}fq{17su5tu5os5qt}fs{17su5tu5os5qt}ft{17su5tu5ot}7m{5os}fv{17su5tu5ot}fw{17su5tu5ot}}}")
, 'Courier': uncompress("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}")
, 'Courier-BoldOblique': uncompress("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}")
, 'Times-Bold': uncompress("{'widths'{k3q2q5ncx2r201n3m201o6o201s2l201t2l201u2l201w3m201x3m201y3m2k1t2l2l202m2n2n3m2o3m2p6o202q6o2r1w2s2l2t2l2u3m2v3t2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v2l3w3t3x3t3y3t3z3m4k5x4l4s4m4m4n4s4o4s4p4m4q3x4r4y4s4y4t2r4u3m4v4y4w4m4x5y4y4s4z4y5k3x5l4y5m4s5n3r5o4m5p4s5q4s5r6o5s4s5t4s5u4m5v2l5w1w5x2l5y3u5z3m6k2l6l3m6m3r6n2w6o3r6p2w6q2l6r3m6s3r6t1w6u2l6v3r6w1w6x5n6y3r6z3m7k3r7l3r7m2w7n2r7o2l7p3r7q3m7r4s7s3m7t3m7u2w7v2r7w1q7x2r7y3o202l3mcl4sal2lam3man3mao3map3mar3mas2lat4uau1yav3maw3tay4uaz2lbk2sbl3t'fof'6obo2lbp3rbr1tbs2lbu2lbv3mbz3mck4s202k3mcm4scn4sco4scp4scq6ocr4scs4mct4mcu4mcv4mcw2r2m3rcy2rcz2rdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3rek3mel3mem3men3meo3mep3meq4ser2wes2wet2weu2wev2wew1wex1wey1wez1wfl3rfm3mfn3mfo3mfp3mfq3mfr3tfs3mft3rfu3rfv3rfw3rfz3m203k6o212m6o2dw2l2cq2l3t3m3u2l17s4s19m3m}'kerning'{cl{4qt5ks5ot5qy5rw17sv5tv}201t{cks4lscmscnscoscpscls4wv}2k{201ts}2w{4qu5ku7mu5os5qx5ru17su5tu}2x{17su5tu5ou5qs}2y{4qv5kv7mu5ot5qz5ru17su5tu}'fof'-6o7t{cksclscmscnscoscps4ls}3u{17su5tu5os5qu}3v{17su5tu5os5qu}fu{17su5tu5ou5qu}7p{17su5tu5ou5qu}ck{4qt5ks5ot5qy5rw17sv5tv}4l{4qt5ks5ot5qy5rw17sv5tv}cm{4qt5ks5ot5qy5rw17sv5tv}cn{4qt5ks5ot5qy5rw17sv5tv}co{4qt5ks5ot5qy5rw17sv5tv}cp{4qt5ks5ot5qy5rw17sv5tv}6l{17st5tt5ou5qu}17s{ckuclucmucnucoucpu4lu4wu}5o{ckuclucmucnucoucpu4lu4wu}5q{ckzclzcmzcnzcozcpz4lz4wu}5r{ckxclxcmxcnxcoxcpx4lx4wu}5t{ckuclucmucnucoucpu4lu4wu}7q{ckuclucmucnucoucpu4lu}6p{17sw5tw5ou5qu}ek{17st5tt5qu}el{17st5tt5ou5qu}em{17st5tt5qu}en{17st5tt5qu}eo{17st5tt5qu}ep{17st5tt5ou5qu}es{17ss5ts5qu}et{17sw5tw5ou5qu}eu{17sw5tw5ou5qu}ev{17ss5ts5qu}6z{17sw5tw5ou5qu5rs}fm{17sw5tw5ou5qu5rs}fn{17sw5tw5ou5qu5rs}fo{17sw5tw5ou5qu5rs}fp{17sw5tw5ou5qu5rs}fq{17sw5tw5ou5qu5rs}7r{cktcltcmtcntcotcpt4lt5os}fs{17sw5tw5ou5qu5rs}ft{17su5tu5ou5qu}7m{5os}fv{17su5tu5ou5qu}fw{17su5tu5ou5qu}fz{cksclscmscnscoscps4ls}}}")
//, 'Symbol': uncompress("{'widths'{k3uaw4r19m3m2k1t2l2l202m2y2n3m2p5n202q6o3k3m2s2l2t2l2v3r2w1t3m3m2y1t2z1wbk2sbl3r'fof'6o3n3m3o3m3p3m3q3m3r3m3s3m3t3m3u1w3v1w3w3r3x3r3y3r3z2wbp3t3l3m5v2l5x2l5z3m2q4yfr3r7v3k7w1o7x3k}'kerning'{'fof'-6o}}")
, 'Helvetica': uncompress("{'widths'{k3p2q4mcx1w201n3r201o6o201s1q201t1q201u1q201w2l201x2l201y2l2k1w2l1w202m2n2n3r2o3r2p5t202q6o2r1n2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v1w3w3u3x3u3y3u3z3r4k6p4l4m4m4m4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3m4v4m4w3r4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v1w5w1w5x1w5y2z5z3r6k2l6l3r6m3r6n3m6o3r6p3r6q1w6r3r6s3r6t1q6u1q6v3m6w1q6x5n6y3r6z3r7k3r7l3r7m2l7n3m7o1w7p3r7q3m7r4s7s3m7t3m7u3m7v2l7w1u7x2l7y3u202l3rcl4mal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3rbr1wbs2lbu2obv3rbz3xck4m202k3rcm4mcn4mco4mcp4mcq6ocr4scs4mct4mcu4mcv4mcw1w2m2ncy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3mes3ret3reu3rev3rew1wex1wey1wez1wfl3rfm3rfn3rfo3rfp3rfq3rfr3ufs3xft3rfu3rfv3rfw3rfz3m203k6o212m6o2dw2l2cq2l3t3r3u1w17s4m19m3r}'kerning'{5q{4wv}cl{4qs5kw5ow5qs17sv5tv}201t{2wu4w1k2yu}201x{2wu4wy2yu}17s{2ktclucmucnu4otcpu4lu4wycoucku}2w{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}2x{17sy5ty5oy5qs}2y{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}'fof'-6o7p{17sv5tv5ow}ck{4qs5kw5ow5qs17sv5tv}4l{4qs5kw5ow5qs17sv5tv}cm{4qs5kw5ow5qs17sv5tv}cn{4qs5kw5ow5qs17sv5tv}co{4qs5kw5ow5qs17sv5tv}cp{4qs5kw5ow5qs17sv5tv}6l{17sy5ty5ow}do{17st5tt}4z{17st5tt}7s{fst}dm{17st5tt}dn{17st5tt}5o{ckwclwcmwcnwcowcpw4lw4wv}dp{17st5tt}dq{17st5tt}7t{5ow}ds{17st5tt}5t{2ktclucmucnu4otcpu4lu4wycoucku}fu{17sv5tv5ow}6p{17sy5ty5ow5qs}ek{17sy5ty5ow}el{17sy5ty5ow}em{17sy5ty5ow}en{5ty}eo{17sy5ty5ow}ep{17sy5ty5ow}es{17sy5ty5qs}et{17sy5ty5ow5qs}eu{17sy5ty5ow5qs}ev{17sy5ty5ow5qs}6z{17sy5ty5ow5qs}fm{17sy5ty5ow5qs}fn{17sy5ty5ow5qs}fo{17sy5ty5ow5qs}fp{17sy5ty5qs}fq{17sy5ty5ow5qs}7r{5ow}fs{17sy5ty5ow5qs}ft{17sv5tv5ow}7m{5ow}fv{17sv5tv5ow}fw{17sv5tv5ow}}}")
, 'Helvetica-BoldOblique': uncompress("{'widths'{k3s2q4scx1w201n3r201o6o201s1w201t1w201u1w201w3m201x3m201y3m2k1w2l2l202m2n2n3r2o3r2p5t202q6o2r1s2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v2l3w3u3x3u3y3u3z3x4k6l4l4s4m4s4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3r4v4s4w3x4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v2l5w1w5x2l5y3u5z3r6k2l6l3r6m3x6n3r6o3x6p3r6q2l6r3x6s3x6t1w6u1w6v3r6w1w6x5t6y3x6z3x7k3x7l3x7m2r7n3r7o2l7p3x7q3r7r4y7s3r7t3r7u3m7v2r7w1w7x2r7y3u202l3rcl4sal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3xbq3rbr1wbs2lbu2obv3rbz3xck4s202k3rcm4scn4sco4scp4scq6ocr4scs4mct4mcu4mcv4mcw1w2m2zcy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3res3ret3reu3rev3rew1wex1wey1wez1wfl3xfm3xfn3xfo3xfp3xfq3xfr3ufs3xft3xfu3xfv3xfw3xfz3r203k6o212m6o2dw2l2cq2l3t3r3u2l17s4m19m3r}'kerning'{cl{4qs5ku5ot5qs17sv5tv}201t{2ww4wy2yw}201w{2ks}201x{2ww4wy2yw}2k{201ts201xs}2w{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}2x{5ow5qs}2y{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}'fof'-6o7p{17su5tu5ot}ck{4qs5ku5ot5qs17sv5tv}4l{4qs5ku5ot5qs17sv5tv}cm{4qs5ku5ot5qs17sv5tv}cn{4qs5ku5ot5qs17sv5tv}co{4qs5ku5ot5qs17sv5tv}cp{4qs5ku5ot5qs17sv5tv}6l{17st5tt5os}17s{2kwclvcmvcnvcovcpv4lv4wwckv}5o{2kucltcmtcntcotcpt4lt4wtckt}5q{2ksclscmscnscoscps4ls4wvcks}5r{2ks4ws}5t{2kwclvcmvcnvcovcpv4lv4wwckv}eo{17st5tt5os}fu{17su5tu5ot}6p{17ss5ts}ek{17st5tt5os}el{17st5tt5os}em{17st5tt5os}en{17st5tt5os}6o{201ts}ep{17st5tt5os}es{17ss5ts}et{17ss5ts}eu{17ss5ts}ev{17ss5ts}6z{17su5tu5os5qt}fm{17su5tu5os5qt}fn{17su5tu5os5qt}fo{17su5tu5os5qt}fp{17su5tu5os5qt}fq{17su5tu5os5qt}fs{17su5tu5os5qt}ft{17su5tu5ot}7m{5os}fv{17su5tu5ot}fw{17su5tu5ot}}}")
//, 'ZapfDingbats': uncompress("{'widths'{k4u2k1w'fof'6o}'kerning'{'fof'-6o}}")
, 'Courier-Bold': uncompress("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}")
, 'Times-Italic': uncompress("{'widths'{k3n2q4ycx2l201n3m201o5t201s2l201t2l201u2l201w3r201x3r201y3r2k1t2l2l202m2n2n3m2o3m2p5n202q5t2r1p2s2l2t2l2u3m2v4n2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v2l3w4n3x4n3y4n3z3m4k5w4l3x4m3x4n4m4o4s4p3x4q3x4r4s4s4s4t2l4u2w4v4m4w3r4x5n4y4m4z4s5k3x5l4s5m3x5n3m5o3r5p4s5q3x5r5n5s3x5t3r5u3r5v2r5w1w5x2r5y2u5z3m6k2l6l3m6m3m6n2w6o3m6p2w6q1w6r3m6s3m6t1w6u1w6v2w6w1w6x4s6y3m6z3m7k3m7l3m7m2r7n2r7o1w7p3m7q2w7r4m7s2w7t2w7u2r7v2s7w1v7x2s7y3q202l3mcl3xal2ram3man3mao3map3mar3mas2lat4wau1vav3maw4nay4waz2lbk2sbl4n'fof'6obo2lbp3mbq3obr1tbs2lbu1zbv3mbz3mck3x202k3mcm3xcn3xco3xcp3xcq5tcr4mcs3xct3xcu3xcv3xcw2l2m2ucy2lcz2ldl4mdm4sdn4sdo4sdp4sdq4sds4sdt4sdu4sdv4sdw4sdz3mek3mel3mem3men3meo3mep3meq4mer2wes2wet2weu2wev2wew1wex1wey1wez1wfl3mfm3mfn3mfo3mfp3mfq3mfr4nfs3mft3mfu3mfv3mfw3mfz2w203k6o212m6m2dw2l2cq2l3t3m3u2l17s3r19m3m}'kerning'{cl{5kt4qw}201s{201sw}201t{201tw2wy2yy6q-t}201x{2wy2yy}2k{201tw}2w{7qs4qy7rs5ky7mw5os5qx5ru17su5tu}2x{17ss5ts5os}2y{7qs4qy7rs5ky7mw5os5qx5ru17su5tu}'fof'-6o6t{17ss5ts5qs}7t{5os}3v{5qs}7p{17su5tu5qs}ck{5kt4qw}4l{5kt4qw}cm{5kt4qw}cn{5kt4qw}co{5kt4qw}cp{5kt4qw}6l{4qs5ks5ou5qw5ru17su5tu}17s{2ks}5q{ckvclvcmvcnvcovcpv4lv}5r{ckuclucmucnucoucpu4lu}5t{2ks}6p{4qs5ks5ou5qw5ru17su5tu}ek{4qs5ks5ou5qw5ru17su5tu}el{4qs5ks5ou5qw5ru17su5tu}em{4qs5ks5ou5qw5ru17su5tu}en{4qs5ks5ou5qw5ru17su5tu}eo{4qs5ks5ou5qw5ru17su5tu}ep{4qs5ks5ou5qw5ru17su5tu}es{5ks5qs4qs}et{4qs5ks5ou5qw5ru17su5tu}eu{4qs5ks5qw5ru17su5tu}ev{5ks5qs4qs}ex{17ss5ts5qs}6z{4qv5ks5ou5qw5ru17su5tu}fm{4qv5ks5ou5qw5ru17su5tu}fn{4qv5ks5ou5qw5ru17su5tu}fo{4qv5ks5ou5qw5ru17su5tu}fp{4qv5ks5ou5qw5ru17su5tu}fq{4qv5ks5ou5qw5ru17su5tu}7r{5os}fs{4qv5ks5ou5qw5ru17su5tu}ft{17su5tu5qs}fu{17su5tu5qs}fv{17su5tu5qs}fw{17su5tu5qs}}}")
, 'Times-Roman': uncompress("{'widths'{k3n2q4ycx2l201n3m201o6o201s2l201t2l201u2l201w2w201x2w201y2w2k1t2l2l202m2n2n3m2o3m2p5n202q6o2r1m2s2l2t2l2u3m2v3s2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v1w3w3s3x3s3y3s3z2w4k5w4l4s4m4m4n4m4o4s4p3x4q3r4r4s4s4s4t2l4u2r4v4s4w3x4x5t4y4s4z4s5k3r5l4s5m4m5n3r5o3x5p4s5q4s5r5y5s4s5t4s5u3x5v2l5w1w5x2l5y2z5z3m6k2l6l2w6m3m6n2w6o3m6p2w6q2l6r3m6s3m6t1w6u1w6v3m6w1w6x4y6y3m6z3m7k3m7l3m7m2l7n2r7o1w7p3m7q3m7r4s7s3m7t3m7u2w7v3k7w1o7x3k7y3q202l3mcl4sal2lam3man3mao3map3mar3mas2lat4wau1vav3maw3say4waz2lbk2sbl3s'fof'6obo2lbp3mbq2xbr1tbs2lbu1zbv3mbz2wck4s202k3mcm4scn4sco4scp4scq5tcr4mcs3xct3xcu3xcv3xcw2l2m2tcy2lcz2ldl4sdm4sdn4sdo4sdp4sdq4sds4sdt4sdu4sdv4sdw4sdz3mek2wel2wem2wen2weo2wep2weq4mer2wes2wet2weu2wev2wew1wex1wey1wez1wfl3mfm3mfn3mfo3mfp3mfq3mfr3sfs3mft3mfu3mfv3mfw3mfz3m203k6o212m6m2dw2l2cq2l3t3m3u1w17s4s19m3m}'kerning'{cl{4qs5ku17sw5ou5qy5rw201ss5tw201ws}201s{201ss}201t{ckw4lwcmwcnwcowcpwclw4wu201ts}2k{201ts}2w{4qs5kw5os5qx5ru17sx5tx}2x{17sw5tw5ou5qu}2y{4qs5kw5os5qx5ru17sx5tx}'fof'-6o7t{ckuclucmucnucoucpu4lu5os5rs}3u{17su5tu5qs}3v{17su5tu5qs}7p{17sw5tw5qs}ck{4qs5ku17sw5ou5qy5rw201ss5tw201ws}4l{4qs5ku17sw5ou5qy5rw201ss5tw201ws}cm{4qs5ku17sw5ou5qy5rw201ss5tw201ws}cn{4qs5ku17sw5ou5qy5rw201ss5tw201ws}co{4qs5ku17sw5ou5qy5rw201ss5tw201ws}cp{4qs5ku17sw5ou5qy5rw201ss5tw201ws}6l{17su5tu5os5qw5rs}17s{2ktclvcmvcnvcovcpv4lv4wuckv}5o{ckwclwcmwcnwcowcpw4lw4wu}5q{ckyclycmycnycoycpy4ly4wu5ms}5r{cktcltcmtcntcotcpt4lt4ws}5t{2ktclvcmvcnvcovcpv4lv4wuckv}7q{cksclscmscnscoscps4ls}6p{17su5tu5qw5rs}ek{5qs5rs}el{17su5tu5os5qw5rs}em{17su5tu5os5qs5rs}en{17su5qs5rs}eo{5qs5rs}ep{17su5tu5os5qw5rs}es{5qs}et{17su5tu5qw5rs}eu{17su5tu5qs5rs}ev{5qs}6z{17sv5tv5os5qx5rs}fm{5os5qt5rs}fn{17sv5tv5os5qx5rs}fo{17sv5tv5os5qx5rs}fp{5os5qt5rs}fq{5os5qt5rs}7r{ckuclucmucnucoucpu4lu5os}fs{17sv5tv5os5qx5rs}ft{17ss5ts5qs}fu{17sw5tw5qs}fv{17sw5tw5qs}fw{17ss5ts5qs}fz{ckuclucmucnucoucpu4lu5os5rs}}}")
, 'Helvetica-Oblique': uncompress("{'widths'{k3p2q4mcx1w201n3r201o6o201s1q201t1q201u1q201w2l201x2l201y2l2k1w2l1w202m2n2n3r2o3r2p5t202q6o2r1n2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v1w3w3u3x3u3y3u3z3r4k6p4l4m4m4m4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3m4v4m4w3r4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v1w5w1w5x1w5y2z5z3r6k2l6l3r6m3r6n3m6o3r6p3r6q1w6r3r6s3r6t1q6u1q6v3m6w1q6x5n6y3r6z3r7k3r7l3r7m2l7n3m7o1w7p3r7q3m7r4s7s3m7t3m7u3m7v2l7w1u7x2l7y3u202l3rcl4mal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3rbr1wbs2lbu2obv3rbz3xck4m202k3rcm4mcn4mco4mcp4mcq6ocr4scs4mct4mcu4mcv4mcw1w2m2ncy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3mes3ret3reu3rev3rew1wex1wey1wez1wfl3rfm3rfn3rfo3rfp3rfq3rfr3ufs3xft3rfu3rfv3rfw3rfz3m203k6o212m6o2dw2l2cq2l3t3r3u1w17s4m19m3r}'kerning'{5q{4wv}cl{4qs5kw5ow5qs17sv5tv}201t{2wu4w1k2yu}201x{2wu4wy2yu}17s{2ktclucmucnu4otcpu4lu4wycoucku}2w{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}2x{17sy5ty5oy5qs}2y{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}'fof'-6o7p{17sv5tv5ow}ck{4qs5kw5ow5qs17sv5tv}4l{4qs5kw5ow5qs17sv5tv}cm{4qs5kw5ow5qs17sv5tv}cn{4qs5kw5ow5qs17sv5tv}co{4qs5kw5ow5qs17sv5tv}cp{4qs5kw5ow5qs17sv5tv}6l{17sy5ty5ow}do{17st5tt}4z{17st5tt}7s{fst}dm{17st5tt}dn{17st5tt}5o{ckwclwcmwcnwcowcpw4lw4wv}dp{17st5tt}dq{17st5tt}7t{5ow}ds{17st5tt}5t{2ktclucmucnu4otcpu4lu4wycoucku}fu{17sv5tv5ow}6p{17sy5ty5ow5qs}ek{17sy5ty5ow}el{17sy5ty5ow}em{17sy5ty5ow}en{5ty}eo{17sy5ty5ow}ep{17sy5ty5ow}es{17sy5ty5qs}et{17sy5ty5ow5qs}eu{17sy5ty5ow5qs}ev{17sy5ty5ow5qs}6z{17sy5ty5ow5qs}fm{17sy5ty5ow5qs}fn{17sy5ty5ow5qs}fo{17sy5ty5ow5qs}fp{17sy5ty5qs}fq{17sy5ty5ow5qs}7r{5ow}fs{17sy5ty5ow5qs}ft{17sv5tv5ow}7m{5ow}fv{17sv5tv5ow}fw{17sv5tv5ow}}}")
}};
/*
This event handler is fired when a new jsPDF object is initialized
This event handler appends metrics data to standard fonts within
that jsPDF instance. The metrics are mapped over Unicode character
codes, NOT CIDs or other codes matching the StandardEncoding table of the
standard PDF fonts.
Future:
Also included is the encoding maping table, converting Unicode (UCS-2, UTF-16)
char codes to StandardEncoding character codes. The encoding table is to be used
somewhere around "pdfEscape" call.
*/
API.events.push([
'addFont'
,function(font) {
var metrics
, unicode_section
, encoding = 'Unicode'
, encodingBlock;
metrics = fontMetrics[encoding][font.PostScriptName];
if (metrics) {
if (font.metadata[encoding]) {
unicode_section = font.metadata[encoding];
} else {
unicode_section = font.metadata[encoding] = {};
}
unicode_section.widths = metrics.widths;
unicode_section.kerning = metrics.kerning;
}
encodingBlock = encodings[encoding][font.PostScriptName];
if (encodingBlock) {
if (font.metadata[encoding]) {
unicode_section = font.metadata[encoding];
} else {
unicode_section = font.metadata[encoding] = {};
}
unicode_section.encoding = encodingBlock;
if (encodingBlock.codePages && encodingBlock.codePages.length) {
font.encoding = encodingBlock.codePages[0];
}
}
}
]) // end of adding event handler
})(jsPDF.API);

181
WebRoot/node_modules/pdf/jsPDF-1.3.2/plugins/svg.js generated vendored Normal file
View File

@ -0,0 +1,181 @@
/** @preserve
jsPDF SVG plugin
Copyright (c) 2012 Willow Systems Corporation, willow-systems.com
*/
/**
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* ====================================================================
*/
;(function(jsPDFAPI) {
'use strict'
/**
Parses SVG XML and converts only some of the SVG elements into
PDF elements.
Supports:
paths
@public
@function
@param
@returns {Type}
*/
jsPDFAPI.addSVG = function(svgtext, x, y, w, h) {
// 'this' is _jsPDF object returned when jsPDF is inited (new jsPDF())
var undef
if (x === undef || y === undef) {
throw new Error("addSVG needs values for 'x' and 'y'");
}
function InjectCSS(cssbody, document) {
var styletag = document.createElement('style');
styletag.type = 'text/css';
if (styletag.styleSheet) {
// ie
styletag.styleSheet.cssText = cssbody;
} else {
// others
styletag.appendChild(document.createTextNode(cssbody));
}
document.getElementsByTagName("head")[0].appendChild(styletag);
}
function createWorkerNode(document){
var frameID = 'childframe' // Date.now().toString() + '_' + (Math.random() * 100).toString()
, frame = document.createElement('iframe')
InjectCSS(
'.jsPDF_sillysvg_iframe {display:none;position:absolute;}'
, document
)
frame.name = frameID
frame.setAttribute("width", 0)
frame.setAttribute("height", 0)
frame.setAttribute("frameborder", "0")
frame.setAttribute("scrolling", "no")
frame.setAttribute("seamless", "seamless")
frame.setAttribute("class", "jsPDF_sillysvg_iframe")
document.body.appendChild(frame)
return frame
}
function attachSVGToWorkerNode(svgtext, frame){
var framedoc = ( frame.contentWindow || frame.contentDocument ).document
framedoc.write(svgtext)
framedoc.close()
return framedoc.getElementsByTagName('svg')[0]
}
function convertPathToPDFLinesArgs(path){
'use strict'
// we will use 'lines' method call. it needs:
// - starting coordinate pair
// - array of arrays of vector shifts (2-len for line, 6 len for bezier)
// - scale array [horizontal, vertical] ratios
// - style (stroke, fill, both)
var x = parseFloat(path[1])
, y = parseFloat(path[2])
, vectors = []
, position = 3
, len = path.length
while (position < len){
if (path[position] === 'c'){
vectors.push([
parseFloat(path[position + 1])
, parseFloat(path[position + 2])
, parseFloat(path[position + 3])
, parseFloat(path[position + 4])
, parseFloat(path[position + 5])
, parseFloat(path[position + 6])
])
position += 7
} else if (path[position] === 'l') {
vectors.push([
parseFloat(path[position + 1])
, parseFloat(path[position + 2])
])
position += 3
} else {
position += 1
}
}
return [x,y,vectors]
}
var workernode = createWorkerNode(document)
, svgnode = attachSVGToWorkerNode(svgtext, workernode)
, scale = [1,1]
, svgw = parseFloat(svgnode.getAttribute('width'))
, svgh = parseFloat(svgnode.getAttribute('height'))
if (svgw && svgh) {
// setting both w and h makes image stretch to size.
// this may distort the image, but fits your demanded size
if (w && h) {
scale = [w / svgw, h / svgh]
}
// if only one is set, that value is set as max and SVG
// is scaled proportionately.
else if (w) {
scale = [w / svgw, w / svgw]
} else if (h) {
scale = [h / svgh, h / svgh]
}
}
var i, l, tmp
, linesargs
, items = svgnode.childNodes
for (i = 0, l = items.length; i < l; i++) {
tmp = items[i]
if (tmp.tagName && tmp.tagName.toUpperCase() === 'PATH') {
linesargs = convertPathToPDFLinesArgs( tmp.getAttribute("d").split(' ') )
// path start x coordinate
linesargs[0] = linesargs[0] * scale[0] + x // where x is upper left X of image
// path start y coordinate
linesargs[1] = linesargs[1] * scale[1] + y // where y is upper left Y of image
// the rest of lines are vectors. these will adjust with scale value auto.
this.lines.call(
this
, linesargs[2] // lines
, linesargs[0] // starting x
, linesargs[1] // starting y
, scale
)
}
}
// clean up
// workernode.parentNode.removeChild(workernode)
return this
}
})(jsPDF.API);

View File

@ -0,0 +1,39 @@
/** ====================================================================
* jsPDF total_pages plugin
* Copyright (c) 2013 Eduardo Menezes de Morais, eduardo.morais@usp.br
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* ====================================================================
*/
(function(jsPDFAPI) {
'use strict';
jsPDFAPI.putTotalPages = function(pageExpression) {
'use strict';
var replaceExpression = new RegExp(pageExpression, 'g');
for (var n = 1; n <= this.internal.getNumberOfPages(); n++) {
for (var i = 0; i < this.internal.pages[n].length; i++)
this.internal.pages[n][i] = this.internal.pages[n][i].replace(replaceExpression, this.internal.getNumberOfPages());
}
return this;
};
})(jsPDF.API);

View File

@ -0,0 +1,88 @@
/** ====================================================================
* jsPDF XMP metadata plugin
* Copyright (c) 2016 Jussi Utunen, u-jussi@suomi24.fi
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* ====================================================================
*/
/*global jsPDF */
/**
* Adds XMP formatted metadata to PDF
*
* @param {String} metadata The actual metadata to be added. The metadata shall be stored as XMP simple value. Note that if the metadata string contains XML markup characters "<", ">" or "&", those characters should be written using XML entities.
* @param {String} namespaceuri Sets the namespace URI for the metadata. Last character should be slash or hash.
* @function
* @returns {jsPDF}
* @methodOf jsPDF#
* @name addMetadata
*/
(function (jsPDFAPI) {
'use strict';
var xmpmetadata = "";
var xmpnamespaceuri = "";
var metadata_object_number = "";
jsPDFAPI.addMetadata = function (metadata,namespaceuri) {
xmpnamespaceuri = namespaceuri || "http://jspdf.default.namespaceuri/"; //The namespace URI for an XMP name shall not be empty
xmpmetadata = metadata;
this.internal.events.subscribe(
'postPutResources',
function () {
if(!xmpmetadata)
{
metadata_object_number = "";
}
else
{
var xmpmeta_beginning = '<x:xmpmeta xmlns:x="adobe:ns:meta/">';
var rdf_beginning = '<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><rdf:Description rdf:about="" xmlns:jspdf="' + xmpnamespaceuri + '"><jspdf:metadata>';
var rdf_ending = '</jspdf:metadata></rdf:Description></rdf:RDF>';
var xmpmeta_ending = '</x:xmpmeta>';
var utf8_xmpmeta_beginning = unescape(encodeURIComponent(xmpmeta_beginning));
var utf8_rdf_beginning = unescape(encodeURIComponent(rdf_beginning));
var utf8_metadata = unescape(encodeURIComponent(xmpmetadata));
var utf8_rdf_ending = unescape(encodeURIComponent(rdf_ending));
var utf8_xmpmeta_ending = unescape(encodeURIComponent(xmpmeta_ending));
var total_len = utf8_rdf_beginning.length + utf8_metadata.length + utf8_rdf_ending.length + utf8_xmpmeta_beginning.length + utf8_xmpmeta_ending.length;
metadata_object_number = this.internal.newObject();
this.internal.write('<< /Type /Metadata /Subtype /XML /Length ' + total_len + ' >>');
this.internal.write('stream');
this.internal.write(utf8_xmpmeta_beginning + utf8_rdf_beginning + utf8_metadata + utf8_rdf_ending + utf8_xmpmeta_ending);
this.internal.write('endstream');
this.internal.write('endobj');
}
}
);
this.internal.events.subscribe(
'putCatalog',
function () {
if (metadata_object_number) {
this.internal.write('/Metadata ' + metadata_object_number + ' 0 R');
}
}
);
return this;
};
}(jsPDF.API));