mirror of
https://github.com/johnwhitington/cpdf-source.git
synced 2024-12-12 16:57:08 +01:00
594 lines
17 KiB
TeX
594 lines
17 KiB
TeX
// CHAPTER 11. Document Information and Metadata
|
|
|
|
/** Finds out if a document is linearized as quickly as possible without
|
|
loading it.
|
|
@arg {string} filename file name
|
|
@result {boolean} true if linearized */
|
|
function isLinearized(filename) {}
|
|
|
|
/** Finds out if a document in memory is linearized as quickly as possible without
|
|
loading it.
|
|
@arg {Uint8Array} PDF file as a byte array
|
|
@result {boolean} true if linearized */
|
|
function isLinearizedMemory(data) {}
|
|
|
|
/** Returns the minor version number of a document.
|
|
@arg {pdf} pdf PDF document
|
|
@return {number} version number */
|
|
function getVersion(pdf) {}
|
|
|
|
/** Returns the major version number of a document.
|
|
@arg {pdf} pdf PDF document
|
|
@return {number} major version number */
|
|
function getMajorVersion(pdf) {}
|
|
|
|
/** Returns the title of a document.
|
|
@arg {pdf} pdf PDF document
|
|
@return {string} title */
|
|
function getTitle(pdf) {}
|
|
|
|
/** Returns the author of a document.
|
|
@arg {pdf} pdf PDF document
|
|
@return {string} author */
|
|
function getAuthor(pdf) {}
|
|
|
|
/** Returns the subject of a document.
|
|
@arg {pdf} pdf PDF document
|
|
@return {string} subject */
|
|
function getSubject(pdf) {}
|
|
|
|
/** Returns the keywords of a document.
|
|
@arg {pdf} pdf PDF document
|
|
@return {string} keywords */
|
|
function getKeywords(pdf) {}
|
|
|
|
/** Returns the creator of a document.
|
|
@arg {pdf} pdf PDF document
|
|
@return {string} creator */
|
|
function getCreator(pdf) {}
|
|
|
|
/** Returns the producer of a document.
|
|
@arg {pdf} pdf PDF document
|
|
@return {string} producer */
|
|
function getProducer(pdf) {}
|
|
|
|
/** Returns the creation date of a document.
|
|
@arg {pdf} pdf PDF document
|
|
@return {string} creation date */
|
|
function getCreationDate(pdf) {}
|
|
|
|
/** Returns the modification date of a document.
|
|
@arg {pdf} pdf PDF document
|
|
@return {string} modification date */
|
|
function getModificationDate(pdf) {}
|
|
|
|
/** Returns the XMP title of a document.
|
|
@arg {pdf} pdf PDF document
|
|
@return {string} XMP title */
|
|
function getTitleXMP(pdf) {}
|
|
|
|
/** Returns the XMP author of a document.
|
|
@arg {pdf} pdf PDF document
|
|
@return {string} XMP author */
|
|
function getAuthorXMP(pdf) {}
|
|
|
|
/** Returns the XMP subject of a document.
|
|
@arg {pdf} pdf PDF document
|
|
@return {string} XMP subject */
|
|
function getSubjectXMP(pdf) {}
|
|
|
|
/** Returns the XMP keywords of a document.
|
|
@arg {pdf} pdf PDF document
|
|
@return {string} XMP keywords */
|
|
function getKeywordsXMP(pdf) {}
|
|
|
|
/** Returns the XMP creator of a document.
|
|
@arg {pdf} pdf PDF document
|
|
@return {string} XMP creator */
|
|
function getCreatorXMP(pdf) {}
|
|
|
|
/** Returns the XMP producer of a document.
|
|
@arg {pdf} pdf PDF document
|
|
@return {string} XMP producer */
|
|
function getProducerXMP(pdf) {}
|
|
|
|
/** Returns the XMP creation date of a document.
|
|
@arg {pdf} pdf PDF document
|
|
@return {string} XMP creation date */
|
|
function getCreationDateXMP(pdf) {}
|
|
|
|
/** Returns the XMP modification date of a document.
|
|
@arg {pdf} pdf PDF document
|
|
@return {string} XMP modification date */
|
|
function getModificationDateXMP(pdf) {}
|
|
|
|
/** Sets the title of a document.
|
|
@arg {pdf} pdf PDF document
|
|
@arg {string} s title */
|
|
function setTitle(pdf, s) {}
|
|
|
|
/** Sets the author of a document.
|
|
@arg {pdf} pdf PDF document
|
|
@arg {string} s author */
|
|
function setAuthor(pdf, s) {}
|
|
|
|
/** Sets the subject of a document.
|
|
@arg {pdf} pdf PDF document
|
|
@arg {string} s subject */
|
|
function setSubject(pdf, s) {}
|
|
|
|
/** Sets the keywords of a document.
|
|
@arg {pdf} pdf PDF document
|
|
@arg {string} s keywords */
|
|
function setKeywords(pdf, s) {}
|
|
|
|
/** Sets the creator of a document.
|
|
@arg {pdf} pdf PDF document
|
|
@arg {string} s creator */
|
|
function setCreator(pdf, s) {}
|
|
|
|
/** Sets the producer of a document.
|
|
@arg {pdf} pdf PDF document
|
|
@arg {string} s producer */
|
|
function setProducer(pdf, s) {}
|
|
|
|
/** Sets the creation date of a document.
|
|
@arg {pdf} pdf PDF document
|
|
@arg {string} s creation date */
|
|
function setCreationDate(pdf, s) {}
|
|
|
|
/** Sets the modification date of a document.
|
|
@arg {pdf} pdf PDF document
|
|
@arg {string} s modification date */
|
|
function setModificationDate(pdf, s) {}
|
|
|
|
/** Sets the XMP title of a document.
|
|
@arg {pdf} pdf PDF document
|
|
@arg {string} s XMP title */
|
|
function setTitleXMP(pdf, s) {}
|
|
|
|
/** Sets the XMP author of a document.
|
|
@arg {pdf} pdf PDF document
|
|
@arg {string} s XMP author */
|
|
function setAuthorXMP(pdf, s) {}
|
|
|
|
/** Sets the XMP author of a document.
|
|
@arg {pdf} pdf PDF document
|
|
@arg {string} s XMP subject */
|
|
function setSubjectXMP(pdf, s) {}
|
|
|
|
/** Sets the XMP keywords of a document.
|
|
@arg {pdf} pdf PDF document
|
|
@arg {string} s XMP keywords */
|
|
function setKeywordsXMP(pdf, s) {}
|
|
|
|
/** Sets the XMP creator of a document.
|
|
@arg {pdf} pdf PDF document
|
|
@arg {string} s XMP creator */
|
|
function setCreatorXMP(pdf, s) {}
|
|
|
|
/** Sets the XMP producer of a document.
|
|
@arg {pdf} pdf PDF document
|
|
@arg {string} s XMP producer */
|
|
function setProducerXMP(pdf, s) {}
|
|
|
|
/** Sets the XMP creation date of a document.
|
|
@arg {pdf} pdf PDF document
|
|
@arg {string} s XMP creation date */
|
|
function setCreationDateXMP(pdf, s) {}
|
|
|
|
/** Sets the XMP modification date of a document.
|
|
@arg {pdf} pdf PDF document
|
|
@arg {string} s XMP modification date */
|
|
function setModificationDateXMP(pdf, s) {}
|
|
|
|
/** Returns the components from a PDF date string.
|
|
@arg {string} string date string
|
|
@return {"array of numbers"} date components */
|
|
function getDateComponents(string) {}
|
|
|
|
/** Builds a PDF date string from individual components.
|
|
@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) {}
|
|
|
|
/** Gets the viewing rotation for a given page.
|
|
@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,
|
|
min y, max y in points. Only succeeds if such a box exists, as checked by
|
|
hasBox.
|
|
@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,
|
|
min y, max y in points. Only succeeds if such a box exists, as checked by
|
|
hasBox.
|
|
@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,
|
|
min y, max y in points. Only succeeds if such a box exists, as checked by
|
|
hasBox.
|
|
@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,
|
|
min y, max y in points. Only succeeds if such a box exists, as checked by
|
|
hasBox.
|
|
@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,
|
|
min y, max y in points. Only succeeds if such a box exists, as checked by
|
|
hasBox.
|
|
@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,
|
|
min y, max y in points.
|
|
@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,
|
|
min y, max y in points.
|
|
@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,
|
|
min y, max y in points.
|
|
@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,
|
|
min y, max y in points.
|
|
@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,
|
|
min y, max y in points.
|
|
@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.
|
|
@arg {pdf} pdf PDF document */
|
|
function markTrapped(pdf) {}
|
|
|
|
/** Marks a document as untrapped.
|
|
@arg {pdf} pdf PDF document */
|
|
function markUntrapped(pdf) {}
|
|
|
|
/** Marks a document as trapped in XMP metadata.
|
|
@arg {pdf} pdf PDF document */
|
|
function markTrappedXMP(pdf) {}
|
|
|
|
/** Marks a document as untrapped in XMP metadata.
|
|
@arg {pdf} pdf PDF document */
|
|
function markUntrappedXMP(pdf) {}
|
|
|
|
/** 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;
|
|
|
|
/** Sets the page layout for a document.
|
|
@arg {pdf} pdf PDF document
|
|
@arg {layout} layout page layout */
|
|
function setPageLayout(pdf, layout) {}
|
|
|
|
/** 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;
|
|
|
|
/** 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
|
|
number.
|
|
@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.
|
|
@arg {pdf} pdf PDF document
|
|
@arg {string} filename file name */
|
|
function setMetadataFromFile(pdf, filename) {}
|
|
|
|
/** Sets the XMP metadata from an array of bytes.
|
|
@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.
|
|
@arg {pdf} pdf PDF document */
|
|
function removeMetadata(pdf) {}
|
|
|
|
/** Returns the XMP metadata from a document.
|
|
@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
|
|
document.
|
|
@arg {pdf} pdf PDF document */
|
|
function createMetadata(pdf) {}
|
|
|
|
/** 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. */
|
|
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
|
|
the page range the labels apply to. Offset can be used to shift the numbering
|
|
up or down.
|
|
@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.
|
|
@arg {pdf} pdf PDF document */
|
|
function removePageLabels(pdf) {}
|
|
|
|
/** Calculates the full label string for a given page, and returns it.
|
|
@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
|
|
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 {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() {}
|
|
|