more:wq
This commit is contained in:
parent
c80c363f34
commit
ce1601705b
BIN
cpdfmanual.pdf
BIN
cpdfmanual.pdf
Binary file not shown.
|
@ -1,9 +1,9 @@
|
||||||
cpdf.js: A JavaScript interface to cpdf
|
// CHAPTER -1: Introduction
|
||||||
=======================================
|
|
||||||
|
|
||||||
For development server-side with node: cpdf.js / cpdflib.js
|
Use
|
||||||
|
---
|
||||||
|
|
||||||
(Minified versions cpdf.min.js and cpdflib.min.js)
|
For development server-side with node: cpdf.js (minified version cpdf.min.js)
|
||||||
|
|
||||||
Load with "const cpdf = require('cpdf.js')" if installed in npm, or "const cpdf
|
Load with "const cpdf = require('cpdf.js')" if installed in npm, or "const cpdf
|
||||||
= require('./cpdf.js')" to load from current directory.
|
= require('./cpdf.js')" to load from current directory.
|
||||||
|
@ -16,307 +16,27 @@ Load with <script src="cpdf.browser.js"></script> or similar.
|
||||||
|
|
||||||
|
|
||||||
Concurrency
|
Concurrency
|
||||||
===========
|
-----------
|
||||||
|
|
||||||
cpdf.js is synchronous and non-re-entrant.
|
cpdf.js is synchronous and non-re-entrant.
|
||||||
|
|
||||||
|
|
||||||
Data types
|
Data types
|
||||||
==========
|
----------
|
||||||
|
|
||||||
Arguments are integers, floating point numbers, strings, or arrays of type
|
Arguments are numbers, strings, or arrays (of type UInt8Array for data). Page
|
||||||
UInt8Array. Page ranges are represented by arrays of numbers.
|
ranges are represented by arrays of numbers.
|
||||||
|
|
||||||
|
|
||||||
Memory Management
|
Memory Management
|
||||||
=================
|
-----------------
|
||||||
|
|
||||||
A PDF n must be explicitly deallocated with deletePdf(n).
|
A PDF p must be explicitly deallocated with deletePdf(p).
|
||||||
|
|
||||||
|
|
||||||
Errors
|
Errors
|
||||||
======
|
------
|
||||||
|
|
||||||
Any function may raise an exception, containing a string describing the problem.
|
Any function may raise an exception, containing a string describing the problem.
|
||||||
|
|
||||||
|
|
||||||
Enumerations and data structures
|
|
||||||
================================
|
|
||||||
|
|
||||||
These are used throughout cpdf.js, but are collected here for reference.
|
|
||||||
|
|
||||||
|
|
||||||
// Permissions
|
|
||||||
|
|
||||||
/** Cannot edit the document */
|
|
||||||
var noEdit = 0;
|
|
||||||
|
|
||||||
/** Cannot print the document */
|
|
||||||
var noPrint = 1;
|
|
||||||
|
|
||||||
/** Cannot copy the document */
|
|
||||||
var noCopy = 2;
|
|
||||||
|
|
||||||
/** Cannot annotate the document */
|
|
||||||
var noAnnot = 3;
|
|
||||||
|
|
||||||
/** Cannot edit forms in the document */
|
|
||||||
var noForms = 4;
|
|
||||||
|
|
||||||
/** Cannot extract information */
|
|
||||||
var noExtract = 5;
|
|
||||||
|
|
||||||
/** Cannot assemble into a bigger document */
|
|
||||||
var noAssemble = 6;
|
|
||||||
|
|
||||||
/** Cannot print high quality */
|
|
||||||
var noHqPrint = 7;
|
|
||||||
|
|
||||||
|
|
||||||
// Encryption types
|
|
||||||
|
|
||||||
/** 40 bit RC4 encryption */
|
|
||||||
var pdf40bit = 0;
|
|
||||||
|
|
||||||
/** 128 bit RC4 encryption */
|
|
||||||
var pdf128bit = 1;
|
|
||||||
|
|
||||||
/** 128 bit AES encryption, do not encrypt metadata */
|
|
||||||
var aes128bitfalse = 2;
|
|
||||||
|
|
||||||
/** 128 bit AES encryption, encrypt metadata */
|
|
||||||
var aes128bittrue = 3;
|
|
||||||
|
|
||||||
/** Deprecated. Do not use for new files */
|
|
||||||
var aes256bitfalse = 4;
|
|
||||||
|
|
||||||
/** Deprecated. Do not use for new files */
|
|
||||||
var aes256bittrue = 5;
|
|
||||||
|
|
||||||
/** 256 bit AES encryption, do not encrypt metadata */
|
|
||||||
var aes256bitisofalse = 6;
|
|
||||||
|
|
||||||
/** 256 bit AES encryption, encrypt metadata */
|
|
||||||
var aes256bitisotrue = 7;
|
|
||||||
|
|
||||||
|
|
||||||
// Paper sizes
|
|
||||||
|
|
||||||
/** A0 Portrait paper */
|
|
||||||
var a0portrait = 0;
|
|
||||||
|
|
||||||
/** A1 Portrait paper */
|
|
||||||
var a1portrait = 1;
|
|
||||||
|
|
||||||
/** A2 Portrait paper */
|
|
||||||
var a2portrait = 2;
|
|
||||||
|
|
||||||
/** A3 Portrait paper */
|
|
||||||
var a3portrait = 3;
|
|
||||||
|
|
||||||
/** A4 Portrait paper */
|
|
||||||
var a4portrait = 4;
|
|
||||||
|
|
||||||
/** A5 Portrait paper */
|
|
||||||
var a5portrait = 5;
|
|
||||||
|
|
||||||
/** A0 Landscape paper */
|
|
||||||
var a0landscape = 6;
|
|
||||||
|
|
||||||
/** A1 Landscape paper */
|
|
||||||
var a1landscape = 7;
|
|
||||||
|
|
||||||
/** A2 Landscape paper */
|
|
||||||
var a2landscape = 8;
|
|
||||||
|
|
||||||
/** A3 Landscape paper */
|
|
||||||
var a3landscape = 9;
|
|
||||||
|
|
||||||
/** A4 Landscape paper */
|
|
||||||
var a4landscape = 10;
|
|
||||||
|
|
||||||
/** A5 Landscape paper */
|
|
||||||
var a5landscape = 11;
|
|
||||||
|
|
||||||
/** US Letter Portrait paper */
|
|
||||||
var usletterportrait = 12;
|
|
||||||
|
|
||||||
/** US Letter Landscape paper */
|
|
||||||
var usletterlandscape = 13;
|
|
||||||
|
|
||||||
/** US Legal Portrait paper */
|
|
||||||
var uslegalportrait = 14;
|
|
||||||
|
|
||||||
/** US Legal Landscape paper */
|
|
||||||
var uslegallandscape = 15;
|
|
||||||
|
|
||||||
|
|
||||||
// Positions
|
|
||||||
|
|
||||||
/** Absolute centre */
|
|
||||||
var posCentre = 0;
|
|
||||||
|
|
||||||
/** Absolute left */
|
|
||||||
var posLeft = 1;
|
|
||||||
|
|
||||||
/** Absolute right */
|
|
||||||
var posRight = 2;
|
|
||||||
|
|
||||||
/** The top centre of the page */
|
|
||||||
var top = 3;
|
|
||||||
|
|
||||||
/** The top left of the page */
|
|
||||||
var topLeft = 4;
|
|
||||||
|
|
||||||
/** The top right of the page */
|
|
||||||
var topRight = 5;
|
|
||||||
|
|
||||||
/** The left hand side of the page, halfway down */
|
|
||||||
var left = 6;
|
|
||||||
|
|
||||||
/** The bottom left of the page */
|
|
||||||
var bottomLeft = 7;
|
|
||||||
|
|
||||||
/** The bottom middle of the page */
|
|
||||||
var bottom = 8;
|
|
||||||
|
|
||||||
/** The bottom right of the page */
|
|
||||||
var bottomRight = 9;
|
|
||||||
|
|
||||||
/** The right hand side of the page, halfway down */
|
|
||||||
var right = 10;
|
|
||||||
|
|
||||||
/** Diagonal, bottom left to top right */
|
|
||||||
var diagonal = 11;
|
|
||||||
|
|
||||||
/** Diagonal, top left to bottom right */
|
|
||||||
var reversediagonal = 12;
|
|
||||||
|
|
||||||
/** Positions on the page. Used for scaling about a point, and adding text.
|
|
||||||
|
|
||||||
A position is an anchor and zero or one or two parameters, built with the
|
|
||||||
Position function.
|
|
||||||
|
|
||||||
posCentre: Two parameters, x and y
|
|
||||||
posLeft: Two parameters, x and y
|
|
||||||
posRight: Two parameters, x and y
|
|
||||||
top: One parameter - distance from top
|
|
||||||
topLeft: One parameter - distance from top left
|
|
||||||
topRight: One parameter - distance from top right
|
|
||||||
left: One parameter - distance from left middle
|
|
||||||
bottomLeft: One parameter - distance from bottom left
|
|
||||||
bottom: One parameter - distance from bottom
|
|
||||||
bottomRight: One parameter - distance from bottom right
|
|
||||||
right: One parameter - distance from right
|
|
||||||
diagonal: Zero parameters
|
|
||||||
reverseDiagonal: Zero parameters */
|
|
||||||
|
|
||||||
function Position(anchor, p1, p2)
|
|
||||||
|
|
||||||
|
|
||||||
// Fonts
|
|
||||||
|
|
||||||
/** Times Roman */
|
|
||||||
var timesRoman = 0;
|
|
||||||
|
|
||||||
/** Times Bold */
|
|
||||||
var timesBold = 1;
|
|
||||||
|
|
||||||
/** Times Italic */
|
|
||||||
var timesItalic = 2;
|
|
||||||
|
|
||||||
/** Times Bold Italic */
|
|
||||||
var timesBoldItalic = 3;
|
|
||||||
|
|
||||||
/** Helvetica */
|
|
||||||
var helvetica = 4;
|
|
||||||
|
|
||||||
/** Helvetica Bold */
|
|
||||||
var helveticaBold = 5;
|
|
||||||
|
|
||||||
/** Helvetica Oblique */
|
|
||||||
var helveticaOblique = 6;
|
|
||||||
|
|
||||||
/** Helvetica Bold Oblique */
|
|
||||||
var helveticaBoldOblique = 7;
|
|
||||||
|
|
||||||
/** Courier */
|
|
||||||
var courier = 8;
|
|
||||||
|
|
||||||
/** Courier Bold */
|
|
||||||
var courierBold = 9;
|
|
||||||
|
|
||||||
/** Courier Oblique */
|
|
||||||
var courierOblique = 10;
|
|
||||||
|
|
||||||
/** Courier Bold Oblique */
|
|
||||||
var courierBoldOblique = 11;
|
|
||||||
|
|
||||||
|
|
||||||
// Justification types
|
|
||||||
|
|
||||||
/** Left justify */
|
|
||||||
var leftJustify = 0;
|
|
||||||
|
|
||||||
/** Centre justify */
|
|
||||||
var centreJustify = 1;
|
|
||||||
|
|
||||||
/** Right justify */
|
|
||||||
var rightJustify = 2;
|
|
||||||
|
|
||||||
|
|
||||||
/// Page layouts
|
|
||||||
|
|
||||||
/** Single page */
|
|
||||||
var singlePage = 0;
|
|
||||||
|
|
||||||
/** One column */
|
|
||||||
var oneColumn = 1;
|
|
||||||
|
|
||||||
/** Two column left */
|
|
||||||
var twoColumnLeft = 2;
|
|
||||||
|
|
||||||
/** Two column right */
|
|
||||||
var twoColumnRight = 3;
|
|
||||||
|
|
||||||
/** Two page left */
|
|
||||||
var twoPageLeft = 4;
|
|
||||||
|
|
||||||
/** Two page right */
|
|
||||||
var twoPageRight = 5;
|
|
||||||
|
|
||||||
|
|
||||||
// Page modes
|
|
||||||
|
|
||||||
/** Use none */
|
|
||||||
var useNone = 0;
|
|
||||||
|
|
||||||
/** Use outlines */
|
|
||||||
var useOutlines = 1;
|
|
||||||
|
|
||||||
/** Use thumbs */
|
|
||||||
var useThumbs = 2;
|
|
||||||
|
|
||||||
/** Use OC */
|
|
||||||
var useOC = 3;
|
|
||||||
|
|
||||||
/** Use attachments */
|
|
||||||
var useAttachments = 4;
|
|
||||||
|
|
||||||
|
|
||||||
// Page label styles
|
|
||||||
|
|
||||||
/** 1, 2, 3... */
|
|
||||||
var decimalArabic = 0;
|
|
||||||
|
|
||||||
/** I, II, III... */
|
|
||||||
var uppercaseRoman = 1;
|
|
||||||
|
|
||||||
/** i, ii, iii... */
|
|
||||||
var lowercaseRoman = 2;
|
|
||||||
|
|
||||||
/** A, B, C... */
|
|
||||||
var uppercaseLetters = 3;
|
|
||||||
|
|
||||||
/** a, b, c... */
|
|
||||||
var lowercaseLetters = 4;
|
|
||||||
|
|
|
@ -1,22 +1,25 @@
|
||||||
// CHAPTER 0. Preliminaries
|
// CHAPTER 0. Preliminaries
|
||||||
|
|
||||||
/** Returns a string giving the version number of the CPDF library. */
|
/** Returns a string giving the version number of the CPDF library.
|
||||||
function version()
|
@returns {string} version */
|
||||||
|
function version() {}
|
||||||
|
|
||||||
/** Some operations have a fast mode. The default is 'slow' mode, which works
|
/** Some operations have a fast mode. The default is 'slow' mode, which works
|
||||||
even on old-fashioned files. For more details, see section 1.13 of the CPDF
|
even on old-fashioned files. For more details, see section 1.13 of the CPDF
|
||||||
manual. This function sets the mode to fast globally. */
|
manual. This function sets the mode to fast globally. */
|
||||||
function setFast()
|
function setFast() {}
|
||||||
|
|
||||||
/** Some operations have a fast mode. The default is 'slow' mode, which works
|
/** Some operations have a fast mode. The default is 'slow' mode, which works
|
||||||
even on old-fashioned files. For more details, see section 1.13 of the CPDF
|
even on old-fashioned files. For more details, see section 1.13 of the CPDF
|
||||||
manual. This function sets the mode to slow globally. */
|
manual. This function sets the mode to slow globally. */
|
||||||
function setSlow()
|
function setSlow() {}
|
||||||
|
|
||||||
/** Delete a PDF so the memory representing it may be recovered. */
|
/** Delete a PDF so the memory representing it may be recovered.
|
||||||
function deletePdf(pdf)
|
@arg {pdf} pdf PDF document to delete */
|
||||||
|
function deletePdf(pdf) {}
|
||||||
|
|
||||||
/* A debug function which prints some information about resource usage. This
|
/* A debug function which prints some information about resource usage. This
|
||||||
can be used to detect if PDFs or ranges are being deallocated properly.
|
can be used to detect if PDFs or ranges are being deallocated properly.
|
||||||
Contrary to its name, it may be run at any time. */
|
Contrary to its name, it may be run at any time. */
|
||||||
function onexit()
|
function onexit() {}
|
||||||
|
|
||||||
|
|
|
@ -1,166 +1,368 @@
|
||||||
//CHAPTER 1. Basics
|
// CHAPTER 1. Basics
|
||||||
|
|
||||||
/** Loads a PDF file from a given file. Supply a user password (possibly blank)
|
/** Loads a PDF file from a given file. Supply a user password (possibly blank)
|
||||||
in case the file is encrypted. It won't be decrypted, but sometimes the
|
in case the file is encrypted. It won't be decrypted, but sometimes the
|
||||||
password is needed just to load the file. */
|
password is needed just to load the file.
|
||||||
function fromFile(filename, userpw)
|
@arg {string} filename File name
|
||||||
|
@arg {string} userpw User password, or blank if none */
|
||||||
|
function fromFile(filename, userpw) {}
|
||||||
|
|
||||||
/** Loads a PDF from a file, doing only minimal parsing. The objects will be
|
/** Loads a PDF from a file, doing only minimal parsing. The objects will be
|
||||||
read and parsed when they are actually needed. Use this when the whole file
|
read and parsed when they are actually needed. Use this when the whole file
|
||||||
won't be required. Also supply a user password (possibly blank) in case the
|
won't be required. Also supply a user password (possibly blank) in case the
|
||||||
file is encrypted. It won't be decrypted, but sometimes the password is needed
|
file is encrypted. It won't be decrypted, but sometimes the password is needed
|
||||||
just to load the file. */
|
just to load the file.
|
||||||
function fromFileLazy(filename, userpw)
|
@arg {string} filename File name
|
||||||
|
@arg {string} userpw User password, or blank if none */
|
||||||
|
function fromFileLazy(filename, userpw) {}
|
||||||
|
|
||||||
/** Loads a file from memory given any user password. */
|
/** Loads a file from memory given any user password.
|
||||||
function fromMemory(data, userpw)
|
@arg {Uint8Array} data PDF document as an array of bytes
|
||||||
|
@arg {string} userpw User password, or blank if none */
|
||||||
|
function fromMemory(data, userpw) {}
|
||||||
|
|
||||||
/** Loads a file from memory, given a pointer and a length, and the user
|
/** Loads a file from memory, given a pointer and a length, and the user
|
||||||
password, but lazily like fromFileLazy. */
|
password, but lazily like fromFileLazy.
|
||||||
function fromMemoryLazy(data, userpw)
|
@arg {Uint8Array} data PDF document as an array of bytes
|
||||||
|
@arg {string} userpw User password, or blank if none */
|
||||||
|
function fromMemoryLazy(data, userpw) {}
|
||||||
|
|
||||||
|
/** To enumerate the list of currently allocated PDFs, call startEnumeratePDFs
|
||||||
|
which gives the number, n, of PDFs allocated, then enumeratePDFsInfo and
|
||||||
|
enumeratePDFsKey with index numbers from 0...(n - 1). Call endEnumeratePDFs to
|
||||||
|
clean up.
|
||||||
|
@return {number} number of PDFs */
|
||||||
|
function startEnumeratePDFs() {}
|
||||||
|
|
||||||
|
/** To enumerate the list of currently allocated PDFs, call startEnumeratePDFs
|
||||||
|
which gives the number, n, of PDFs allocated, then enumeratePDFsInfo and
|
||||||
|
enumeratePDFsKey with index numbers from 0...(n - 1). Call endEnumeratePDFs to
|
||||||
|
clean up.
|
||||||
|
@arg {n} index number
|
||||||
|
@return {number} PDF key */
|
||||||
|
function enumeratePDFsKey(n) {}
|
||||||
|
|
||||||
|
/** To enumerate the list of currently allocated PDFs, call startEnumeratePDFs
|
||||||
|
which gives the number, n, of PDFs allocated, then enumeratePDFsInfo and
|
||||||
|
enumeratePDFsKey with index numbers from 0...(n - 1). Call endEnumeratePDFs to
|
||||||
|
clean up.
|
||||||
|
@arg {n} index number
|
||||||
|
@return {number} PDF information */
|
||||||
|
function enumeratePDFsInfo(n) {}
|
||||||
|
|
||||||
/** To enumerate the list of currently allocated PDFs, call startEnumeratePDFs
|
/** To enumerate the list of currently allocated PDFs, call startEnumeratePDFs
|
||||||
which gives the number, n, of PDFs allocated, then enumeratePDFsInfo and
|
which gives the number, n, of PDFs allocated, then enumeratePDFsInfo and
|
||||||
enumeratePDFsKey with index numbers from 0...(n - 1). Call endEnumeratePDFs to
|
enumeratePDFsKey with index numbers from 0...(n - 1). Call endEnumeratePDFs to
|
||||||
clean up. */
|
clean up. */
|
||||||
function startEnumeratePDFs()
|
function endEnumeratePDFs() {}
|
||||||
|
|
||||||
/** To enumerate the list of currently allocated PDFs, call startEnumeratePDFs
|
/** Converts a figure in centimetres to points (72 points to 1 inch)
|
||||||
which gives the number, n, of PDFs allocated, then enumeratePDFsInfo and
|
@arg {number} i figure in centimetres
|
||||||
enumeratePDFsKey with index numbers from 0...(n - 1). Call endEnumeratePDFs to
|
@return {number} figure in points */
|
||||||
clean up. */
|
function ptOfCm(i) {}
|
||||||
function enumeratePDFsKey(n)
|
|
||||||
|
|
||||||
/** To enumerate the list of currently allocated PDFs, call startEnumeratePDFs
|
/** Converts a figure in millimetres to points (72 points to 1 inch)
|
||||||
which gives the number, n, of PDFs allocated, then enumeratePDFsInfo and
|
@arg {number} i figure in millimetres
|
||||||
enumeratePDFsKey with index numbers from 0...(n - 1). Call endEnumeratePDFs to
|
@return {number} figure in points */
|
||||||
clean up. */
|
function ptOfMm(i) {}
|
||||||
function enumeratePDFsInfo(n)
|
|
||||||
|
|
||||||
/** To enumerate the list of currently allocated PDFs, call startEnumeratePDFs
|
/** Converts a figure in inches to points (72 points to 1 inch)
|
||||||
which gives the number, n, of PDFs allocated, then enumeratePDFsInfo and
|
@arg {number} i figure in inches
|
||||||
enumeratePDFsKey with index numbers from 0...(n - 1). Call endEnumeratePDFs to
|
@return {number} figure in points */
|
||||||
clean up. */
|
function ptOfIn(i) {}
|
||||||
function endEnumeratePDFs()
|
|
||||||
|
|
||||||
/** Converts a figure in centimetres to points (72 points to 1 inch) */
|
/** Converts a figure in points to centimetres (72 points to 1 inch)
|
||||||
function ptOfCm(i)
|
@arg {number} i figure in points
|
||||||
|
@return {number} figure in centimetres */
|
||||||
|
function cmOfPt(i) {}
|
||||||
|
|
||||||
/** Converts a figure in millimetres to points (72 points to 1 inch) */
|
/** Converts a figure in points to millimetres (72 points to 1 inch)
|
||||||
function ptOfMm(i)
|
@arg {number} i figure in points
|
||||||
|
@return {number} figure in millimetres */
|
||||||
|
function mmOfPt(i) {}
|
||||||
|
|
||||||
/** Converts a figure in inches to points (72 points to 1 inch) */
|
/** Converts a figure in points to inches (72 points to 1 inch)
|
||||||
function ptOfIn(i)
|
@arg {number} i figure in points
|
||||||
|
@return {number} figure in inches */
|
||||||
/** Converts a figure in points to centimetres (72 points to 1 inch) */
|
function inOfPt(i) {}
|
||||||
function cmOfPt(i)
|
|
||||||
|
|
||||||
/** Converts a figure in points to millimetres (72 points to 1 inch) */
|
|
||||||
function mmOfPt(i)
|
|
||||||
|
|
||||||
/** Converts a figure in points to inches (72 points to 1 inch) */
|
|
||||||
function inOfPt(i)
|
|
||||||
|
|
||||||
/** Parses a page specification with reference to a given PDF (the PDF is
|
/** Parses a page specification with reference to a given PDF (the PDF is
|
||||||
supplied so that page ranges which reference pages which do not exist are
|
supplied so that page ranges which reference pages which do not exist are
|
||||||
rejected). */
|
rejected).
|
||||||
function parsePagespec(pdf, pagespec)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {string} pagespec Page specification
|
||||||
|
@return {array} page range */
|
||||||
|
function parsePagespec(pdf, pagespec) {}
|
||||||
|
|
||||||
/** Validates a page specification so far as is possible in the absence of
|
/** Validates a page specification so far as is possible in the absence of
|
||||||
the actual document. Result is true if valid. */
|
the actual document. Result is true if valid.
|
||||||
function validatePagespec(pagespec)
|
@arg {string} pagespec Page specification
|
||||||
|
@return {boolean} validity or otherwise of page specification */
|
||||||
|
function validatePagespec(pagespec) {}
|
||||||
|
|
||||||
/** Builds a page specification from a page range. For example, the range
|
/** Builds a page specification from a page range. For example, the range
|
||||||
containing 1,2,3,6,7,8 in a document of 8 pages might yield "1-3,6-end" */
|
containing 1,2,3,6,7,8 in a document of 8 pages might yield "1-3,6-end"
|
||||||
function stringOfPagespec(pdf, r)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {array} r Page range
|
||||||
|
@return {string} Page specifcation */
|
||||||
|
function stringOfPagespec(pdf, r) {}
|
||||||
|
|
||||||
/** Creates a range with no pages in. */
|
/** Creates a range with no pages in.
|
||||||
function blankRange()
|
@return {array} Page range */
|
||||||
|
function blankRange() {}
|
||||||
|
|
||||||
/** Builds a range from one page to another inclusive. For example, range(3,7)
|
/** Builds a range from one page to another inclusive. For example, range(3,7)
|
||||||
gives the range 3,4,5,6,7 */
|
gives the range 3,4,5,6,7
|
||||||
function range(f, t)
|
@arg {number} f begining of page range
|
||||||
|
@arg {number} t end of page range
|
||||||
|
@return {array} page range */
|
||||||
|
function range(f, t) {}
|
||||||
|
|
||||||
/** The range containing all the pages in a given document. */
|
/** The range containing all the pages in a given document.
|
||||||
function all(pdf)
|
@arg {pdf} pdf PDF document
|
||||||
|
@return {array} page range */
|
||||||
|
function all(pdf) {}
|
||||||
|
|
||||||
/** Makes a range which contains just the even pages of another range. */
|
/** Makes a range which contains just the even pages of another range.
|
||||||
function even(r_in)
|
@arg {array} r_in page range
|
||||||
|
@return {array} page range */
|
||||||
|
function even(r_in) {}
|
||||||
|
|
||||||
/** Makes a range which contains just the odd pages of another range. */
|
/** Makes a range which contains just the odd pages of another range.
|
||||||
function odd(r_in)
|
@arg {array} r_in page range
|
||||||
|
@return {array} page range */
|
||||||
|
function odd(r_in) {}
|
||||||
|
|
||||||
/** Makes the union of two ranges giving a range containing the pages in range
|
/** Makes the union of two ranges giving a range containing the pages in range
|
||||||
a and range b. */
|
a and range b.
|
||||||
function rangeUnion(a, b)
|
@arg {array} a page range
|
||||||
|
@arg {array} b page range
|
||||||
|
@return {array} page range */
|
||||||
|
function rangeUnion(a, b) {}
|
||||||
|
|
||||||
/** Makes the difference of two ranges, giving a range containing all the
|
/** Makes the difference of two ranges, giving a range containing all the
|
||||||
pages in a except for those which are also in b. */
|
pages in a except for those which are also in b.
|
||||||
function difference(a, b)
|
@arg {array} a page range
|
||||||
|
@arg {array} b page range
|
||||||
|
@return {array} page range */
|
||||||
|
function difference(a, b) {}
|
||||||
|
|
||||||
/** Deduplicates a range, making a new one. */
|
/** Deduplicates a range, making a new one.
|
||||||
function removeDuplicates(a)
|
@arg {array} a page range
|
||||||
|
@return {array} page range */
|
||||||
|
function removeDuplicates(a) {}
|
||||||
|
|
||||||
/** Gives the number of pages in a range. */
|
/** Gives the number of pages in a range.
|
||||||
function rangeLength(r)
|
@arg {array} r page range
|
||||||
|
@return {number} length */
|
||||||
|
function rangeLength(r) {}
|
||||||
|
|
||||||
/** Gets the page number at position n in a range, where n runs from 0 to
|
/** Gets the page number at position n in a range, where n runs from 0 to
|
||||||
rangeLength - 1. */
|
rangeLength - 1.
|
||||||
function rangeGet(r, n)
|
@arg {array} r page range
|
||||||
|
@arg {number} n position
|
||||||
|
@return {number} page at given position */
|
||||||
|
function rangeGet(r, n) {}
|
||||||
|
|
||||||
/** Adds the page to a range, if it is not already there. */
|
/** Adds the page to a range, if it is not already there.
|
||||||
function rangeAdd(r, page)
|
@arg {array} r page range
|
||||||
|
@arg {number} page page number */
|
||||||
|
function rangeAdd(r, page) {}
|
||||||
|
|
||||||
/** Returns true if the page is in the range, false otherwise. */
|
/** Returns true if the page is in the range, false otherwise.
|
||||||
function isInRange(r, page)
|
@arg {array} r page range
|
||||||
|
@arg {number} page page number
|
||||||
|
@return {boolean} true if page in range, false otherwise */
|
||||||
|
function isInRange(r, page) {}
|
||||||
|
|
||||||
/** Returns the number of pages in a PDF. */
|
/** Returns the number of pages in a PDF.
|
||||||
function pages(pdf)
|
@arg {pdf} pdf PDF document
|
||||||
|
@return {number} number of pages */
|
||||||
|
function pages(pdf) {}
|
||||||
|
|
||||||
/** Returns the number of pages in a given PDF, with given user password. It
|
/** Returns the number of pages in a given PDF, with given user password. It
|
||||||
tries to do this as fast as possible, without loading the whole file. */
|
tries to do this as fast as possible, without loading the whole file.
|
||||||
function pagesFast(password, filename)
|
@arg {string} password user password
|
||||||
|
@arg {string} filename file name
|
||||||
|
@return {number} number of pages */
|
||||||
|
function pagesFast(password, filename) {}
|
||||||
|
|
||||||
|
/** Returns the number of pages in a given PDF, with given user password. It
|
||||||
|
tries to do this as fast as possible, without loading the whole file.
|
||||||
|
@arg {string} password user password
|
||||||
|
@arg {Uint8Array} data PDF file as a byte array
|
||||||
|
@return {number} number of pages */
|
||||||
|
function pagesFastMemory(password, data) {}
|
||||||
|
|
||||||
/** Writes the file to a given filename. If linearize is true, it will be
|
/** Writes the file to a given filename. If linearize is true, it will be
|
||||||
linearized if a linearizer is available. If make_id is true, it will be
|
linearized if a linearizer is available. If make_id is true, it will be
|
||||||
given a new ID. */
|
given a new ID.
|
||||||
function toFile(pdf, filename, linearize, make_id)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {string} filename file name
|
||||||
|
@arg {boolean} linearize linearize if a linearizer is available
|
||||||
|
@arg {boolean} make_id make a new /ID */
|
||||||
|
function toFile(pdf, filename, linearize, make_id) {}
|
||||||
|
|
||||||
/** Writes the file to a given filename. If make_id is true, it will be given
|
/** Writes the file to a given filename. If make_id is true, it will be given
|
||||||
a new ID. If preserve_objstm is true, existing object streams will be
|
a new ID. If preserve_objstm is true, existing object streams will be
|
||||||
preserved. If generate_objstm is true, object streams will be generated even if
|
preserved. If generate_objstm is true, object streams will be generated even if
|
||||||
not originally present. If compress_objstm is true, object streams will be
|
not originally present. If compress_objstm is true, object streams will be
|
||||||
compressed (what we usually want). WARNING: the pdf argument will be invalid
|
compressed (what we usually want). WARNING: the pdf argument will be invalid
|
||||||
after this call, and should be not be used again. */
|
after this call, and should be not be used again.
|
||||||
function toFileExt(pdf, filename, linearize, make_id, preserve_objstm,
|
@arg {pdf} pdf PDF document
|
||||||
create_objstm, compress_objstm)
|
@arg {string} filename file name
|
||||||
|
@arg {boolean} linearize linearize if a linearizer is available
|
||||||
|
@arg {boolean} preserve_objstm preserve existing object streams
|
||||||
|
@arg {boolean} generate_objstm create new object streams
|
||||||
|
@arg {boolean} compress_objstm compress new object streams */
|
||||||
|
function toFileExt(pdf, filename, linearize, make_id, preserve_objstm, generate_objstm, compress_objstm) {}
|
||||||
|
|
||||||
/** Writes a PDF file and returns as an array of bytes. */
|
/** Writes a PDF file and returns as an array of bytes.
|
||||||
function toMemory(pdf, linearize, make_id)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {boolean} linearize linearize if a linearizer is available
|
||||||
|
@arg {boolean} make_id make a new /ID
|
||||||
|
@result {Uint8Array} PDF document as an array of bytes */
|
||||||
|
function toMemory(pdf, linearize, make_id) {}
|
||||||
|
|
||||||
/** Returns true if a document is encrypted, false otherwise. */
|
/** Writes the file to memory. If make_id is true, it will be given
|
||||||
function isEncrypted(pdf)
|
a new ID. If preserve_objstm is true, existing object streams will be
|
||||||
|
preserved. If generate_objstm is true, object streams will be generated even if
|
||||||
|
not originally present. If compress_objstm is true, object streams will be
|
||||||
|
compressed (what we usually want). WARNING: the pdf argument will be invalid
|
||||||
|
after this call, and should be not be used again.
|
||||||
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {boolean} linearize linearize if a linearizer is available
|
||||||
|
@arg {boolean} preserve_objstm preserve existing object streams
|
||||||
|
@arg {boolean} generate_objstm create new object streams
|
||||||
|
@arg {boolean} compress_objstm compress new object streams
|
||||||
|
@result {Uint8Array} PDF file as a byte array */
|
||||||
|
function toMemoryExt(pdf, linearize, make_id, preserve_objstm, generate_objstm, compress_objstm) {}
|
||||||
|
|
||||||
|
/** Returns true if a document is encrypted, false otherwise.
|
||||||
|
@arg {pdf} pdf PDF document
|
||||||
|
@return {boolean} true if document encrypted, false otherwise */
|
||||||
|
function isEncrypted(pdf) {}
|
||||||
|
|
||||||
/** Attempts to decrypt a PDF using the given user password. An exception is
|
/** Attempts to decrypt a PDF using the given user password. An exception is
|
||||||
raised if the decryption fails. */
|
raised if the decryption fails.
|
||||||
function decryptPdf(pdf, userpw)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {string} userpw user password, or empty if none */
|
||||||
|
function decryptPdf(pdf, userpw) {}
|
||||||
|
|
||||||
/** Attempts to decrypt a PDF using the given owner password. Raises an
|
/** Attempts to decrypt a PDF using the given owner password. Raises an
|
||||||
exception if the decryption fails. */
|
exception if the decryption fails.
|
||||||
function decryptPdfOwner(pdf, ownerpw)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {string} ownerpw owner password, or empty if none */
|
||||||
|
function decryptPdfOwner(pdf, ownerpw) {}
|
||||||
|
|
||||||
/** Writes a file as encrypted. */
|
/** Cannot edit the document */
|
||||||
function toFileEncrypted(pdf, encryption_method, permissions, ownerpw, userpw,
|
var noEdit = 0;
|
||||||
linearize, makeid, filename)
|
|
||||||
|
/** Cannot print the document */
|
||||||
|
var noPrint = 1;
|
||||||
|
|
||||||
|
/** Cannot copy the document */
|
||||||
|
var noCopy = 2;
|
||||||
|
|
||||||
|
/** Cannot annotate the document */
|
||||||
|
var noAnnot = 3;
|
||||||
|
|
||||||
|
/** Cannot edit forms in the document */
|
||||||
|
var noForms = 4;
|
||||||
|
|
||||||
|
/** Cannot extract information */
|
||||||
|
var noExtract = 5;
|
||||||
|
|
||||||
|
/** Cannot assemble into a bigger document */
|
||||||
|
var noAssemble = 6;
|
||||||
|
|
||||||
|
/** Cannot print high quality */
|
||||||
|
var noHqPrint = 7;
|
||||||
|
|
||||||
|
/** 40 bit RC4 encryption */
|
||||||
|
var pdf40bit = 0;
|
||||||
|
|
||||||
|
/** 128 bit RC4 encryption */
|
||||||
|
var pdf128bit = 1;
|
||||||
|
|
||||||
|
/** 128 bit AES encryption, do not encrypt metadata */
|
||||||
|
var aes128bitfalse = 2;
|
||||||
|
|
||||||
|
/** 128 bit AES encryption, encrypt metadata */
|
||||||
|
var aes128bittrue = 3;
|
||||||
|
|
||||||
|
/** Deprecated. Do not use for new files */
|
||||||
|
var aes256bitfalse = 4;
|
||||||
|
|
||||||
|
/** Deprecated. Do not use for new files */
|
||||||
|
var aes256bittrue = 5;
|
||||||
|
|
||||||
|
/** 256 bit AES encryption, do not encrypt metadata */
|
||||||
|
var aes256bitisofalse = 6;
|
||||||
|
|
||||||
|
/** 256 bit AES encryption, encrypt metadata */
|
||||||
|
var aes256bitisotrue = 7;
|
||||||
|
|
||||||
|
/** Writes a file as encrypted.
|
||||||
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {"encryption method"} encryption_method encryption method
|
||||||
|
@arg {"permission array"} array of permissions
|
||||||
|
@arg {string} ownerpw owner password
|
||||||
|
@arg {string} userpw user password
|
||||||
|
@arg {boolean} linearize linearize if a linearizer is available
|
||||||
|
@arg {boolean} makeid make a new /ID
|
||||||
|
@arg {string} filename file name */
|
||||||
|
function toFileEncrypted(pdf, encryption_method, permissions, ownerpw, userpw, linearize, makeid, filename) {}
|
||||||
|
|
||||||
|
/** Writes to memory as encrypted.
|
||||||
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {"encryption method"} encryption_method encryption method
|
||||||
|
@arg {"permission array"} array of permissions
|
||||||
|
@arg {string} ownerpw owner password
|
||||||
|
@arg {string} userpw user password
|
||||||
|
@arg {boolean} linearize linearize if a linearizer is available
|
||||||
|
@arg {boolean} makeid make a new /ID
|
||||||
|
@return {Uint8Array} PDF file as a byte array */
|
||||||
|
function toMemoryEncrypted(pdf, encryption_method, permissions, ownerpw, userpw, linearize, makeid) {}
|
||||||
|
|
||||||
/** Writes a file as encrypted with extra parameters. WARNING: the pdf argument
|
/** Writes a file as encrypted with extra parameters. WARNING: the pdf argument
|
||||||
will be invalid after this call, and should not be used again. */
|
will be invalid after this call, and should not be used again.
|
||||||
function toFileEncryptedExt(pdf, encryption_method, permissions, ownerpw, userpw,
|
@arg {pdf} pdf PDF document
|
||||||
linearize, makeid, preserve_objstm, generate_objstm,
|
@arg {"encryption method"} encryption_method encryption method
|
||||||
compress_objstm, filename)
|
@arg {"permission array"} array of permissions
|
||||||
|
@arg {string} ownerpw owner password
|
||||||
|
@arg {string} userpw user password
|
||||||
|
@arg {boolean} linearize linearize if a linearizer is available
|
||||||
|
@arg {boolean} makeid make a new /ID
|
||||||
|
@arg {boolean} preserve_objstm preserve existing object streams
|
||||||
|
@arg {boolean} generate_objstm generate new object streams
|
||||||
|
@arg {boolean} compress_objstm compress object streams
|
||||||
|
@arg {string} filename file name */
|
||||||
|
function toFileEncryptedExt(pdf, encryption_method, permissions, ownerpw, userpw, linearize, makeid, preserve_objstm, generate_objstm, compress_objstm, filename) {}
|
||||||
|
|
||||||
/** Returns true if the given permission (restriction) is present. */
|
/** Writes a file as encrypted with extra parameters. WARNING: the pdf argument
|
||||||
function hasPermission(pdf, permission)
|
will be invalid after this call, and should not be used again.
|
||||||
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {"encryption method"} encryption_method encryption method
|
||||||
|
@arg {"permission array"} array of permissions
|
||||||
|
@arg {string} ownerpw owner password
|
||||||
|
@arg {string} userpw user password
|
||||||
|
@arg {boolean} linearize linearize if a linearizer is available
|
||||||
|
@arg {boolean} makeid make a new /ID
|
||||||
|
@arg {boolean} preserve_objstm preserve existing object streams
|
||||||
|
@arg {boolean} generate_objstm generate new object streams
|
||||||
|
@arg {boolean} compress_objstm compress object streams
|
||||||
|
@return {Uint8Array} PDF file as a byte array */
|
||||||
|
function toMemoryEncryptedExt(pdf, encryption_method, permissions, ownerpw, userpw, linearize, makeid, preserve_objstm, generate_objstm, compress_objstm) {}
|
||||||
|
|
||||||
|
/** Returns true if the given permission (restriction) is present.
|
||||||
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {permission} permission permission
|
||||||
|
@return {boolean} true if permission present */
|
||||||
|
function hasPermission(pdf, permission) {}
|
||||||
|
|
||||||
|
/** Returns the encryption method currently in use on a document.
|
||||||
|
@arg {pdf} pdf PDF document
|
||||||
|
@return {"encryption method"} encryption method */
|
||||||
|
function encryptionKind(pdf) {}
|
||||||
|
|
||||||
/** Returns the encryption method currently in use on a document. */
|
|
||||||
function encryptionKind(pdf)
|
|
||||||
|
|
|
@ -1,19 +1,31 @@
|
||||||
// CHAPTER 2. Merging and Splitting
|
// CHAPTER 2. Merging and Splitting
|
||||||
|
|
||||||
/** Given a list of PDFs, merges the files into a new one, which is returned. */
|
/** Given a list of PDFs, merges the files into a new one, which is returned.
|
||||||
function mergeSimple(pdfs)
|
@arg {"array of pdfs"} pdfs array of PDF documents to merge
|
||||||
|
@return {pdf} merged PDF document */
|
||||||
|
function mergeSimple(pdfs) {}
|
||||||
|
|
||||||
/** Merges the PDFs. If retain_numbering is true page labels are not
|
/** Merges the PDFs. If retain_numbering is true page labels are not
|
||||||
rewritten. If remove_duplicate_fonts is true, duplicate fonts are merged.
|
rewritten. If remove_duplicate_fonts is true, duplicate fonts are merged.
|
||||||
This is useful when the source documents for merging originate from the same
|
This is useful when the source documents for merging originate from the same
|
||||||
source. */
|
source.
|
||||||
function merge(pdfs, retain_numbering, remove_duplicate_fonts)
|
@arg {"array of pdfs"} pdfs array of PDF documents to merge
|
||||||
|
@arg {boolean} retain_numbering keep page numbering
|
||||||
|
@arg {boolean} remove_duplicate_fonts remove duplicate font data */
|
||||||
|
function merge(pdfs, retain_numbering, remove_duplicate_fonts) {}
|
||||||
|
|
||||||
/** The same as merge, except that it has an additional argument - a list of
|
/** The same as merge, except that it has an additional argument - a list of
|
||||||
page ranges. This is used to select the pages to pick from each PDF. This
|
page ranges. This is used to select the pages to pick from each PDF. This
|
||||||
avoids duplication of information when multiple discrete parts of a source PDF
|
avoids duplication of information when multiple discrete parts of a source PDF
|
||||||
are included. */
|
are included.
|
||||||
function mergeSame(pdfs, retain_numbering, remove_duplicate_fonts, ranges)
|
@arg {"array of pdfs"} pdfs array of PDF documents to merge
|
||||||
|
@arg {boolean} retain_numbering keep page numbering
|
||||||
|
@arg {boolean} remove_duplicate_fonts remove duplicate font data
|
||||||
|
@arg {"array of arrays of numbers"} ranges page ranges, one for each input PDF */
|
||||||
|
function mergeSame(pdfs, retain_numbering, remove_duplicate_fonts, ranges) {}
|
||||||
|
|
||||||
|
/** Returns a new document with just those pages in the page range.
|
||||||
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {range} page range */
|
||||||
|
function selectPages(pdf, r) {}
|
||||||
|
|
||||||
/** Returns a new document with just those pages in the page range. */
|
|
||||||
function selectPages(pdf, r)
|
|
||||||
|
|
|
@ -1,67 +1,233 @@
|
||||||
// CHAPTER 3. Pages
|
// CHAPTER 3. Pages
|
||||||
|
|
||||||
/** Scales the page dimensions and content by the given scale, about (0, 0).
|
/** Scales the page dimensions and content by the given scale, about (0, 0).
|
||||||
Other boxes (crop etc. are altered as appropriate) */
|
Other boxes (crop etc. are altered as appropriate)
|
||||||
function scalePages(pdf, range, sx, sy)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {range} range page range
|
||||||
|
@arg {number} sx x scale
|
||||||
|
@arg {number} sy y scale */
|
||||||
|
function scalePages(pdf, range, sx, sy) {}
|
||||||
|
|
||||||
/** Scales the content to fit new page dimensions (width x height) multiplied
|
/** Scales the content to fit new page dimensions (width x height) multiplied
|
||||||
by scale (typically 1.0). Other boxes (crop etc. are altered as appropriate). */
|
by scale (typically 1.0). Other boxes (crop etc. are altered as appropriate).
|
||||||
function scaleToFit(pdf, range, sx, sy, scale)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {range} range page range
|
||||||
|
@arg {number} sx x scale
|
||||||
|
@arg {number} sy y scale
|
||||||
|
@arg {number} scale scale */
|
||||||
|
function scaleToFit(pdf, range, sx, sy, scale) {}
|
||||||
|
|
||||||
|
/** A0 Portrait paper */
|
||||||
|
var a0portrait = 0;
|
||||||
|
|
||||||
|
/** A1 Portrait paper */
|
||||||
|
var a1portrait = 1;
|
||||||
|
|
||||||
|
/** A2 Portrait paper */
|
||||||
|
var a2portrait = 2;
|
||||||
|
|
||||||
|
/** A3 Portrait paper */
|
||||||
|
var a3portrait = 3;
|
||||||
|
|
||||||
|
/** A4 Portrait paper */
|
||||||
|
var a4portrait = 4;
|
||||||
|
|
||||||
|
/** A5 Portrait paper */
|
||||||
|
var a5portrait = 5;
|
||||||
|
|
||||||
|
/** A0 Landscape paper */
|
||||||
|
var a0landscape = 6;
|
||||||
|
|
||||||
|
/** A1 Landscape paper */
|
||||||
|
var a1landscape = 7;
|
||||||
|
|
||||||
|
/** A2 Landscape paper */
|
||||||
|
var a2landscape = 8;
|
||||||
|
|
||||||
|
/** A3 Landscape paper */
|
||||||
|
var a3landscape = 9;
|
||||||
|
|
||||||
|
/** A4 Landscape paper */
|
||||||
|
var a4landscape = 10;
|
||||||
|
|
||||||
|
/** A5 Landscape paper */
|
||||||
|
var a5landscape = 11;
|
||||||
|
|
||||||
|
/** US Letter Portrait paper */
|
||||||
|
var usletterportrait = 12;
|
||||||
|
|
||||||
|
/** US Letter Landscape paper */
|
||||||
|
var usletterlandscape = 13;
|
||||||
|
|
||||||
|
/** US Legal Portrait paper */
|
||||||
|
var uslegalportrait = 14;
|
||||||
|
|
||||||
|
/** US Legal Landscape paper */
|
||||||
|
var uslegallandscape = 15;
|
||||||
|
|
||||||
/** Scales the page content to fit the given page size, possibly multiplied by
|
/** Scales the page content to fit the given page size, possibly multiplied by
|
||||||
scale (typically 1.0) */
|
scale (typically 1.0)
|
||||||
function scaleToFitPaper(pdf, range, papersize, s)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {range} range page range
|
||||||
|
@arg {"paper size"} papersize paper size
|
||||||
|
@arg {number} s scale */
|
||||||
|
function scaleToFitPaper(pdf, range, papersize, s) {}
|
||||||
|
|
||||||
|
/** Positions on the page. Used for scaling about a point, and adding text.
|
||||||
|
|
||||||
|
A position is an anchor and zero or one or two parameters.
|
||||||
|
|
||||||
|
posCentre: Two parameters, x and y<br/>
|
||||||
|
posLeft: Two parameters, x and y<br/>
|
||||||
|
posRight: Two parameters, x and y<br/>
|
||||||
|
top: One parameter - distance from top<br/>
|
||||||
|
topLeft: One parameter - distance from top left<br/>
|
||||||
|
topRight: One parameter - distance from top right<br/>
|
||||||
|
left: One parameter - distance from left middle<br/>
|
||||||
|
bottomLeft: One parameter - distance from bottom left<br/>
|
||||||
|
bottom: One parameter - distance from bottom<br/>
|
||||||
|
bottomRight: One parameter - distance from bottom right<br/>
|
||||||
|
right: One parameter - distance from right<br/>
|
||||||
|
diagonal: Zero parameters<br/>
|
||||||
|
reverseDiagonal: Zero parameters */
|
||||||
|
|
||||||
|
/** Absolute centre */
|
||||||
|
var posCentre = 0;
|
||||||
|
|
||||||
|
/** Absolute left */
|
||||||
|
var posLeft = 1;
|
||||||
|
|
||||||
|
/** Absolute right */
|
||||||
|
var posRight = 2;
|
||||||
|
|
||||||
|
/** The top centre of the page */
|
||||||
|
var top = 3;
|
||||||
|
|
||||||
|
/** The top left of the page */
|
||||||
|
var topLeft = 4;
|
||||||
|
|
||||||
|
/** The top right of the page */
|
||||||
|
var topRight = 5;
|
||||||
|
|
||||||
|
/** The left hand side of the page, halfway down */
|
||||||
|
var left = 6;
|
||||||
|
|
||||||
|
/** The bottom left of the page */
|
||||||
|
var bottomLeft = 7;
|
||||||
|
|
||||||
|
/** The bottom middle of the page */
|
||||||
|
var bottom = 8;
|
||||||
|
|
||||||
|
/** The bottom right of the page */
|
||||||
|
var bottomRight = 9;
|
||||||
|
|
||||||
|
/** The right hand side of the page, halfway down */
|
||||||
|
var right = 10;
|
||||||
|
|
||||||
|
/** Diagonal, bottom left to top right */
|
||||||
|
var diagonal = 11;
|
||||||
|
|
||||||
|
/** Diagonal, top left to bottom right */
|
||||||
|
var reversediagonal = 12;
|
||||||
|
|
||||||
/** Scales the contents of the pages in the range about the point given by
|
/** Scales the contents of the pages in the range about the point given by
|
||||||
the position, by the scale given. */
|
the position, by the scale given.
|
||||||
function scaleContents(pdf, range, position, scale)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {range} range page range
|
||||||
|
@arg {anchor} anchor anchor to scale contents about
|
||||||
|
@arg {number} p1 position argument 1
|
||||||
|
@arg {number} p2 position argument 2
|
||||||
|
@arg {number} scale scale */
|
||||||
|
function scaleContents(pdf, range, anchor, p1, p2, scale) {}
|
||||||
|
|
||||||
/** Shifts the content of the pages in the range. */
|
/** Shifts the content of the pages in the range.
|
||||||
function shiftContents(pdf, range, dx, dy)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {range} range page range
|
||||||
|
@arg {number} dx x shift
|
||||||
|
@arg {number} dy y shift */
|
||||||
|
function shiftContents(pdf, range, dx, dy) {}
|
||||||
|
|
||||||
/** Changes the viewing rotation to an absolute value. Appropriate rotations
|
/** Changes the viewing rotation to an absolute value. Appropriate rotations
|
||||||
are 0, 90, 180, 270. */
|
are 0, 90, 180, 270.
|
||||||
function rotate(pdf, range, rotation)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {range} range page range
|
||||||
|
@arg {number} rotation rotation */
|
||||||
|
function rotate(pdf, range, rotation) {}
|
||||||
|
|
||||||
/** Rotates the content about the centre of the page by the given number of
|
/** Rotates the content about the centre of the page by the given number of
|
||||||
degrees, in a clockwise direction. */
|
degrees, in a clockwise direction. Appropriate rotations
|
||||||
function rotateBy(pdf, range, rotation)
|
are 0, 90, 180, 270.
|
||||||
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {range} range page range
|
||||||
|
@arg {number} rotation rotation */
|
||||||
|
function rotateBy(pdf, range, rotation) {}
|
||||||
|
|
||||||
/** Rotates the content about the centre of the page by the given number of
|
/** Rotates the content about the centre of the page by the given number of
|
||||||
degrees, in a clockwise direction. */
|
degrees, in a clockwise direction.
|
||||||
function rotateContents(pdf, range, angle)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {range} range page range
|
||||||
|
@arg {number} angle angle */
|
||||||
|
function rotateContents(pdf, range, angle) {}
|
||||||
|
|
||||||
/** Changes the viewing rotation of the pages in the range, counter-rotating
|
/** Changes the viewing rotation of the pages in the range, counter-rotating
|
||||||
the dimensions and content such that there is no visual change. */
|
the dimensions and content such that there is no visual change.
|
||||||
function upright(pdf, range)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {range} range page range */
|
||||||
|
function upright(pdf, range) {}
|
||||||
|
|
||||||
/** Flips horizontally the pages in the range. */
|
/** Flips horizontally the pages in the range.
|
||||||
function hFlip(pdf, range)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {range} range page range */
|
||||||
|
function hFlip(pdf, range) {}
|
||||||
|
|
||||||
/** Flips vertically the pages in the range. */
|
/** Flips vertically the pages in the range.
|
||||||
function vFlip(pdf, range)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {range} range page range */
|
||||||
|
function vFlip(pdf, range) {}
|
||||||
|
|
||||||
/** Crops a page, replacing any existing crop box. The dimensions are in
|
/** Crops a page, replacing any existing crop box. The dimensions are in
|
||||||
points. */
|
points.
|
||||||
function crop(pdf, range, x, y, w, h)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {range} range page range
|
||||||
|
@arg {number} x x position
|
||||||
|
@arg {number} y y position
|
||||||
|
@arg {number} w width
|
||||||
|
@arg {number} h height */
|
||||||
|
function crop(pdf, range, x, y, w, h) {}
|
||||||
|
|
||||||
/** Removes any crop box from pages in the range. */
|
/** Removes any crop box from pages in the range.
|
||||||
function removeCrop(pdf, range)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {range} range page range */
|
||||||
|
function removeCrop(pdf, range) {}
|
||||||
|
|
||||||
/** Removes any trim box from pages in the range. */
|
/** Removes any trim box from pages in the range.
|
||||||
function removeTrim(pdf, range)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {range} range page range */
|
||||||
|
function removeTrim(pdf, range) {}
|
||||||
|
|
||||||
/** Removes any art box from pages in the range. */
|
/** Removes any art box from pages in the range.
|
||||||
function removeArt(pdf, range)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {range} range page range */
|
||||||
|
function removeArt(pdf, range) {}
|
||||||
|
|
||||||
/** Removes any bleed box from pages in the range. */
|
/** Removes any bleed box from pages in the range.
|
||||||
function removeBleed(pdf, range)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {range} range page range */
|
||||||
|
function removeBleed(pdf, range) {}
|
||||||
|
|
||||||
/** Adds trim marks to the given pages, if the trimbox exists. */
|
/** Adds trim marks to the given pages, if the trimbox exists.
|
||||||
function trimMarks(pdf, range)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {range} range page range */
|
||||||
|
function trimMarks(pdf, range) {}
|
||||||
|
|
||||||
/** Shows the boxes on the given pages, for debug. */
|
/** Shows the boxes on the given pages, for debug.
|
||||||
function showBoxes(pdf, range)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {range} range page range */
|
||||||
|
function showBoxes(pdf, range) {}
|
||||||
|
|
||||||
|
/** Makes a given box a 'hard box' i.e clips it explicitly.
|
||||||
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {range} range page range
|
||||||
|
@arg {string} boxname box name */
|
||||||
|
function hardBox(pdf, range, boxname) {}
|
||||||
|
|
||||||
/** Makes a given box a 'hard box' i.e clips it explicitly. */
|
|
||||||
function hardBox(pdf, range, boxname)
|
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
/* CHAPTER 4. Encryption */
|
// CHAPTER 4. Encryption
|
||||||
/* Encryption covered under Chapter 1 in cpdflib. */
|
|
||||||
|
|
|
@ -1,12 +1,16 @@
|
||||||
// CHAPTER 5. Compression
|
// CHAPTER 5. Compression
|
||||||
|
|
||||||
/** Compresses any uncompressed streams in the given PDF using the Flate
|
/** Compresses any uncompressed streams in the given PDF using the Flate
|
||||||
algorithm. */
|
algorithm.
|
||||||
function compress(pdf)
|
@arg {pdf} pdf PDF document */
|
||||||
|
function compress(pdf) {}
|
||||||
|
|
||||||
/** Decompresses any streams in the given PDF, so long as the compression
|
/** Decompresses any streams in the given PDF, so long as the compression
|
||||||
method is supported. */
|
method is supported.
|
||||||
function decompress(pdf)
|
@arg {pdf} pdf PDF document */
|
||||||
|
function decompress(pdf) {}
|
||||||
|
|
||||||
|
/** Squeezes a pdf in memory.
|
||||||
|
@arg {pdf} pdf PDF document */
|
||||||
|
function squeezeInMemory(pdf) {}
|
||||||
|
|
||||||
/** Squeezes a pdf in memory. */
|
|
||||||
function squeezeInMemory(pdf)
|
|
||||||
|
|
|
@ -1,54 +1,86 @@
|
||||||
// CHAPTER 6. Bookmarks
|
// CHAPTER 6. Bookmarks
|
||||||
|
|
||||||
/** Starts the bookmark retrieval process for a given PDF. */
|
/** Starts the bookmark retrieval process for a given PDF.
|
||||||
function startGetBookmarkInfo(pdf)
|
@arg {pdf} pdf PDF document */
|
||||||
|
function startGetBookmarkInfo(pdf) {}
|
||||||
|
|
||||||
/** Gets the number of bookmarks for the PDF given to startGetBookmarkInfo. */
|
/** Gets the number of bookmarks for the PDF given to startGetBookmarkInfo.
|
||||||
function numberBookmarks()
|
@return {number} number of bookmarks */
|
||||||
|
function numberBookmarks() {}
|
||||||
|
|
||||||
/** Gets the bookmark level for the given bookmark (0...(n - 1)). */
|
/** Gets the bookmark level for the given bookmark (0...(n - 1)).
|
||||||
function getBookmarkLevel(n)
|
@arg {number} n serial number
|
||||||
|
@return {number} bookmark level */
|
||||||
|
function getBookmarkLevel(n) {}
|
||||||
|
|
||||||
/** Gets the bookmark target page for the given PDF (which must be the same
|
/** Gets the bookmark target page for the given PDF (which must be the same
|
||||||
as the PDF passed to startSetBookmarkInfo) and bookmark (0...(n - 1)). */
|
as the PDF passed to startSetBookmarkInfo) and bookmark (0...(n - 1)).
|
||||||
function getBookmarkPage(pdf, n)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {number} n serial number
|
||||||
|
@return {number} bookmark page */
|
||||||
|
function getBookmarkPage(pdf, n) {}
|
||||||
|
|
||||||
/** Returns the text of bookmark (0...(n - 1)). */
|
/** Returns the text of bookmark (0...(n - 1)).
|
||||||
function getBookmarkText(n)
|
@arg {number} n serial number
|
||||||
|
@return {string} bookmark text */
|
||||||
|
function getBookmarkText(n) {}
|
||||||
|
|
||||||
/** True if the bookmark is open. */
|
/** True if the bookmark is open.
|
||||||
function getBookmarkOpenStatus(n)
|
@arg {number} n serial number
|
||||||
|
@return {boolean} open status */
|
||||||
|
function getBookmarkOpenStatus(n) {}
|
||||||
|
|
||||||
/** Ends the bookmark retrieval process, cleaning up. */
|
/** Ends the bookmark retrieval process, cleaning up. */
|
||||||
function endGetBookmarkInfo()
|
function endGetBookmarkInfo() {}
|
||||||
|
|
||||||
/** Starts the bookmark setting process for n bookmarks. */
|
/** Starts the bookmark setting process for n bookmarks.
|
||||||
function startSetBookmarkInfo(n)
|
@arg {number} n number of bookmarks required */
|
||||||
|
function startSetBookmarkInfo(n) {}
|
||||||
|
|
||||||
/** Set bookmark level for the given bookmark (0...(n - 1)). */
|
/** Set bookmark level for the given bookmark (0...(n - 1)).
|
||||||
function setBookmarkLevel(a, b)
|
@arg {number} n serial number
|
||||||
|
@arg {number} level bookmark level */
|
||||||
|
function setBookmarkLevel(n, level) {}
|
||||||
|
|
||||||
/** Sets the bookmark target page for the given PDF (which must be the same as
|
/** Sets the bookmark target page for the given PDF (which must be the same as
|
||||||
the PDF to be passed to endSetBookmarkInfo) and bookmark (0...(n - 1)). */
|
the PDF to be passed to endSetBookmarkInfo) and bookmark (0...(n - 1)).
|
||||||
function setBookmarkPage(pdf, a, b)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {number} n serial number
|
||||||
|
@arg {number} targetpage target page */
|
||||||
|
function setBookmarkPage(pdf, n, targetpage) {}
|
||||||
|
|
||||||
/** Sets the open status of bookmark (0...(n - 1)). */
|
/** Sets the open status of bookmark (0...(n - 1)).
|
||||||
function setBookmarkOpenStatus(a, b)
|
@arg {number} n serial number
|
||||||
|
@arg {boolean} status open status */
|
||||||
|
function setBookmarkOpenStatus(n, status) {}
|
||||||
|
|
||||||
/** Sets the text of bookmark (0...(n - 1)). */
|
/** Sets the text of bookmark (0...(n - 1)).
|
||||||
function setBookmarkText(n, t)
|
@arg {number} n serial number
|
||||||
|
@arg {string} text bookmark text */
|
||||||
|
function setBookmarkText(n, text) {}
|
||||||
|
|
||||||
/** Ends the bookmark setting process, writing the bookmarks to the given
|
/** Ends the bookmark setting process, writing the bookmarks to the given
|
||||||
PDF. */
|
PDF.
|
||||||
function endSetBookmarkInfo(pdf)
|
@arg {pdf} pdf PDF document */
|
||||||
|
function endSetBookmarkInfo(pdf) {}
|
||||||
|
|
||||||
/** Returns the bookmark data in JSON format. */
|
/** Returns the bookmark data in JSON format.
|
||||||
function getBookmarksJSON(pdf)
|
@arg {pdf} pdf PDF document
|
||||||
|
@result {Uint8Array} result as a byte array */
|
||||||
|
function getBookmarksJSON(pdf) {}
|
||||||
|
|
||||||
/** Sets the bookmarks from JSON bookmark data. */
|
/** Sets the bookmarks from JSON bookmark data.
|
||||||
function setBookmarksJSON(pdf, data)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {Uint8Array} byte array of JSON bookmark data */
|
||||||
|
function setBookmarksJSON(pdf, data) {}
|
||||||
|
|
||||||
/** Typesets a table of contents from existing bookmarks and prepends it to
|
/** Typesets a table of contents from existing bookmarks and prepends it to
|
||||||
the document. If bookmark is set, the table of contents gets its own
|
the document. If bookmark is set, the table of contents gets its own
|
||||||
bookmark. */
|
bookmark.
|
||||||
function tableOfContents(pdf, font, fontsize, title, bookmark)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {font} font font
|
||||||
|
@arg {number} fontsize font size
|
||||||
|
@arg {string} title title
|
||||||
|
@arg {boolean} bookmark table of contents gets its own bookmark */
|
||||||
|
function tableOfContents(pdf, font, fontsize, title, bookmark) {}
|
||||||
|
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
/* CHAPTER 7. Presentations */
|
// CHAPTER 7. Presentations
|
||||||
/* Not included in the library version. */
|
|
||||||
|
|
|
@ -1,47 +1,150 @@
|
||||||
// CHAPTER 8. Logos, Watermarks and Stamps
|
// CHAPTER 8. Logos, Watermarks and Stamps
|
||||||
|
|
||||||
/** A stamping function with extra features. - isover true, pdf goes over pdf2,
|
/** Stamps stamp_pdf on all the pages in the document which are in the
|
||||||
isover false, pdf goes under pdf2 - scale_stamp_to_fit scales the stamp to fit
|
range. The stamp is placed with its origin at the origin of the target
|
||||||
the page - pos gives the position to put the stamp - relative_to_cropbox: if
|
document.
|
||||||
true, pos is relative to cropbox not mediabox. */
|
@arg {pdf} stamp_pdf stamp
|
||||||
function stampOn(stamp_pdf, pdf, range)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {range} range page range */
|
||||||
|
function stampOn(stamp_pdf, pdf, range) {}
|
||||||
|
|
||||||
/** Stamps stamp_pdf under all the pages in the document which are in the
|
/** Stamps stamp_pdf under all the pages in the document which are in the
|
||||||
range. The stamp is placed with its origin at the origin of the target
|
range. The stamp is placed with its origin at the origin of the target
|
||||||
document. */
|
document.
|
||||||
function stampUnder(stamp_pdf, pdf, range)
|
@arg {pdf} stamp_pdf stamp
|
||||||
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {range} range page range */
|
||||||
|
function stampUnder(stamp_pdf, pdf, range) {}
|
||||||
|
|
||||||
/** A stamping function with extra features. - isover true, pdf goes over
|
/** A stamping function with extra features.
|
||||||
pdf2, isover false, pdf goes under pdf2 - scale_stamp_to_fit scales the
|
@arg {pdf} pdf first PDF document
|
||||||
stamp to fit the page - pos gives the position to put the stamp -
|
@arg {pdf} pdf second PDF document
|
||||||
relative_to_cropbox: if true, pos is relative to cropbox not mediabox. */
|
@arg {boolean} isover pdf goes over pdf2, otherwise under
|
||||||
function stampExtended(pdf, pdf2, range, isover, scale_stamp_to_fit, position,
|
@arg {boolean} scale_stamp_to_fit scales the stamp to fit the page
|
||||||
relative_to_cropbox)
|
@arg {anchor} anchor for position of stamp
|
||||||
|
@arg {number} p1 position argument 1
|
||||||
|
@arg {number} p2 position argument 2
|
||||||
|
@arg {boolean} relative_to_cropbox pos is relative to cropbox not mediabox. */
|
||||||
|
function stampExtended(pdf, pdf2, range, isover, scale_stamp_to_fit, position, relative_to_cropbox) {}
|
||||||
|
|
||||||
/** Combines the PDFs page-by-page, putting each page of 'over' over each page
|
/** Combines the PDFs page-by-page, putting each page of 'over' over each page
|
||||||
of 'under'. */
|
of 'under'.
|
||||||
function combinePages(under, over)
|
@arg {pdf} under PDF document
|
||||||
|
@arg {pdf} over PDF document
|
||||||
|
@result {pdf} resultant PDF document */
|
||||||
|
function combinePages(under, over) {}
|
||||||
|
|
||||||
/** Adds text to the pages in the given range. */
|
/** Times Roman */
|
||||||
function addText(metrics, pdf, range, text, position, linespacing,
|
var timesRoman = 0;
|
||||||
bates, font, fontsize, r, g, b, underneath, relative_to_cropbox,
|
|
||||||
outline, opacity, justification, midline, topline, filename,
|
|
||||||
linewidth, embed_fonts)
|
|
||||||
|
|
||||||
/** Adds text with most parameters default. */
|
/** Times Bold */
|
||||||
function addTextSimple(pdf, range, text, position, font, fontsize)
|
var timesBold = 1;
|
||||||
|
|
||||||
/** Removes any text added by cpdf from the given pages. */
|
/** Times Italic */
|
||||||
function removeText(pdf, range)
|
var timesItalic = 2;
|
||||||
|
|
||||||
|
/** Times Bold Italic */
|
||||||
|
var timesBoldItalic = 3;
|
||||||
|
|
||||||
|
/** Helvetica */
|
||||||
|
var helvetica = 4;
|
||||||
|
|
||||||
|
/** Helvetica Bold */
|
||||||
|
var helveticaBold = 5;
|
||||||
|
|
||||||
|
/** Helvetica Oblique */
|
||||||
|
var helveticaOblique = 6;
|
||||||
|
|
||||||
|
/** Helvetica Bold Oblique */
|
||||||
|
var helveticaBoldOblique = 7;
|
||||||
|
|
||||||
|
/** Courier */
|
||||||
|
var courier = 8;
|
||||||
|
|
||||||
|
/** Courier Bold */
|
||||||
|
var courierBold = 9;
|
||||||
|
|
||||||
|
/** Courier Oblique */
|
||||||
|
var courierOblique = 10;
|
||||||
|
|
||||||
|
/** Courier Bold Oblique */
|
||||||
|
var courierBoldOblique = 11;
|
||||||
|
|
||||||
|
/** Left justify */
|
||||||
|
var leftJustify = 0;
|
||||||
|
|
||||||
|
/** Centre justify */
|
||||||
|
var centreJustify = 1;
|
||||||
|
|
||||||
|
/** Right justify */
|
||||||
|
var rightJustify = 2;
|
||||||
|
|
||||||
|
/** Adds text to the pages in the given range.
|
||||||
|
@arg {boolean} metrics collect metrics only
|
||||||
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {range} range page range
|
||||||
|
@arg {string} text text to add \\n for newline
|
||||||
|
@arg {anchor} anchor anchor to add text at
|
||||||
|
@arg {number} p1 position argument 1
|
||||||
|
@arg {number} p2 position argument 2
|
||||||
|
@arg {number} linespacing line spacing
|
||||||
|
@arg {number} bates starting bates number
|
||||||
|
@arg {font} font font
|
||||||
|
@arg {number} fontsize font size
|
||||||
|
@arg {number} r red component of colour 0..1
|
||||||
|
@arg {number} g green component of colour 0..1
|
||||||
|
@arg {number} b blue component of colour 0..1
|
||||||
|
@arg {boolean} underneath put text under the page rather than over
|
||||||
|
@arg {boolean} relative_to_cropbox position is relative to crop box not media box
|
||||||
|
@arg {boolean} outline text is outline
|
||||||
|
@arg {number} opacity opacity 0..1
|
||||||
|
@arg {justification} justification justification
|
||||||
|
@arg {boolean} midline position is relative to midline not baseline
|
||||||
|
@arg {boolean} topline position is relative to topline not baseline
|
||||||
|
@arg {string} filename file name
|
||||||
|
@arg {number} linewidth line width
|
||||||
|
@arg {boolean} embed_fonts add font information
|
||||||
|
*/
|
||||||
|
function addText(metrics, pdf, range, text, anchor, p1, p2, linespacing,
|
||||||
|
bates, font, fontsize, r, g, b, underneath, relative_to_cropbox, outline,
|
||||||
|
opacity, justification, midline, topline, filename, linewidth, embed_fonts) {}
|
||||||
|
|
||||||
|
/** Adds text with most parameters default.
|
||||||
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {range} range page range
|
||||||
|
@arg {string} text text to add. \\n for newline
|
||||||
|
@arg {anchor} anchor anchor to add text at
|
||||||
|
@arg {number} p1 position argument 1
|
||||||
|
@arg {number} p2 position argument 2
|
||||||
|
@arg {font} font font
|
||||||
|
@arg {number} fontsize font size */
|
||||||
|
function addTextSimple(pdf, range, text, anchor, p1, p2, font, fontsize) {}
|
||||||
|
|
||||||
|
/** Removes any text added by cpdf from the given pages.
|
||||||
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {range} range page range */
|
||||||
|
function removeText(pdf, range) {}
|
||||||
|
|
||||||
/** Returns the width of a given string in the given font in thousandths of a
|
/** Returns the width of a given string in the given font in thousandths of a
|
||||||
point. */
|
point.
|
||||||
function textWidth(font, text)
|
@arg {font} font font
|
||||||
|
@arg {string} text text
|
||||||
|
@result {number} width */
|
||||||
|
function textWidth(font, text) {}
|
||||||
|
|
||||||
/** Adds page content before (if true) or after (if false) the existing
|
/** Adds page content before (if true) or after (if false) the existing
|
||||||
content to pages in the given range in the given PDF. */
|
content to pages in the given range in the given PDF.
|
||||||
function addContent(content, before, pdf, range)
|
@arg {string} content content to add
|
||||||
|
@arg {boolean} before rather than after
|
||||||
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {range} range page range */
|
||||||
|
function addContent(content, before, pdf, range) {}
|
||||||
|
|
||||||
/** Stamps stamp_pdf onto the pages in the given range in pdf as a shared Form
|
/** Stamps stamp_pdf onto the pages in the given range in pdf as a shared Form
|
||||||
XObject. The name of the newly-created XObject is returned. */
|
XObject. The name of the newly-created XObject is returned.
|
||||||
function stampAsXObject(pdf, range, stamp_pdf)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {range} range page range
|
||||||
|
@arg {pdf} stamp_pdf stamp pdf
|
||||||
|
@result {string} name of XObject */
|
||||||
|
function stampAsXObject(pdf, range, stamp_pdf) {}
|
||||||
|
|
||||||
|
|
|
@ -4,30 +4,53 @@
|
||||||
page of size x * y. This is controlled by fit. Columns imposes by columns
|
page of size x * y. This is controlled by fit. Columns imposes by columns
|
||||||
rather than rows. rtl is right-to-left, btt bottom-to-top. Center is unused
|
rather than rows. rtl is right-to-left, btt bottom-to-top. Center is unused
|
||||||
for now. Margin is the margin around the output, spacing the spacing between
|
for now. Margin is the margin around the output, spacing the spacing between
|
||||||
imposed inputs. */
|
imposed inputs.
|
||||||
function impose(pdf, x, y, fit, columns, rtl, btt, center, margin, spacing, linewidth)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {number} x (explained above)
|
||||||
|
@arg {number} y (explained above)
|
||||||
|
@arg {boolean} fit (explained above)
|
||||||
|
@arg {boolean} rtl impose right to left
|
||||||
|
@arg {boolean} btt impose bottom to top
|
||||||
|
@arg {boolean} center unused
|
||||||
|
@arg {number} margin margin around output pages
|
||||||
|
@arg {number} spacing spacing between imposed pages
|
||||||
|
@arg {number} linewidth line width */
|
||||||
|
function impose(pdf, x, y, fit, columns, rtl, btt, center, margin, spacing, linewidth) {}
|
||||||
|
|
||||||
/** Imposes a document two up. twoUp does so by shrinking the page size, to fit
|
/** Imposes a document two up. twoUp does so by shrinking the page size, to fit
|
||||||
two pages on one. */
|
two pages on one.
|
||||||
function twoUp(pdf)
|
@arg {pdf} pdf PDF document */
|
||||||
|
function twoUp(pdf) {}
|
||||||
|
|
||||||
/** Impose a document two up. twoUpStack does so by doubling the page size,
|
/** Impose a document two up. twoUpStack does so by doubling the page size,
|
||||||
to fit two pages on one. */
|
to fit two pages on one.
|
||||||
function twoUpStack(pdf)
|
@arg {pdf} pdf PDF document */
|
||||||
|
function twoUpStack(pdf) {}
|
||||||
|
|
||||||
/** Adds a blank page before each page in the given range. */
|
/** Adds a blank page before each page in the given range.
|
||||||
function padBefore(pdf, range)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {range} range page range */
|
||||||
|
function padBefore(pdf, range) {}
|
||||||
|
|
||||||
/** Adds a blank page after every n pages. */
|
/** Adds a blank page after every n pages.
|
||||||
function padAfter(pdf, range)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {range} range page range */
|
||||||
|
function padAfter(pdf, range) {}
|
||||||
|
|
||||||
/** Adds a blank page after every n pages. */
|
/** Adds a blank page after every n pages.
|
||||||
function padEvery(pdf, n)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {number} interval */
|
||||||
|
function padEvery(pdf, n) {}
|
||||||
|
|
||||||
/** Adds pages at the end to pad the file to a multiple of n pages in
|
/** Adds pages at the end to pad the file to a multiple of n pages in
|
||||||
length. */
|
length.
|
||||||
function padMultiple(pdf, n)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {number} multiple to pad to */
|
||||||
|
function padMultiple(pdf, n) {}
|
||||||
|
|
||||||
/** Adds pages at the beginning to pad the file to a multiple of n pages in
|
/** Adds pages at the beginning to pad the file to a multiple of n pages in
|
||||||
length. */
|
length.
|
||||||
function padMultipleBefore(pdf, n)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {number} multiple to pad to */
|
||||||
|
function padMultipleBefore(pdf, n) {}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
// CHAPTER 10. Annotations
|
// CHAPTER 10. Annotations
|
||||||
|
|
||||||
/** Returns the annotations from a PDF in JSON format. */
|
/** Returns the annotations from a PDF in JSON format.
|
||||||
function annotationsJSON(pdf)
|
@arg {pdf} pdf PDF document
|
||||||
|
@return {Uint8Array} results as an array of bytes */
|
||||||
|
function annotationsJSON(pdf) {}
|
||||||
|
|
||||||
|
|
|
@ -1,260 +1,593 @@
|
||||||
// CHAPTER 11. Document Information and Metadata
|
// CHAPTER 11. Document Information and Metadata
|
||||||
|
|
||||||
/** Finds out if a document is linearized as quickly as possible without
|
/** Finds out if a document is linearized as quickly as possible without
|
||||||
loading it. */
|
loading it.
|
||||||
function isLinearized(filename)
|
@arg {string} filename file name
|
||||||
|
@result {boolean} true if linearized */
|
||||||
|
function isLinearized(filename) {}
|
||||||
|
|
||||||
/** Returns the minor version number of a document. */
|
/** Finds out if a document in memory is linearized as quickly as possible without
|
||||||
function getVersion(pdf)
|
loading it.
|
||||||
|
@arg {Uint8Array} PDF file as a byte array
|
||||||
|
@result {boolean} true if linearized */
|
||||||
|
function isLinearizedMemory(data) {}
|
||||||
|
|
||||||
/** Returns the major version number of a document. */
|
/** Returns the minor version number of a document.
|
||||||
function getMajorVersion(pdf)
|
@arg {pdf} pdf PDF document
|
||||||
|
@return {number} version number */
|
||||||
|
function getVersion(pdf) {}
|
||||||
|
|
||||||
/** Returns the title of a document. */
|
/** Returns the major version number of a document.
|
||||||
function getTitle(pdf)
|
@arg {pdf} pdf PDF document
|
||||||
|
@return {number} major version number */
|
||||||
|
function getMajorVersion(pdf) {}
|
||||||
|
|
||||||
/** Returns the author of a document. */
|
/** Returns the title of a document.
|
||||||
function getAuthor(pdf)
|
@arg {pdf} pdf PDF document
|
||||||
|
@return {string} title */
|
||||||
|
function getTitle(pdf) {}
|
||||||
|
|
||||||
/** Returns the subject of a document. */
|
/** Returns the author of a document.
|
||||||
function getSubject(pdf)
|
@arg {pdf} pdf PDF document
|
||||||
|
@return {string} author */
|
||||||
|
function getAuthor(pdf) {}
|
||||||
|
|
||||||
/** Returns the keywords of a document. */
|
/** Returns the subject of a document.
|
||||||
function getKeywords(pdf)
|
@arg {pdf} pdf PDF document
|
||||||
|
@return {string} subject */
|
||||||
|
function getSubject(pdf) {}
|
||||||
|
|
||||||
/** Returns the creator of a document. */
|
/** Returns the keywords of a document.
|
||||||
function getCreator(pdf)
|
@arg {pdf} pdf PDF document
|
||||||
|
@return {string} keywords */
|
||||||
|
function getKeywords(pdf) {}
|
||||||
|
|
||||||
/** Returns the producer of a document. */
|
/** Returns the creator of a document.
|
||||||
function getProducer(pdf)
|
@arg {pdf} pdf PDF document
|
||||||
|
@return {string} creator */
|
||||||
|
function getCreator(pdf) {}
|
||||||
|
|
||||||
/** Returns the creation date of a document. */
|
/** Returns the producer of a document.
|
||||||
function getCreationDate(pdf)
|
@arg {pdf} pdf PDF document
|
||||||
|
@return {string} producer */
|
||||||
|
function getProducer(pdf) {}
|
||||||
|
|
||||||
/** Returns the modification date of a document. */
|
/** Returns the creation date of a document.
|
||||||
function getModificationDate(pdf)
|
@arg {pdf} pdf PDF document
|
||||||
|
@return {string} creation date */
|
||||||
|
function getCreationDate(pdf) {}
|
||||||
|
|
||||||
/** Returns the XMP title of a document. */
|
/** Returns the modification date of a document.
|
||||||
function getTitleXMP(pdf)
|
@arg {pdf} pdf PDF document
|
||||||
|
@return {string} modification date */
|
||||||
|
function getModificationDate(pdf) {}
|
||||||
|
|
||||||
/** Returns the XMP author of a document. */
|
/** Returns the XMP title of a document.
|
||||||
function getAuthorXMP(pdf)
|
@arg {pdf} pdf PDF document
|
||||||
|
@return {string} XMP title */
|
||||||
|
function getTitleXMP(pdf) {}
|
||||||
|
|
||||||
/** Returns the XMP subject of a document. */
|
/** Returns the XMP author of a document.
|
||||||
function getSubjectXMP(pdf)
|
@arg {pdf} pdf PDF document
|
||||||
|
@return {string} XMP author */
|
||||||
|
function getAuthorXMP(pdf) {}
|
||||||
|
|
||||||
/** Returns the XMP keywords of a document. */
|
/** Returns the XMP subject of a document.
|
||||||
function getKeywordsXMP(pdf)
|
@arg {pdf} pdf PDF document
|
||||||
|
@return {string} XMP subject */
|
||||||
|
function getSubjectXMP(pdf) {}
|
||||||
|
|
||||||
/** Returns the XMP creator of a document. */
|
/** Returns the XMP keywords of a document.
|
||||||
function getCreatorXMP(pdf)
|
@arg {pdf} pdf PDF document
|
||||||
|
@return {string} XMP keywords */
|
||||||
|
function getKeywordsXMP(pdf) {}
|
||||||
|
|
||||||
/** Returns the XMP producer of a document. */
|
/** Returns the XMP creator of a document.
|
||||||
function getProducerXMP(pdf)
|
@arg {pdf} pdf PDF document
|
||||||
|
@return {string} XMP creator */
|
||||||
|
function getCreatorXMP(pdf) {}
|
||||||
|
|
||||||
/** Returns the XMP creation date of a document. */
|
/** Returns the XMP producer of a document.
|
||||||
function getCreationDateXMP(pdf)
|
@arg {pdf} pdf PDF document
|
||||||
|
@return {string} XMP producer */
|
||||||
|
function getProducerXMP(pdf) {}
|
||||||
|
|
||||||
/** Returns the XMP modification date of a document. */
|
/** Returns the XMP creation date of a document.
|
||||||
function getModificationDateXMP(pdf)
|
@arg {pdf} pdf PDF document
|
||||||
|
@return {string} XMP creation date */
|
||||||
|
function getCreationDateXMP(pdf) {}
|
||||||
|
|
||||||
/** Sets the title of a document. */
|
/** Returns the XMP modification date of a document.
|
||||||
function setTitle(pdf, s)
|
@arg {pdf} pdf PDF document
|
||||||
|
@return {string} XMP modification date */
|
||||||
|
function getModificationDateXMP(pdf) {}
|
||||||
|
|
||||||
/** Sets the author of a document. */
|
/** Sets the title of a document.
|
||||||
function setAuthor(pdf, s)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {string} s title */
|
||||||
|
function setTitle(pdf, s) {}
|
||||||
|
|
||||||
/** Sets the subject of a document. */
|
/** Sets the author of a document.
|
||||||
function setSubject(pdf, s)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {string} s author */
|
||||||
|
function setAuthor(pdf, s) {}
|
||||||
|
|
||||||
/** Sets the keywords of a document. */
|
/** Sets the subject of a document.
|
||||||
function setKeywords(pdf, s)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {string} s subject */
|
||||||
|
function setSubject(pdf, s) {}
|
||||||
|
|
||||||
/** Sets the creator of a document. */
|
/** Sets the keywords of a document.
|
||||||
function setCreator(pdf, s)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {string} s keywords */
|
||||||
|
function setKeywords(pdf, s) {}
|
||||||
|
|
||||||
/** Sets the producer of a document. */
|
/** Sets the creator of a document.
|
||||||
function setProducer(pdf, s)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {string} s creator */
|
||||||
|
function setCreator(pdf, s) {}
|
||||||
|
|
||||||
/** Sets the creation date of a document. */
|
/** Sets the producer of a document.
|
||||||
function setCreationDate(pdf, s)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {string} s producer */
|
||||||
|
function setProducer(pdf, s) {}
|
||||||
|
|
||||||
/** Sets the modification date of a document. */
|
/** Sets the creation date of a document.
|
||||||
function setModificationDate(pdf, s)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {string} s creation date */
|
||||||
|
function setCreationDate(pdf, s) {}
|
||||||
|
|
||||||
/** Sets the XMP title of a document. */
|
/** Sets the modification date of a document.
|
||||||
function setTitleXMP(pdf, s)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {string} s modification date */
|
||||||
|
function setModificationDate(pdf, s) {}
|
||||||
|
|
||||||
/** Sets the XMP author of a document. */
|
/** Sets the XMP title of a document.
|
||||||
function setAuthorXMP(pdf, s)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {string} s XMP title */
|
||||||
|
function setTitleXMP(pdf, s) {}
|
||||||
|
|
||||||
/** Sets the XMP author of a document. */
|
/** Sets the XMP author of a document.
|
||||||
function setSubjectXMP(pdf, s)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {string} s XMP author */
|
||||||
|
function setAuthorXMP(pdf, s) {}
|
||||||
|
|
||||||
/** Sets the XMP keywords of a document. */
|
/** Sets the XMP author of a document.
|
||||||
function setKeywordsXMP(pdf, s)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {string} s XMP subject */
|
||||||
|
function setSubjectXMP(pdf, s) {}
|
||||||
|
|
||||||
/** Sets the XMP creator of a document. */
|
/** Sets the XMP keywords of a document.
|
||||||
function setCreatorXMP(pdf, s)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {string} s XMP keywords */
|
||||||
|
function setKeywordsXMP(pdf, s) {}
|
||||||
|
|
||||||
/** Sets the XMP producer of a document. */
|
/** Sets the XMP creator of a document.
|
||||||
function setProducerXMP(pdf, s)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {string} s XMP creator */
|
||||||
|
function setCreatorXMP(pdf, s) {}
|
||||||
|
|
||||||
/** Sets the XMP creation date of a document. */
|
/** Sets the XMP producer of a document.
|
||||||
function setCreationDateXMP(pdf, s)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {string} s XMP producer */
|
||||||
|
function setProducerXMP(pdf, s) {}
|
||||||
|
|
||||||
/** Sets the XMP modification date of a document. */
|
/** Sets the XMP creation date of a document.
|
||||||
function setModificationDateXMP(pdf, s)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {string} s XMP creation date */
|
||||||
|
function setCreationDateXMP(pdf, s) {}
|
||||||
|
|
||||||
/** Returns the components from a PDF date string. */
|
/** Sets the XMP modification date of a document.
|
||||||
function getDateComponents(string)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {string} s XMP modification date */
|
||||||
|
function setModificationDateXMP(pdf, s) {}
|
||||||
|
|
||||||
/** Builds a PDF date string from individual components. */
|
/** Returns the components from a PDF date string.
|
||||||
function dateStringOfComponents(y, m, d, h, min, sec, hour_offset, minute_offset)
|
@arg {string} string date string
|
||||||
|
@return {"array of numbers"} date components */
|
||||||
|
function getDateComponents(string) {}
|
||||||
|
|
||||||
/** Gets the viewing rotation for a given page. */
|
/** Builds a PDF date string from individual components.
|
||||||
function getPageRotation(pdf, page)
|
@arg {number} y year
|
||||||
|
@arg {number} m month
|
||||||
|
@arg {number} d day
|
||||||
|
@arg {number} h hour
|
||||||
|
@arg {number} min minute
|
||||||
|
@arg {number} sec second
|
||||||
|
@arg {number} hour_offset hour offset
|
||||||
|
@arg {number} minute_offset minute offset
|
||||||
|
@return {string} date string */
|
||||||
|
function dateStringOfComponents(y, m, d, h, min, sec, hour_offset, minute_offset) {}
|
||||||
|
|
||||||
/** Returns true, if that page has the given box. E.g "/CropBox". */
|
/** Gets the viewing rotation for a given page.
|
||||||
function hasBox(pdf, page, box)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {number} page page number
|
||||||
|
@result {number} page rotation */
|
||||||
|
function getPageRotation(pdf, page) {}
|
||||||
|
|
||||||
|
/** Returns true if that page has the given box. E.g "/CropBox".
|
||||||
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {number} page page number
|
||||||
|
@arg {string} box box name
|
||||||
|
@result {boolean} true if box present */
|
||||||
|
function hasBox(pdf, page, box) {}
|
||||||
|
|
||||||
/** These functions get a box given the document, page number, min x, max x,
|
/** These functions get a box given the document, page number, min x, max x,
|
||||||
min y, max y in points. Only succeeds if such a box exists, as checked by
|
min y, max y in points. Only succeeds if such a box exists, as checked by
|
||||||
hasBox. */
|
hasBox.
|
||||||
function getMediaBox(pdf, pagenumber)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {number} pagenumber page number
|
||||||
|
@return {"array of numbers"} media box */
|
||||||
|
function getMediaBox(pdf, pagenumber) {}
|
||||||
|
|
||||||
/** These functions get a box given the document, page number, min x, max x,
|
/** These functions get a box given the document, page number, min x, max x,
|
||||||
min y, max y in points. Only succeeds if such a box exists, as checked by
|
min y, max y in points. Only succeeds if such a box exists, as checked by
|
||||||
hasBox. */
|
hasBox.
|
||||||
function getCropBox(pdf, pagenumber)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {number} pagenumber page number
|
||||||
|
@return {"array of numbers"} crop box */
|
||||||
|
function getCropBox(pdf, pagenumber) {}
|
||||||
|
|
||||||
/** These functions get a box given the document, page number, min x, max x,
|
/** These functions get a box given the document, page number, min x, max x,
|
||||||
min y, max y in points. Only succeeds if such a box exists, as checked by
|
min y, max y in points. Only succeeds if such a box exists, as checked by
|
||||||
hasBox. */
|
hasBox.
|
||||||
function getArtBox(pdf, pagenumber)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {number} pagenumber page number
|
||||||
|
@return {"array of numbers"} art box */
|
||||||
|
function getArtBox(pdf, pagenumber) {}
|
||||||
|
|
||||||
/** These functions get a box given the document, page number, min x, max x,
|
/** These functions get a box given the document, page number, min x, max x,
|
||||||
min y, max y in points. Only succeeds if such a box exists, as checked by
|
min y, max y in points. Only succeeds if such a box exists, as checked by
|
||||||
hasBox. */
|
hasBox.
|
||||||
function getBleedBox(pdf, pagenumber)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {number} pagenumber page number
|
||||||
|
@return {"array of numbers"} bleed box */
|
||||||
|
function getBleedBox(pdf, pagenumber) {}
|
||||||
|
|
||||||
/** These functions get a box given the document, page number, min x, max x,
|
/** These functions get a box given the document, page number, min x, max x,
|
||||||
min y, max y in points. Only succeeds if such a box exists, as checked by
|
min y, max y in points. Only succeeds if such a box exists, as checked by
|
||||||
hasBox. */
|
hasBox.
|
||||||
function getTrimBox(pdf, pagenumber)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {number} pagenumber page number
|
||||||
|
@return {"array of numbers"} trim box */
|
||||||
|
function getTrimBox(pdf, pagenumber) {}
|
||||||
|
|
||||||
/** These functions set a box given the document, page range, min x, max x,
|
/** These functions set a box given the document, page range, min x, max x,
|
||||||
min y, max y in points. */
|
min y, max y in points.
|
||||||
function setMediabox(pdf, range, minx, maxx, miny, maxy)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {range} range page range
|
||||||
|
@arg {number} minx min x
|
||||||
|
@arg {number} maxx max x
|
||||||
|
@arg {number} minx min y
|
||||||
|
@arg {number} maxx max y */
|
||||||
|
function setMediabox(pdf, range, minx, maxx, miny, maxy) {}
|
||||||
|
|
||||||
/** These functions set a box given the document, page range, min x, max x,
|
/** These functions set a box given the document, page range, min x, max x,
|
||||||
min y, max y in points. */
|
min y, max y in points.
|
||||||
function setCropBox(pdf, range, minx, maxx, miny, maxy)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {range} range page range
|
||||||
|
@arg {number} minx min x
|
||||||
|
@arg {number} maxx max x
|
||||||
|
@arg {number} minx min y
|
||||||
|
@arg {number} maxx max y */
|
||||||
|
function setCropBox(pdf, range, minx, maxx, miny, maxy) {}
|
||||||
|
|
||||||
/** These functions set a box given the document, page range, min x, max x,
|
/** These functions set a box given the document, page range, min x, max x,
|
||||||
min y, max y in points. */
|
min y, max y in points.
|
||||||
function setTrimBox(pdf, range, minx, maxx, miny, maxy)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {range} range page range
|
||||||
|
@arg {number} minx min x
|
||||||
|
@arg {number} maxx max x
|
||||||
|
@arg {number} minx min y
|
||||||
|
@arg {number} maxx max y */
|
||||||
|
function setTrimBox(pdf, range, minx, maxx, miny, maxy) {}
|
||||||
|
|
||||||
/** These functions set a box given the document, page range, min x, max x,
|
/** These functions set a box given the document, page range, min x, max x,
|
||||||
min y, max y in points. */
|
min y, max y in points.
|
||||||
function setBleedBox(pdf, range, minx, maxx, miny, maxy)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {range} range page range
|
||||||
|
@arg {number} minx min x
|
||||||
|
@arg {number} maxx max x
|
||||||
|
@arg {number} minx min y
|
||||||
|
@arg {number} maxx max y */
|
||||||
|
function setBleedBox(pdf, range, minx, maxx, miny, maxy) {}
|
||||||
|
|
||||||
/** These functions set a box given the document, page range, min x, max x,
|
/** These functions set a box given the document, page range, min x, max x,
|
||||||
min y, max y in points. */
|
min y, max y in points.
|
||||||
function setArtBox(pdf, range, minx, maxx, miny, maxy)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {range} range page range
|
||||||
|
@arg {number} minx min x
|
||||||
|
@arg {number} maxx max x
|
||||||
|
@arg {number} minx min y
|
||||||
|
@arg {number} maxx max y */
|
||||||
|
function setArtBox(pdf, range, minx, maxx, miny, maxy) {}
|
||||||
|
|
||||||
/** Marks a document as trapped. */
|
/** Marks a document as trapped.
|
||||||
function markTrapped(pdf)
|
@arg {pdf} pdf PDF document */
|
||||||
|
function markTrapped(pdf) {}
|
||||||
|
|
||||||
/** Marks a document as untrapped. */
|
/** Marks a document as untrapped.
|
||||||
function markUntrapped(pdf)
|
@arg {pdf} pdf PDF document */
|
||||||
|
function markUntrapped(pdf) {}
|
||||||
|
|
||||||
/** Marks a document as trapped in XMP metadata. */
|
/** Marks a document as trapped in XMP metadata.
|
||||||
function markTrappedXMP(pdf)
|
@arg {pdf} pdf PDF document */
|
||||||
|
function markTrappedXMP(pdf) {}
|
||||||
|
|
||||||
/** Marks a document as untrapped in XMP metadata. */
|
/** Marks a document as untrapped in XMP metadata.
|
||||||
function markUntrappedXMP(pdf)
|
@arg {pdf} pdf PDF document */
|
||||||
|
function markUntrappedXMP(pdf) {}
|
||||||
|
|
||||||
|
/** Single page */
|
||||||
|
var singlePage = 0;
|
||||||
|
|
||||||
/** Sets the page layout for a document. */
|
/** One column */
|
||||||
function setPageLayout(pdf, layout)
|
var oneColumn = 1;
|
||||||
|
|
||||||
/** Sets the page mode for a document. */
|
/** Two column left */
|
||||||
function setPageMode(pdf, mode)
|
var twoColumnLeft = 2;
|
||||||
|
|
||||||
/** Sets the hide toolbar flag. */
|
/** Two column right */
|
||||||
function hideToolbar(pdf, flag)
|
var twoColumnRight = 3;
|
||||||
|
|
||||||
/** Sets the hide menubar flag. */
|
/** Two page left */
|
||||||
function hideMenubar(pdf, flag)
|
var twoPageLeft = 4;
|
||||||
|
|
||||||
/** Sets the hide window UI flag. */
|
/** Two page right */
|
||||||
function hideWindowUi(pdf, flag)
|
var twoPageRight = 5;
|
||||||
|
|
||||||
/** Sets the fit window flag. */
|
/** Sets the page layout for a document.
|
||||||
function fitWindow(pdf, flag)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {layout} layout page layout */
|
||||||
|
function setPageLayout(pdf, layout) {}
|
||||||
|
|
||||||
/** Sets the center window flag. */
|
/** Use none */
|
||||||
function centerWindow(pdf, flag)
|
var useNone = 0;
|
||||||
|
|
||||||
/** Sets the display doc title flag. */
|
/** Use outlines */
|
||||||
function displayDocTitle(pdf, flag)
|
var useOutlines = 1;
|
||||||
|
|
||||||
|
/** Use thumbs */
|
||||||
|
var useThumbs = 2;
|
||||||
|
|
||||||
|
/** Use OC */
|
||||||
|
var useOC = 3;
|
||||||
|
|
||||||
|
/** Use attachments */
|
||||||
|
var useAttachments = 4;
|
||||||
|
|
||||||
|
/** Sets the page mode for a document.
|
||||||
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {mode} mode page mode */
|
||||||
|
function setPageMode(pdf, mode) {}
|
||||||
|
|
||||||
|
/** Sets the hide toolbar flag.
|
||||||
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {boolean} flag hide toolbar */
|
||||||
|
function hideToolbar(pdf, flag) {}
|
||||||
|
|
||||||
|
/** Sets the hide menubar flag.
|
||||||
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {boolean} flag hide menubar */
|
||||||
|
function hideMenubar(pdf, flag) {}
|
||||||
|
|
||||||
|
/** Sets the hide window UI flag.
|
||||||
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {boolean} flag hide UI */
|
||||||
|
function hideWindowUi(pdf, flag) {}
|
||||||
|
|
||||||
|
/** Sets the fit window flag.
|
||||||
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {boolean} flag fit window */
|
||||||
|
function fitWindow(pdf, flag) {}
|
||||||
|
|
||||||
|
/** Sets the center window flag.
|
||||||
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {boolean} flag center window */
|
||||||
|
function centerWindow(pdf, flag) {}
|
||||||
|
|
||||||
|
/** Sets the display doc title flag.
|
||||||
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {boolean} flag display doc title */
|
||||||
|
function displayDocTitle(pdf, flag) {}
|
||||||
|
|
||||||
/** Sets the PDF to open, possibly with zoom-to-fit, at the given page
|
/** Sets the PDF to open, possibly with zoom-to-fit, at the given page
|
||||||
number. */
|
number.
|
||||||
function openAtPage(pdf, fit, pagenumber)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {boolean} fit zoom-to-fit
|
||||||
|
@arg {number} pagenumber page number */
|
||||||
|
function openAtPage(pdf, fit, pagenumber) {}
|
||||||
|
|
||||||
/** Sets the XMP metadata of a document, given a file name. */
|
/** Sets the XMP metadata of a document, given a file name.
|
||||||
function setMetadataFromFile(pdf, filename)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {string} filename file name */
|
||||||
|
function setMetadataFromFile(pdf, filename) {}
|
||||||
|
|
||||||
/** Sets the XMP metadata from an array of bytes. */
|
/** Sets the XMP metadata from an array of bytes.
|
||||||
function setMetadataFromByteArray(pdf, data)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {Uint8Array} data XMP metadata as an array of bytes */
|
||||||
|
function setMetadataFromByteArray(pdf, data) {}
|
||||||
|
|
||||||
/** Removes the XMP metadata from a document. */
|
/** Removes the XMP metadata from a document.
|
||||||
function removeMetadata(pdf)
|
@arg {pdf} pdf PDF document */
|
||||||
|
function removeMetadata(pdf) {}
|
||||||
|
|
||||||
/** Returns the XMP metadata from a document. */
|
/** Returns the XMP metadata from a document.
|
||||||
function getMetadata(pdf)
|
@arg {pdf} pdf PDF document
|
||||||
|
@result {Uint8Array} XMP metadata as a byte array */
|
||||||
|
function getMetadata(pdf) {}
|
||||||
|
|
||||||
/** Builds fresh XMP metadata as best it can from existing metadata in the
|
/** Builds fresh XMP metadata as best it can from existing metadata in the
|
||||||
document. */
|
document.
|
||||||
function createMetadata(pdf)
|
@arg {pdf} pdf PDF document */
|
||||||
|
function createMetadata(pdf) {}
|
||||||
|
|
||||||
/** Sets the metadata date for a PDF. The date is given in PDF date format --
|
/** Sets the metadata date for a PDF. The date is given in PDF date format --
|
||||||
cpdf will convert it to XMP format. The date 'now' means now. */
|
cpdf will convert it to XMP format. The date 'now' means now. */
|
||||||
function setMetadataDate(pdf, date)
|
function setMetadataDate(pdf, date) {}
|
||||||
|
|
||||||
|
/** 1, 2, 3... */
|
||||||
|
var decimalArabic = 0;
|
||||||
|
|
||||||
|
/** I, II, III... */
|
||||||
|
var uppercaseRoman = 1;
|
||||||
|
|
||||||
|
/** i, ii, iii... */
|
||||||
|
var lowercaseRoman = 2;
|
||||||
|
|
||||||
|
/** A, B, C... */
|
||||||
|
var uppercaseLetters = 3;
|
||||||
|
|
||||||
|
/** a, b, c... */
|
||||||
|
var lowercaseLetters = 4;
|
||||||
|
|
||||||
/** Adds page labels. The prefix is prefix text for each label. The range is
|
/** Adds page labels. The prefix is prefix text for each label. The range is
|
||||||
the page range the labels apply to. Offset can be used to shift the numbering
|
the page range the labels apply to. Offset can be used to shift the numbering
|
||||||
up or down. */
|
up or down.
|
||||||
function addPageLabels(pdf, style, prefix, offset, range, progress)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {style} style page label style
|
||||||
|
@arg {string} prefix label prefix
|
||||||
|
@arg {number} offset offset
|
||||||
|
@arg {range} range page range
|
||||||
|
@arg {boolean} progress labels progress */
|
||||||
|
function addPageLabels(pdf, style, prefix, offset, range, progress) {}
|
||||||
|
|
||||||
/** Removes the page labels from the document. */
|
/** Removes the page labels from the document.
|
||||||
function removePageLabels(pdf)
|
@arg {pdf} pdf PDF document */
|
||||||
|
function removePageLabels(pdf) {}
|
||||||
|
|
||||||
/** Calculates the full label string for a given page, and returns it. */
|
/** Calculates the full label string for a given page, and returns it.
|
||||||
function getPageLabelStringForPage(pdf, pagenumber)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {number} pagenumber page number
|
||||||
|
@result {string} page label string */
|
||||||
|
function getPageLabelStringForPage(pdf, pagenumber) {}
|
||||||
|
|
||||||
/** Gets page label data. Call startGetPageLabels to find out how many
|
/** Gets page label data. Call startGetPageLabels to find out how many
|
||||||
there are, then use these serial numbers to get the style, prefix, offset
|
there are, then use these serial numbers to get the style, prefix, offset
|
||||||
and start value (note not a range). Call endGetPageLabels to clean up.
|
and start value (note not a range). Call endGetPageLabels to clean up.<br/><br/>
|
||||||
|
|
||||||
For example, a document might have five pages of introduction with roman
|
For example, a document might have five pages of introduction with roman
|
||||||
numerals, followed by the rest of the pages in decimal arabic, numbered from
|
numerals, followed by the rest of the pages in decimal arabic, numbered from
|
||||||
one:
|
one:<br/><br/>
|
||||||
|
|
||||||
labelstyle = LowercaseRoman
|
labelstyle = LowercaseRoman<br/>
|
||||||
labelprefix = ""
|
labelprefix = ""<br/>
|
||||||
startpage = 1
|
startpage = 1<br/>
|
||||||
startvalue = 1
|
startvalue = 1<br/></br>
|
||||||
|
|
||||||
|
labelstyle = DecimalArabic<br/>
|
||||||
|
labelprefix = ""<br/>
|
||||||
|
startpage = 6<br/>
|
||||||
|
startvalue = 1<br/>
|
||||||
|
|
||||||
|
@arg {pdf} pdf PDF document
|
||||||
|
@result {number} number of page labels */
|
||||||
|
function startGetPageLabels(pdf) {}
|
||||||
|
|
||||||
|
/** Gets page label data. Call startGetPageLabels to find out how many
|
||||||
|
there are, then use these serial numbers to get the style, prefix, offset
|
||||||
|
and start value (note not a range). Call endGetPageLabels to clean up.<br/><br/>
|
||||||
|
|
||||||
|
For example, a document might have five pages of introduction with roman
|
||||||
|
numerals, followed by the rest of the pages in decimal arabic, numbered from
|
||||||
|
one:<br/><br/>
|
||||||
|
|
||||||
|
labelstyle = LowercaseRoman<br/>
|
||||||
|
labelprefix = ""<br/>
|
||||||
|
startpage = 1<br/>
|
||||||
|
startvalue = 1<br/></br>
|
||||||
|
|
||||||
|
labelstyle = DecimalArabic<br/>
|
||||||
|
labelprefix = ""<br/>
|
||||||
|
startpage = 6<br/>
|
||||||
|
startvalue = 1<br/>
|
||||||
|
|
||||||
|
@arg {number} n serial number
|
||||||
|
@result {"label style"} page label style */
|
||||||
|
function getPageLabelStyle(n) {}
|
||||||
|
|
||||||
|
/** Gets page label data. Call startGetPageLabels to find out how many
|
||||||
|
there are, then use these serial numbers to get the style, prefix, offset
|
||||||
|
and start value (note not a range). Call endGetPageLabels to clean up.<br/><br/>
|
||||||
|
|
||||||
|
For example, a document might have five pages of introduction with roman
|
||||||
|
numerals, followed by the rest of the pages in decimal arabic, numbered from
|
||||||
|
one:<br/><br/>
|
||||||
|
|
||||||
|
labelstyle = LowercaseRoman<br/>
|
||||||
|
labelprefix = ""<br/>
|
||||||
|
startpage = 1<br/>
|
||||||
|
startvalue = 1<br/></br>
|
||||||
|
|
||||||
|
labelstyle = DecimalArabic<br/>
|
||||||
|
labelprefix = ""<br/>
|
||||||
|
startpage = 6<br/>
|
||||||
|
startvalue = 1<br/>
|
||||||
|
|
||||||
|
@arg {number} n serial number
|
||||||
|
@result {string} page label prefix */
|
||||||
|
function getPageLabelPrefix(n) {}
|
||||||
|
|
||||||
|
/** Gets page label data. Call startGetPageLabels to find out how many
|
||||||
|
there are, then use these serial numbers to get the style, prefix, offset
|
||||||
|
and start value (note not a range). Call endGetPageLabels to clean up.<br/><br/>
|
||||||
|
|
||||||
|
For example, a document might have five pages of introduction with roman
|
||||||
|
numerals, followed by the rest of the pages in decimal arabic, numbered from
|
||||||
|
one:<br/><br/>
|
||||||
|
|
||||||
|
labelstyle = LowercaseRoman<br/>
|
||||||
|
labelprefix = ""<br/>
|
||||||
|
startpage = 1<br/>
|
||||||
|
startvalue = 1<br/></br>
|
||||||
|
|
||||||
|
labelstyle = DecimalArabic<br/>
|
||||||
|
labelprefix = ""<br/>
|
||||||
|
startpage = 6<br/>
|
||||||
|
startvalue = 1<br/>
|
||||||
|
|
||||||
|
@arg {number} n serial number
|
||||||
|
@result {number} page label offset */
|
||||||
|
function getPageLabelOffset(n) {}
|
||||||
|
|
||||||
|
/** Gets page label data. Call startGetPageLabels to find out how many
|
||||||
|
there are, then use these serial numbers to get the style, prefix, offset
|
||||||
|
and start value (note not a range). Call endGetPageLabels to clean up.<br/><br/>
|
||||||
|
|
||||||
|
For example, a document might have five pages of introduction with roman
|
||||||
|
numerals, followed by the rest of the pages in decimal arabic, numbered from
|
||||||
|
one:<br/><br/>
|
||||||
|
|
||||||
|
labelstyle = LowercaseRoman<br/>
|
||||||
|
labelprefix = ""<br/>
|
||||||
|
startpage = 1<br/>
|
||||||
|
startvalue = 1<br/></br>
|
||||||
|
|
||||||
|
labelstyle = DecimalArabic<br/>
|
||||||
|
labelprefix = ""<br/>
|
||||||
|
startpage = 6<br/>
|
||||||
|
startvalue = 1<br/>
|
||||||
|
|
||||||
|
@arg {number} n serial number
|
||||||
|
@result {number} page label range */
|
||||||
|
function getPageLabelRange(n) {}
|
||||||
|
|
||||||
|
/** Gets page label data. Call startGetPageLabels to find out how many
|
||||||
|
there are, then use these serial numbers to get the style, prefix, offset
|
||||||
|
and start value (note not a range). Call endGetPageLabels to clean up.<br/><br/>
|
||||||
|
|
||||||
|
For example, a document might have five pages of introduction with roman
|
||||||
|
numerals, followed by the rest of the pages in decimal arabic, numbered from
|
||||||
|
one:<br/><br/>
|
||||||
|
|
||||||
|
labelstyle = LowercaseRoman<br/>
|
||||||
|
labelprefix = ""<br/>
|
||||||
|
startpage = 1<br/>
|
||||||
|
startvalue = 1<br/></br>
|
||||||
|
|
||||||
|
labelstyle = DecimalArabic<br/>
|
||||||
|
labelprefix = ""<br/>
|
||||||
|
startpage = 6<br/>
|
||||||
|
startvalue = 1<br/> */
|
||||||
|
function endGetPageLabels() {}
|
||||||
|
|
||||||
labelstyle = DecimalArabic
|
|
||||||
labelprefix = ""
|
|
||||||
startpage = 6
|
|
||||||
startvalue = 1 */
|
|
||||||
function startGetPageLabels(pdf)
|
|
||||||
function getPageLabelStyle(n)
|
|
||||||
function getPageLabelPrefix(n)
|
|
||||||
function getPageLabelOffset(n)
|
|
||||||
function getPageLabelRange(n)
|
|
||||||
function endGetPageLabels()
|
|
||||||
|
|
|
@ -1,41 +1,63 @@
|
||||||
// CHAPTER 12. File Attachments
|
// CHAPTER 12. File Attachments
|
||||||
|
|
||||||
/** Attaches a file to the pdf. It is attached at document level. */
|
/** Attaches a file to the pdf. It is attached at document level.
|
||||||
function attachFile(filename, pdf)
|
@arg {string} filename file name
|
||||||
|
@arg {pdf} pdf PDF document */
|
||||||
|
function attachFile(filename, pdf) {}
|
||||||
|
|
||||||
/** Attaches a file, given its file name, pdf, and the page number
|
/** Attaches a file, given its file name, pdf, and the page number
|
||||||
to which it should be attached. */
|
to which it should be attached.
|
||||||
function attachFileToPage(filename, pdf, pagenumber)
|
@arg {string} filename file name
|
||||||
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {number} pagenumber page number */
|
||||||
|
function attachFileToPage(filename, pdf, pagenumber) {}
|
||||||
|
|
||||||
/** Attaches data from memory, just like attachFile. */
|
/** Attaches data from memory, just like attachFile.
|
||||||
function attachFileFromMemory(data, filename, pdf)
|
@arg {Uint8Array} data file as a byte array
|
||||||
|
@arg {string} filename file name to call it in the PDF
|
||||||
|
@arg {pdf} pdf PDF document */
|
||||||
|
function attachFileFromMemory(data, filename, pdf) {}
|
||||||
|
|
||||||
/** Attaches to a page from memory, just like attachFileToPage. */
|
/** Attaches to a page from memory, just like attachFileToPage.
|
||||||
function attachFileToPageFromMemory(data, filename, pdf, pagenumber)
|
@arg {Uint8Array} data file as a byte array
|
||||||
|
@arg {string} filename file name to call it in the PDF
|
||||||
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {number} pagenumber page number */
|
||||||
|
function attachFileToPageFromMemory(data, filename, pdf, pagenumber) {}
|
||||||
|
|
||||||
/** Removes all page- and document-level attachments from a document. */
|
/** Removes all page- and document-level attachments from a document.
|
||||||
function removeAttachedFiles(pdf)
|
@arg {pdf} pdf PDF document */
|
||||||
|
function removeAttachedFiles(pdf) {}
|
||||||
|
|
||||||
/** Lists information about attachments. Call startGetAttachments(pdf) first,
|
/** Lists information about attachments. Call startGetAttachments(pdf) first,
|
||||||
then numberGetAttachments to find out how many there are. Then
|
then numberGetAttachments to find out how many there are. Then
|
||||||
getAttachmentName etc. to return each one 0...(n - 1). Finally, call
|
getAttachmentName etc. to return each one 0...(n - 1). Finally, call
|
||||||
endGetAttachments to clean up. */
|
endGetAttachments to clean up.
|
||||||
function startGetAttachments(pdf)
|
@arg {pdf} pdf PDF document */
|
||||||
|
function startGetAttachments(pdf) {}
|
||||||
|
|
||||||
/** Lists information about attachments. Call startGetAttachments(pdf) first,
|
/** Lists information about attachments. Call startGetAttachments(pdf) first,
|
||||||
then numberGetAttachments to find out how many there are. Then
|
then numberGetAttachments to find out how many there are. Then
|
||||||
getAttachmentName etc. to return each one 0...(n - 1). Finally, call
|
getAttachmentName etc. to return each one 0...(n - 1). Finally, call
|
||||||
endGetAttachments to clean up. */
|
endGetAttachments to clean up.
|
||||||
function numberGetAttachments()
|
@return {number} number of attachments */
|
||||||
|
function numberGetAttachments() {}
|
||||||
|
|
||||||
/** Gets the name of an attachment. */
|
/** Gets the name of an attachment.
|
||||||
function getAttachmentName(n)
|
@arg {number} n serial number
|
||||||
|
@return {string} attachment name */
|
||||||
|
function getAttachmentName(n) {}
|
||||||
|
|
||||||
/** Gets the page number. 0 = document level. */
|
/** Gets the page number. 0 = document level.
|
||||||
function getAttachmentPage(n)
|
@arg {number} n serial number
|
||||||
|
@return {number} attachment page */
|
||||||
|
function getAttachmentPage(n) {}
|
||||||
|
|
||||||
/** Gets the attachment data itself. */
|
/** Gets the attachment data itself.
|
||||||
function getAttachmentData(n)
|
@arg {number} n serial number
|
||||||
|
@return {Uint8Array} attachment data */
|
||||||
|
function getAttachmentData(n) {}
|
||||||
|
|
||||||
/** Cleans up after getting attachments. */
|
/** Cleans up after getting attachments. */
|
||||||
function endGetAttachments()
|
function endGetAttachments() {}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,83 @@
|
||||||
//CHAPTER 13. Images
|
//CHAPTER 13. Images
|
||||||
|
|
||||||
|
/** Gets image data, including resolution at all points of use. Call
|
||||||
|
startGetImageResolution(pdf, min_required_resolution) to begin the process of
|
||||||
|
obtaining data on all image uses below min_required_resolution, returning the
|
||||||
|
total number. So, to return all image uses, specify a very high
|
||||||
|
min_required_resolution. Then, call the other functions giving a serial number
|
||||||
|
0..n - 1, to retrieve the data. Finally, call endGetImageResolution to clean
|
||||||
|
up.
|
||||||
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {number} min_required_resolution minimum required resolution
|
||||||
|
@return {number} number of uses */
|
||||||
|
function startGetImageResolution(pdf, min_required_resolution) {}
|
||||||
|
|
||||||
|
/** Gets image data, including resolution at all points of use. Call
|
||||||
|
startGetImageResolution(pdf, min_required_resolution) to begin the process of
|
||||||
|
obtaining data on all image uses below min_required_resolution, returning the
|
||||||
|
total number. So, to return all image uses, specify a very high
|
||||||
|
min_required_resolution. Then, call the other functions giving a serial number
|
||||||
|
0..n - 1, to retrieve the data. Finally, call endGetImageResolution to clean
|
||||||
|
up.
|
||||||
|
@arg {number} n serial number
|
||||||
|
@return {number} page number */
|
||||||
|
function getImageResolutionPageNumber(n) {}
|
||||||
|
|
||||||
|
/** Gets image data, including resolution at all points of use. Call
|
||||||
|
startGetImageResolution(pdf, min_required_resolution) to begin the process of
|
||||||
|
obtaining data on all image uses below min_required_resolution, returning the
|
||||||
|
total number. So, to return all image uses, specify a very high
|
||||||
|
min_required_resolution. Then, call the other functions giving a serial number
|
||||||
|
0..n - 1, to retrieve the data. Finally, call endGetImageResolution to clean
|
||||||
|
up.
|
||||||
|
@arg {number} n serial number
|
||||||
|
@return {string} image name */
|
||||||
|
function getImageResolutionImageName(n) {}
|
||||||
|
|
||||||
|
/** Gets image data, including resolution at all points of use. Call
|
||||||
|
startGetImageResolution(pdf, min_required_resolution) to begin the process of
|
||||||
|
obtaining data on all image uses below min_required_resolution, returning the
|
||||||
|
total number. So, to return all image uses, specify a very high
|
||||||
|
min_required_resolution. Then, call the other functions giving a serial number
|
||||||
|
0..n - 1, to retrieve the data. Finally, call endGetImageResolution to clean
|
||||||
|
up.
|
||||||
|
@arg {number} n serial number
|
||||||
|
@return {number} X pixels */
|
||||||
|
function getImageResolutionXPixels(n) {}
|
||||||
|
|
||||||
|
/** Gets image data, including resolution at all points of use. Call
|
||||||
|
startGetImageResolution(pdf, min_required_resolution) to begin the process of
|
||||||
|
obtaining data on all image uses below min_required_resolution, returning the
|
||||||
|
total number. So, to return all image uses, specify a very high
|
||||||
|
min_required_resolution. Then, call the other functions giving a serial number
|
||||||
|
0..n - 1, to retrieve the data. Finally, call endGetImageResolution to clean
|
||||||
|
up.
|
||||||
|
@arg {number} n serial number
|
||||||
|
@return {number} Y pixels */
|
||||||
|
function getImageResolutionYPixels(n) {}
|
||||||
|
|
||||||
|
/** Gets image data, including resolution at all points of use. Call
|
||||||
|
startGetImageResolution(pdf, min_required_resolution) to begin the process of
|
||||||
|
obtaining data on all image uses below min_required_resolution, returning the
|
||||||
|
total number. So, to return all image uses, specify a very high
|
||||||
|
min_required_resolution. Then, call the other functions giving a serial number
|
||||||
|
0..n - 1, to retrieve the data. Finally, call endGetImageResolution to clean
|
||||||
|
up.
|
||||||
|
@arg {number} n serial number
|
||||||
|
@return {number} X Res */
|
||||||
|
function getImageResolutionXRes(n) {}
|
||||||
|
|
||||||
|
/** Gets image data, including resolution at all points of use. Call
|
||||||
|
startGetImageResolution(pdf, min_required_resolution) to begin the process of
|
||||||
|
obtaining data on all image uses below min_required_resolution, returning the
|
||||||
|
total number. So, to return all image uses, specify a very high
|
||||||
|
min_required_resolution. Then, call the other functions giving a serial number
|
||||||
|
0..n - 1, to retrieve the data. Finally, call endGetImageResolution to clean
|
||||||
|
up.
|
||||||
|
@arg {number} n serial number
|
||||||
|
@return {number} Y Res */
|
||||||
|
function getImageResolutionYRes(n) {}
|
||||||
|
|
||||||
/** Gets image data, including resolution at all points of use. Call
|
/** Gets image data, including resolution at all points of use. Call
|
||||||
startGetImageResolution(pdf, min_required_resolution) to begin the process of
|
startGetImageResolution(pdf, min_required_resolution) to begin the process of
|
||||||
obtaining data on all image uses below min_required_resolution, returning the
|
obtaining data on all image uses below min_required_resolution, returning the
|
||||||
|
@ -7,11 +85,5 @@ total number. So, to return all image uses, specify a very high
|
||||||
min_required_resolution. Then, call the other functions giving a serial number
|
min_required_resolution. Then, call the other functions giving a serial number
|
||||||
0..n - 1, to retrieve the data. Finally, call endGetImageResolution to clean
|
0..n - 1, to retrieve the data. Finally, call endGetImageResolution to clean
|
||||||
up. */
|
up. */
|
||||||
function startGetImageResolution(pdf, min_required_resolution)
|
function endGetImageResolution() {}
|
||||||
function getImageResolutionPageNumber(n)
|
|
||||||
function getImageResolutionImageName(n)
|
|
||||||
function getImageResolutionXPixels(n)
|
|
||||||
function getImageResolutionYPixels(n)
|
|
||||||
function getImageResolutionXRes(n)
|
|
||||||
function getImageResolutionYRes(n)
|
|
||||||
function endGetImageResolution()
|
|
||||||
|
|
|
@ -4,18 +4,71 @@
|
||||||
numberFonts to return the number of fonts. For each font, call one or more of
|
numberFonts to return the number of fonts. For each font, call one or more of
|
||||||
getFontPage, getFontName, getFontType, and getFontEncoding giving a serial
|
getFontPage, getFontName, getFontType, and getFontEncoding giving a serial
|
||||||
number 0..n - 1 to return information. Finally, call endGetFontInfo to clean
|
number 0..n - 1 to return information. Finally, call endGetFontInfo to clean
|
||||||
up. */
|
up.
|
||||||
function startGetFontInfo(pdf)
|
@ {pdf} pdf PDF document */
|
||||||
function numberFonts()
|
function startGetFontInfo(pdf) {}
|
||||||
function getFontPage(n)
|
|
||||||
function getFontName(n)
|
|
||||||
function getFontType(n)
|
|
||||||
function getFontEncoding(n)
|
|
||||||
function endGetFontInfo()
|
|
||||||
|
|
||||||
/** Removes all font data from a file. */
|
/** Retrieves font information. First, call startGetFontInfo(pdf). Now call
|
||||||
function removeFonts(pdf)
|
numberFonts to return the number of fonts. For each font, call one or more of
|
||||||
|
getFontPage, getFontName, getFontType, and getFontEncoding giving a serial
|
||||||
|
number 0..n - 1 to return information. Finally, call endGetFontInfo to clean
|
||||||
|
up.
|
||||||
|
@result {number} number of fonts */
|
||||||
|
function numberFonts() {}
|
||||||
|
|
||||||
|
/** Retrieves font information. First, call startGetFontInfo(pdf). Now call
|
||||||
|
numberFonts to return the number of fonts. For each font, call one or more of
|
||||||
|
getFontPage, getFontName, getFontType, and getFontEncoding giving a serial
|
||||||
|
number 0..n - 1 to return information. Finally, call endGetFontInfo to clean
|
||||||
|
up.
|
||||||
|
@arg {number} n serial number
|
||||||
|
@return {number} page number */
|
||||||
|
function getFontPage(n) {}
|
||||||
|
|
||||||
|
/** Retrieves font information. First, call startGetFontInfo(pdf). Now call
|
||||||
|
numberFonts to return the number of fonts. For each font, call one or more of
|
||||||
|
getFontPage, getFontName, getFontType, and getFontEncoding giving a serial
|
||||||
|
number 0..n - 1 to return information. Finally, call endGetFontInfo to clean
|
||||||
|
up.
|
||||||
|
@arg {number} n serial number
|
||||||
|
@return {string} font name */
|
||||||
|
function getFontName(n) {}
|
||||||
|
|
||||||
|
/** Retrieves font information. First, call startGetFontInfo(pdf). Now call
|
||||||
|
numberFonts to return the number of fonts. For each font, call one or more of
|
||||||
|
getFontPage, getFontName, getFontType, and getFontEncoding giving a serial
|
||||||
|
number 0..n - 1 to return information. Finally, call endGetFontInfo to clean
|
||||||
|
up.
|
||||||
|
@arg {number} n serial number
|
||||||
|
@return {string} font type */
|
||||||
|
function getFontType(n) {}
|
||||||
|
|
||||||
|
/** Retrieves font information. First, call startGetFontInfo(pdf). Now call
|
||||||
|
numberFonts to return the number of fonts. For each font, call one or more of
|
||||||
|
getFontPage, getFontName, getFontType, and getFontEncoding giving a serial
|
||||||
|
number 0..n - 1 to return information. Finally, call endGetFontInfo to clean
|
||||||
|
up.
|
||||||
|
@arg {number} n serial number
|
||||||
|
@return {string} font encoding */
|
||||||
|
function getFontEncoding(n) {}
|
||||||
|
|
||||||
|
/** Retrieves font information. First, call startGetFontInfo(pdf). Now call
|
||||||
|
numberFonts to return the number of fonts. For each font, call one or more of
|
||||||
|
getFontPage, getFontName, getFontType, and getFontEncoding giving a serial
|
||||||
|
number 0..n - 1 to return information. Finally, call endGetFontInfo to clean
|
||||||
|
up. */
|
||||||
|
function endGetFontInfo() {}
|
||||||
|
|
||||||
|
/** Removes all font data from a file.
|
||||||
|
@arg {pdf} pdf PDF document */
|
||||||
|
function removeFonts(pdf) {}
|
||||||
|
|
||||||
/** Copies the given font from the given page in the 'from' PDF to every page
|
/** Copies the given font from the given page in the 'from' PDF to every page
|
||||||
in the 'to' PDF. The new font is stored under its font name. */
|
in the range of the 'to' PDF. The new font is stored under its font name.
|
||||||
function copyFont(docfrom, docto, range, pagenumber, fontname)
|
@arg {pdf} docfrom source document
|
||||||
|
@arg {pdf} docto destination document
|
||||||
|
@arg {range} page range
|
||||||
|
@arg {number} pagenumber source page number
|
||||||
|
@arg {string} fontname font name */
|
||||||
|
function copyFont(docfrom, docto, range, pagenumber, fontname) {}
|
||||||
|
|
||||||
|
|
|
@ -2,14 +2,29 @@
|
||||||
|
|
||||||
/** Outputs a PDF in JSON format to the given filename. If parse_content is
|
/** Outputs a PDF in JSON format to the given filename. If parse_content is
|
||||||
true, page content is parsed. If no_stream_data is true, all stream data is
|
true, page content is parsed. If no_stream_data is true, all stream data is
|
||||||
suppressed entirely. If decompress_streams is true, streams are decompressed. */
|
suppressed entirely. If decompress_streams is true, streams are decompressed.
|
||||||
function outputJSON(filename, parse_content, no_stream_data, decompress_streams, pdf)
|
@arg {string} filename file name
|
||||||
|
@arg {boolean} parse_content parse page content
|
||||||
|
@arg {boolean} no_stream_data suppress stream data
|
||||||
|
@arg {boolean} decompress_streams decompress streams
|
||||||
|
@arg {pdf} pdf PDF document */
|
||||||
|
function outputJSON(filename, parse_content, no_stream_data, decompress_streams, pdf) {}
|
||||||
|
|
||||||
/** Like outputJSON, but it writes to a byte array in memory. */
|
/** Like outputJSON, but it writes to a byte array in memory.
|
||||||
function outputJSONMemory(parse_content, no_stream_data, decompress_streams, pdf)
|
@arg {boolean} parse_content parse page content
|
||||||
|
@arg {boolean} no_stream_data suppress stream data
|
||||||
|
@arg {boolean} decompress_streams decompress streams
|
||||||
|
@arg {pdf} pdf PDF document
|
||||||
|
@return {Uint8Array} JSON data as a byte array */
|
||||||
|
function outputJSONMemory(parse_content, no_stream_data, decompress_streams, pdf) {}
|
||||||
|
|
||||||
/** Loads a PDF from a JSON file given its filename. */
|
/** Loads a PDF from a JSON file given its filename.
|
||||||
function fromJSON(filename)
|
@arg {string} filename file name
|
||||||
|
@return {pdf} PDF document */
|
||||||
|
function fromJSON(filename) {}
|
||||||
|
|
||||||
|
/** Loads a PDF from a JSON file in memory.
|
||||||
|
@arg {Uint8Array} data JSON data as a byte array
|
||||||
|
@return {pdf} PDF document */
|
||||||
|
function fromJSONMemory(data) {}
|
||||||
|
|
||||||
/** Loads a PDF from a JSON file in memory. */
|
|
||||||
function fromJSONMemory(data)
|
|
||||||
|
|
|
@ -1,23 +1,32 @@
|
||||||
// CHAPTER 16. Optional Content Groups
|
// CHAPTER 16. Optional Content Groups
|
||||||
|
|
||||||
/** Begins retrieving optional content group names. The serial number 0..n - 1
|
/** Begins retrieving optional content group names. The number of entries is returned.
|
||||||
is returned. */
|
@arg {pdf} pdf PDF document
|
||||||
function startGetOCGList(pdf)
|
@return {number} number of entries */
|
||||||
|
function startGetOCGList(pdf) {}
|
||||||
|
|
||||||
/** Retrieves an OCG name, given its serial number 0..n - 1. */
|
/** Retrieves an OCG name, given its serial number 0..n - 1.
|
||||||
function ocgListEntry(n)
|
@arg {number} n serial number
|
||||||
|
@return {string} OCG name */
|
||||||
|
function ocgListEntry(n) {}
|
||||||
|
|
||||||
/** Ends retrieval of optional content group names. */
|
/** Ends retrieval of optional content group names. */
|
||||||
function endGetOCGList()
|
function endGetOCGList() {}
|
||||||
|
|
||||||
/** Renames an optional content group. */
|
/** Renames an optional content group.
|
||||||
function ocgRename(pdf, name_from, name_to)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {string} name_from source name
|
||||||
|
@arg {string} name_to destination name */
|
||||||
|
function ocgRename(pdf, name_from, name_to) {}
|
||||||
|
|
||||||
/** Ensures that every optional content group appears in the OCG order list. */
|
/** Ensures that every optional content group appears in the OCG order list.
|
||||||
function ocgOrderAll(pdf)
|
@arg {pdf} pdf PDF document */
|
||||||
|
function ocgOrderAll(pdf) {}
|
||||||
|
|
||||||
/** Coalesces optional content groups. For example, if we merge or stamp two
|
/** Coalesces optional content groups. For example, if we merge or stamp two
|
||||||
files both with an OCG called "Layer 1", we will have two different optional
|
files both with an OCG called "Layer 1", we will have two different optional
|
||||||
content groups. This function will merge the two into a single optional
|
content groups. This function will merge the two into a single optional
|
||||||
content group. */
|
content group.
|
||||||
function ocgCoalesce(pdf)
|
@arg {pdf} pdf PDF document */
|
||||||
|
function ocgCoalesce(pdf) {}
|
||||||
|
|
||||||
|
|
|
@ -1,16 +1,54 @@
|
||||||
// CHAPTER 17. Creating new PDFs
|
// CHAPTER 17. Creating new PDFs
|
||||||
|
|
||||||
/** Creates a blank document with pages of the given width (in points), height
|
/** Creates a blank document with pages of the given width (in points), height
|
||||||
(in points), and number of pages. */
|
(in points), and number of pages.
|
||||||
function blankDocument(w, h, pages)
|
@arg {number} w page width
|
||||||
|
@arg {number} h page height
|
||||||
|
@arg {number} number of pages
|
||||||
|
@return {pdf} PDF document */
|
||||||
|
function blankDocument(w, h, pages) {}
|
||||||
|
|
||||||
/** Makes a blank document given a page size and number of pages. */
|
/** Makes a blank document given a page size and number of pages.
|
||||||
function blankDocumentPaper(papersize, pages)
|
@arg {"paper size"} papersize paper size
|
||||||
|
@arg {number} pages number of pages
|
||||||
|
@return {pdf} PDF document */
|
||||||
|
function blankDocumentPaper(papersize, pages) {}
|
||||||
|
|
||||||
/** Typesets a UTF8 text file ragged right on a page of size w * h in points
|
/** Typesets a UTF8 text file ragged right on a page of size w * h in points
|
||||||
in the given font and font size. */
|
in the given font and font size.
|
||||||
function textToPDF(w, h, font, fontsize, filename)
|
@arg {number} w page width
|
||||||
|
@arg {number} h page height
|
||||||
|
@arg {font} font font
|
||||||
|
@arg {number} fontsize font size
|
||||||
|
@arg {string} filename file name
|
||||||
|
@result {pdf} PDF document */
|
||||||
|
function textToPDF(w, h, font, fontsize, filename) {}
|
||||||
|
|
||||||
|
/** Typesets a UTF8 text file ragged right on a page of size w * h in points
|
||||||
|
in the given font and font size.
|
||||||
|
@arg {number} w page width
|
||||||
|
@arg {number} h page height
|
||||||
|
@arg {font} font font
|
||||||
|
@arg {number} fontsize font size
|
||||||
|
@arg {Uint8Array} data text
|
||||||
|
@result {pdf} PDF document */
|
||||||
|
function textToPDFMemory(w, h, font, fontsize, data) {}
|
||||||
|
|
||||||
/** Typesets a UTF8 text file ragged right on a page of the given size in the
|
/** Typesets a UTF8 text file ragged right on a page of the given size in the
|
||||||
given font and font size. */
|
given font and font size.
|
||||||
function textToPDFPaper(papersize, font, fontsize, filename)
|
@arg {"paper size"} papersize paper size
|
||||||
|
@arg {font} font font
|
||||||
|
@arg {number} fontsize font size
|
||||||
|
@arg {string} filename file name
|
||||||
|
@result {pdf} PDF document */
|
||||||
|
function textToPDFPaper(papersize, font, fontsize, filename) {}
|
||||||
|
|
||||||
|
/** Typesets a UTF8 text file ragged right on a page of the given size in the
|
||||||
|
given font and font size.
|
||||||
|
@arg {"paper size"} papersize paper size
|
||||||
|
@arg {font} font font
|
||||||
|
@arg {number} fontsize font size
|
||||||
|
@arg {Uint8Array} data text
|
||||||
|
@result {pdf} PDF document */
|
||||||
|
function textToPDFPaperMemory(papersize, font, fontsize, data) {}
|
||||||
|
|
||||||
|
|
|
@ -1,54 +1,93 @@
|
||||||
//CHAPTER 18. Miscellaneous
|
//CHAPTER 18. Miscellaneous
|
||||||
|
|
||||||
/** Removes images on the given pages, replacing them with crossed boxes if
|
/** Removes images on the given pages, replacing them with crossed boxes if
|
||||||
'boxes' is true. */
|
'boxes' is true.
|
||||||
function draft(pdf, range, boxes)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {range} range page range
|
||||||
|
@arg {boolean} boxes replace with crossed boxes */
|
||||||
|
function draft(pdf, range, boxes) {}
|
||||||
|
|
||||||
/** Removes all text from the given pages in a given document. */
|
/** Removes all text from the given pages in a given document.
|
||||||
function removeAllText(pdf, range)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {range} range page range */
|
||||||
|
function removeAllText(pdf, range) {}
|
||||||
|
|
||||||
/* Blackens all text on the given pages. */
|
/* Blackens all text on the given pages.
|
||||||
function blackText(pdf, range)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {range} range page range */
|
||||||
|
function blackText(pdf, range) {}
|
||||||
|
|
||||||
/** Blackens all lines on the given pages. */
|
/** Blackens all lines on the given pages.
|
||||||
function blackLines(pdf, range)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {range} range page range */
|
||||||
|
function blackLines(pdf, range) {}
|
||||||
|
|
||||||
/** Blackens all fills on the given pages. */
|
/** Blackens all fills on the given pages.
|
||||||
function blackFills(pdf, range)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {range} range page range */
|
||||||
|
function blackFills(pdf, range) {}
|
||||||
|
|
||||||
/** Thickens every line less than min_thickness to min_thickness. Thickness
|
/** Thickens every line less than min_thickness to min_thickness. Thickness
|
||||||
given in points. */
|
given in points.
|
||||||
function thinLines(pdf, range, min_thickness)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {range} range page range
|
||||||
|
@arg {number} min_thickness minimum required thickness */
|
||||||
|
function thinLines(pdf, range, min_thickness) {}
|
||||||
|
|
||||||
/** Copies the /ID from one document to another. */
|
/** Copies the /ID from one document to another.
|
||||||
function copyId(pdf_from, pdf_to)
|
@arg {pdf} pdf_from source document
|
||||||
|
@arg {pdf} pdf_to destination document */
|
||||||
|
function copyId(pdf_from, pdf_to) {}
|
||||||
|
|
||||||
/** Removes a document's /ID. */
|
/** Removes a document's /ID.
|
||||||
function removeId(pdf)
|
@arg {pdf} pdf PDF document */
|
||||||
|
function removeId(pdf) {}
|
||||||
|
|
||||||
/** Sets the minor version number of a document. */
|
/** Sets the minor version number of a document.
|
||||||
function setVersion(pdf, version)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {number} version */
|
||||||
|
function setVersion(pdf, version) {}
|
||||||
|
|
||||||
/** Sets the full version number of a document. */
|
/** Sets the full version number of a document.
|
||||||
function setFullVersion(pdf, major, minor)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {number} major version
|
||||||
|
@arg {number} minor version */
|
||||||
|
function setFullVersion(pdf, major, minor) {}
|
||||||
|
|
||||||
/** Removes any dictionary entry with the given key anywhere in the document. */
|
/** Removes any dictionary entry with the given key anywhere in the document.
|
||||||
function removeDictEntry(pdf, key)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {string} key key to remove */
|
||||||
|
function removeDictEntry(pdf, key) {}
|
||||||
|
|
||||||
/** Removes any dictionary entry with the given key whose value matches the
|
/** Removes any dictionary entry with the given key whose value matches the
|
||||||
given search term. */
|
given search term.
|
||||||
function removeDictEntrySearch(pdf, key, searchterm)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {string} key key to remove
|
||||||
|
@arg {string} searchterm search term */
|
||||||
|
function removeDictEntrySearch(pdf, key, searchterm) {}
|
||||||
|
|
||||||
/** Replaces the value associated with the given key. */
|
/** Replaces the value associated with the given key.
|
||||||
function replaceDictEntry(pdf, key, newval)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {string} key key to remove
|
||||||
|
@arg {string} newval new value */
|
||||||
|
function replaceDictEntry(pdf, key, newval) {}
|
||||||
|
|
||||||
/** Replaces the value associated with the given key if the existing value
|
/** Replaces the value associated with the given key if the existing value
|
||||||
matches the search term. */
|
matches the search term.
|
||||||
function replaceDictEntrySearch(pdf, key, newval, searchterm)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {string} key key to remove
|
||||||
|
@arg {string} newval new value
|
||||||
|
@arg {string} searchterm search term */
|
||||||
|
function replaceDictEntrySearch(pdf, key, newval, searchterm) {}
|
||||||
|
|
||||||
/** Removes all clipping from pages in the given range. */
|
/** Removes all clipping from pages in the given range.
|
||||||
function removeClipping(pdf, range)
|
@arg {pdf} pdf PDF document
|
||||||
|
@arg {range} range page range */
|
||||||
|
function removeClipping(pdf, range) {}
|
||||||
|
|
||||||
/* Returns a JSON array containing any and all values associated with the
|
/* Returns a JSON array containing any and all values associated with the
|
||||||
given key, and fills in its length. */
|
given key.
|
||||||
function getDictEntries(pdf, key)
|
@arg {pdf} pdf PDF docment
|
||||||
|
@arg {string} key key
|
||||||
|
@return {Uint8Array} results as an array of bytes */
|
||||||
|
function getDictEntries(pdf, key) {}
|
||||||
|
|
Loading…
Reference in New Issue