261 lines
7.6 KiB
TeX
261 lines
7.6 KiB
TeX
// CHAPTER 11. Document Information and Metadata
|
|
|
|
/** Finds out if a document is linearized as quickly as possible without
|
|
loading it. */
|
|
function isLinearized(filename)
|
|
|
|
/** Returns the minor version number of a document. */
|
|
function getVersion(pdf)
|
|
|
|
/** Returns the major version number of a document. */
|
|
function getMajorVersion(pdf)
|
|
|
|
/** Returns the title of a document. */
|
|
function getTitle(pdf)
|
|
|
|
/** Returns the author of a document. */
|
|
function getAuthor(pdf)
|
|
|
|
/** Returns the subject of a document. */
|
|
function getSubject(pdf)
|
|
|
|
/** Returns the keywords of a document. */
|
|
function getKeywords(pdf)
|
|
|
|
/** Returns the creator of a document. */
|
|
function getCreator(pdf)
|
|
|
|
/** Returns the producer of a document. */
|
|
function getProducer(pdf)
|
|
|
|
/** Returns the creation date of a document. */
|
|
function getCreationDate(pdf)
|
|
|
|
/** Returns the modification date of a document. */
|
|
function getModificationDate(pdf)
|
|
|
|
/** Returns the XMP title of a document. */
|
|
function getTitleXMP(pdf)
|
|
|
|
/** Returns the XMP author of a document. */
|
|
function getAuthorXMP(pdf)
|
|
|
|
/** Returns the XMP subject of a document. */
|
|
function getSubjectXMP(pdf)
|
|
|
|
/** Returns the XMP keywords of a document. */
|
|
function getKeywordsXMP(pdf)
|
|
|
|
/** Returns the XMP creator of a document. */
|
|
function getCreatorXMP(pdf)
|
|
|
|
/** Returns the XMP producer of a document. */
|
|
function getProducerXMP(pdf)
|
|
|
|
/** Returns the XMP creation date of a document. */
|
|
function getCreationDateXMP(pdf)
|
|
|
|
/** Returns the XMP modification date of a document. */
|
|
function getModificationDateXMP(pdf)
|
|
|
|
/** Sets the title of a document. */
|
|
function setTitle(pdf, s)
|
|
|
|
/** Sets the author of a document. */
|
|
function setAuthor(pdf, s)
|
|
|
|
/** Sets the subject of a document. */
|
|
function setSubject(pdf, s)
|
|
|
|
/** Sets the keywords of a document. */
|
|
function setKeywords(pdf, s)
|
|
|
|
/** Sets the creator of a document. */
|
|
function setCreator(pdf, s)
|
|
|
|
/** Sets the producer of a document. */
|
|
function setProducer(pdf, s)
|
|
|
|
/** Sets the creation date of a document. */
|
|
function setCreationDate(pdf, s)
|
|
|
|
/** Sets the modification date of a document. */
|
|
function setModificationDate(pdf, s)
|
|
|
|
/** Sets the XMP title of a document. */
|
|
function setTitleXMP(pdf, s)
|
|
|
|
/** Sets the XMP author of a document. */
|
|
function setAuthorXMP(pdf, s)
|
|
|
|
/** Sets the XMP author of a document. */
|
|
function setSubjectXMP(pdf, s)
|
|
|
|
/** Sets the XMP keywords of a document. */
|
|
function setKeywordsXMP(pdf, s)
|
|
|
|
/** Sets the XMP creator of a document. */
|
|
function setCreatorXMP(pdf, s)
|
|
|
|
/** Sets the XMP producer of a document. */
|
|
function setProducerXMP(pdf, s)
|
|
|
|
/** Sets the XMP creation date of a document. */
|
|
function setCreationDateXMP(pdf, s)
|
|
|
|
/** Sets the XMP modification date of a document. */
|
|
function setModificationDateXMP(pdf, s)
|
|
|
|
/** Returns the components from a PDF date string. */
|
|
function getDateComponents(string)
|
|
|
|
/** Builds a PDF date string from individual components. */
|
|
function dateStringOfComponents(y, m, d, h, min, sec, hour_offset, minute_offset)
|
|
|
|
/** Gets the viewing rotation for a given page. */
|
|
function getPageRotation(pdf, page)
|
|
|
|
/** Returns true, if that page has the given box. E.g "/CropBox". */
|
|
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. */
|
|
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. */
|
|
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. */
|
|
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. */
|
|
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. */
|
|
function getTrimBox(pdf, pagenumber)
|
|
|
|
/** These functions set a box given the document, page range, min x, max x,
|
|
min y, max y in points. */
|
|
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. */
|
|
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. */
|
|
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. */
|
|
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. */
|
|
function setArtBox(pdf, range, minx, maxx, miny, maxy)
|
|
|
|
/** Marks a document as trapped. */
|
|
function markTrapped(pdf)
|
|
|
|
/** Marks a document as untrapped. */
|
|
function markUntrapped(pdf)
|
|
|
|
/** Marks a document as trapped in XMP metadata. */
|
|
function markTrappedXMP(pdf)
|
|
|
|
/** Marks a document as untrapped in XMP metadata. */
|
|
function markUntrappedXMP(pdf)
|
|
|
|
|
|
/** Sets the page layout for a document. */
|
|
function setPageLayout(pdf, layout)
|
|
|
|
/** Sets the page mode for a document. */
|
|
function setPageMode(pdf, mode)
|
|
|
|
/** Sets the hide toolbar flag. */
|
|
function hideToolbar(pdf, flag)
|
|
|
|
/** Sets the hide menubar flag. */
|
|
function hideMenubar(pdf, flag)
|
|
|
|
/** Sets the hide window UI flag. */
|
|
function hideWindowUi(pdf, flag)
|
|
|
|
/** Sets the fit window flag. */
|
|
function fitWindow(pdf, flag)
|
|
|
|
/** Sets the center window flag. */
|
|
function centerWindow(pdf, flag)
|
|
|
|
/** Sets the display doc title flag. */
|
|
function displayDocTitle(pdf, flag)
|
|
|
|
/** Sets the PDF to open, possibly with zoom-to-fit, at the given page
|
|
number. */
|
|
function openAtPage(pdf, fit, pagenumber)
|
|
|
|
/** Sets the XMP metadata of a document, given a file name. */
|
|
function setMetadataFromFile(pdf, filename)
|
|
|
|
/** Sets the XMP metadata from an array of bytes. */
|
|
function setMetadataFromByteArray(pdf, data)
|
|
|
|
/** Removes the XMP metadata from a document. */
|
|
function removeMetadata(pdf)
|
|
|
|
/** Returns the XMP metadata from a document. */
|
|
function getMetadata(pdf)
|
|
|
|
/** Builds fresh XMP metadata as best it can from existing metadata in the
|
|
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)
|
|
|
|
/** 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. */
|
|
function addPageLabels(pdf, style, prefix, offset, range, progress)
|
|
|
|
/** Removes the page labels from the document. */
|
|
function removePageLabels(pdf)
|
|
|
|
/** Calculates the full label string for a given page, and returns it. */
|
|
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.
|
|
|
|
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:
|
|
|
|
labelstyle = LowercaseRoman
|
|
labelprefix = ""
|
|
startpage = 1
|
|
startvalue = 1
|
|
|
|
labelstyle = DecimalArabic
|
|
labelprefix = ""
|
|
startpage = 6
|
|
startvalue = 1 */
|
|
function startGetPageLabels(pdf)
|
|
function getPageLabelStyle(n)
|
|
function getPageLabelPrefix(n)
|
|
function getPageLabelOffset(n)
|
|
function getPageLabelRange(n)
|
|
function endGetPageLabels()
|