py docs done
This commit is contained in:
parent
af576c0208
commit
9997462436
BIN
cpdfmanual.pdf
BIN
cpdfmanual.pdf
Binary file not shown.
|
@ -1,6 +1,6 @@
|
||||||
\documentclass{book}
|
\documentclass{book}
|
||||||
% Edit here to produce cpdfmanual.pdf, cpdflibmanual.pdf, pycpdfmanual.pdf etc.
|
% Edit here to produce cpdfmanual.pdf, cpdflibmanual.pdf, pycpdfmanual.pdf etc.
|
||||||
\usepackage{comment}\excludecomment{cpdflib}\includecomment{pycpdflib}
|
\usepackage{comment}\excludecomment{cpdflib}\excludecomment{pycpdflib}
|
||||||
\usepackage{palatino}
|
\usepackage{palatino}
|
||||||
\usepackage{listings}
|
\usepackage{listings}
|
||||||
\usepackage{microtype}
|
\usepackage{microtype}
|
||||||
|
|
|
@ -1,31 +1,23 @@
|
||||||
/* CHAPTER 2. Merging and Splitting */
|
# CHAPTER 2. Merging and Splitting
|
||||||
|
|
||||||
/*
|
def mergeSimple(pdfs):
|
||||||
* cpdf_mergeSimple(pdfs, length) given an array of PDFs, and its length,
|
"""mergeSimple(pdfs), given a list of PDFs,
|
||||||
* merges the files into a new one, which is returned.
|
merges the files into a new one, which is returned."""
|
||||||
*/
|
|
||||||
int cpdf_mergeSimple(int *, int);
|
|
||||||
|
|
||||||
/*
|
def merge(pdfs, retain_numbering, remove_duplicate_fonts):
|
||||||
* cpdf_merge(pdfs, len, retain_numbering, remove_duplicate_fonts) merges the
|
"""merge(pdfs, retain_numbering, remove_duplicate_fonts) merges
|
||||||
* PDFs. If retain_numbering is true page labels are not rewritten. If
|
the list of PDFs. If retain_numbering is True page labels are not
|
||||||
* remove_duplicate_fonts is true, duplicate fonts are merged. This is useful
|
rewritten. If remove_duplicate_fonts is True, duplicate fonts are merged.
|
||||||
* when the source documents for merging originate from the same source.
|
This is useful when the source documents for merging originate from the
|
||||||
*/
|
same source."""
|
||||||
int cpdf_merge(int *, int, int, int);
|
|
||||||
|
|
||||||
/*
|
def mergeSame(pdfs, retain_numbering, remove_duplicate_fonts, ranges):
|
||||||
* cpdf_mergeSame(pdfs, len, retain_numbering, remove_duplicate_fonts,
|
"""mergeSame(pdfs, retain_numbering, remove_duplicate_fonts, ranges)
|
||||||
* ranges) is the same as cpdf_merge, except that it has an additional
|
is the same as merge, except that it has an additional argument
|
||||||
* argument - an array of page ranges. This is used to select the pages to
|
- an array of page ranges. This is used to select the pages to pick from
|
||||||
* pick from each PDF. This avoids duplication of information when multiple
|
each PDF. This avoids duplication of information when multiple discrete
|
||||||
* discrete parts of a source PDF are included.
|
parts of a source PDF are included."""
|
||||||
*/
|
|
||||||
int cpdf_mergeSame(int *, int, int, int, int *);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* cpdf_selectPages(pdf, range) returns a new document which just those pages
|
|
||||||
* in the page range.
|
|
||||||
*/
|
|
||||||
int cpdf_selectPages(int, int);
|
|
||||||
|
|
||||||
|
def selectPages(pdf, r):
|
||||||
|
""" selectPages(pdf, range) returns a new document which just those pages
|
||||||
|
in the page range."""
|
||||||
|
|
201
pysplits/c04.tex
201
pysplits/c04.tex
|
@ -1,152 +1,89 @@
|
||||||
/* CHAPTER 3. Pages */
|
# CHAPTER 3. Pages
|
||||||
|
|
||||||
/*
|
def scalePages(pdf, r, sx, sy):
|
||||||
* cpdf_scalePages(pdf, range, x scale, y scale) scales the page dimensions
|
"""scalePages(pdf, range, x scale, y scale) scales the page dimensions
|
||||||
* and content by the given scale, about (0, 0). Other boxes (crop etc. are
|
and content by the given scale, about (0, 0). Other boxes (crop etc. are
|
||||||
* altered as appropriate)
|
altered as appropriate)"""
|
||||||
*/
|
|
||||||
void cpdf_scalePages(int, int, double, double);
|
|
||||||
|
|
||||||
/*
|
def scaleToFit(pdf, r, sx, sy, scale_to_fit_scale):
|
||||||
* cpdf_scaleToFit(pdf, range, width height, scale) scales the content to fit
|
"""scaleToFit(pdf, range, width height, scale) scales the content to fit
|
||||||
* new page dimensions (width x height) multiplied by scale (typically 1.0).
|
new page dimensions (width x height) multiplied by scale (typically 1.0).
|
||||||
* Other boxed (crop etc. are altered as appropriate)
|
Other boxed (crop etc. are altered as appropriate)"""
|
||||||
*/
|
|
||||||
void cpdf_scaleToFit(int, int, double, double, double);
|
|
||||||
|
|
||||||
/*
|
def scaleToFitPaper(pdf, r, papersize, scale_to_fit_scale):
|
||||||
* cpdf_scaleToFitPaper(pdf, range, papersize, scale) scales the page content
|
"""scaleToFitPaper(pdf, range, papersize, scale) scales the page content
|
||||||
* to fit the given page size, possibly multiplied by scale (typically 1.0)
|
to fit the given page size, possibly multiplied by scale (typically 1.0)"""
|
||||||
*/
|
|
||||||
void cpdf_scaleToFitPaper(int, int, enum cpdf_papersize, double);
|
|
||||||
|
|
||||||
/* Positions on the page. Used for scaling about a point, and adding text. */
|
"""Positions with two numbers in a tuple e.g (posLeft, 10.0, 20.0):"""
|
||||||
enum cpdf_anchor {
|
posCentre = 0
|
||||||
cpdf_posCentre, /* Absolute centre */
|
posLeft = 1
|
||||||
cpdf_posLeft, /* Absolute left */
|
posRight = 2
|
||||||
cpdf_posRight, /* Absolute right */
|
"""Positions with one number in a tuple e.g (top, 5.0):"""
|
||||||
cpdf_top, /* Top top centre of the page */
|
top = 3
|
||||||
cpdf_topLeft, /* The top left of the page */
|
topLeft = 4
|
||||||
cpdf_topRight, /* The top right of the page */
|
topRight = 5
|
||||||
cpdf_left, /* The left hand side of the page, halfway
|
left = 6
|
||||||
* down */
|
bottomLeft = 7
|
||||||
cpdf_bottomLeft, /* The bottom left of the page */
|
bottomRight = 8
|
||||||
cpdf_bottom, /* The bottom middle of the page */
|
right = 9
|
||||||
cpdf_bottomRight, /* The bottom right of the page */
|
"""Positions with no numbers e.g diagonal:"""
|
||||||
cpdf_right, /* The right hand side of the page, halfway
|
diagonal = 10
|
||||||
* down */
|
reverseDiagonal = 11
|
||||||
cpdf_diagonal, /* Diagonal, bottom left to top right */
|
|
||||||
cpdf_reverseDiagonal /* Diagonal, top left to bottom right */
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
def scaleContents(pdf, r, pos, scale):
|
||||||
* A cpdf_position is an anchor (above) and zero or one or two parameters
|
"""scaleContents(pdf, range, position, scale) scales the contents of the
|
||||||
* (cpdf_coord1, cpdf_coord2).
|
pages in the range about the point given by the position, by the
|
||||||
*
|
scale given."""
|
||||||
* cpdf_posCentre: Two parameters, x and y
|
|
||||||
*
|
|
||||||
* cpdf_posLeft: Two parameters, x and y
|
|
||||||
*
|
|
||||||
* cpdf_posRight: Two parameters, x and y
|
|
||||||
*
|
|
||||||
* cpdf_top: One parameter -- distance from top
|
|
||||||
*
|
|
||||||
* cpdf_topLeft: One parameter -- distance from top left
|
|
||||||
*
|
|
||||||
* cpdf_topRight: One parameter -- distance from top right
|
|
||||||
*
|
|
||||||
* cpdf_left: One parameter -- distance from left middle
|
|
||||||
*
|
|
||||||
* cpdf_bottomLeft: One parameter -- distance from bottom left
|
|
||||||
*
|
|
||||||
* cpdf_bottom: One parameter -- distance from bottom
|
|
||||||
*
|
|
||||||
* cpdf_bottomRight: One parameter -- distance from bottom right
|
|
||||||
*
|
|
||||||
* cpdf_right: One parameter -- distance from right
|
|
||||||
*
|
|
||||||
* cpdf_diagonal: Zero parameters
|
|
||||||
*
|
|
||||||
* cpdf_reverseDiagonal: Zero parameters
|
|
||||||
*/
|
|
||||||
struct cpdf_position {
|
|
||||||
int cpdf_anchor; /* Position anchor */
|
|
||||||
double cpdf_coord1; /* Parameter one */
|
|
||||||
double cpdf_coord2; /* Parameter two */
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
def shiftContents(pdf, r, dx, dy):
|
||||||
* cpdf_scaleContents(pdf, range, position, scale) scales the contents of the
|
"""shiftContents(pdf, range, dx, dy) shifts the content of the pages in
|
||||||
* pages in the range about the point given by the cpdf_position, by the
|
the range."""
|
||||||
* scale given.
|
|
||||||
*/
|
|
||||||
void cpdf_scaleContents(int, int, struct cpdf_position, double);
|
|
||||||
|
|
||||||
/*
|
def rotate(pdf, r, rotation):
|
||||||
* cpdf_shiftContents(pdf, range, dx, dy) shifts the content of the pages in
|
"""rotate(pdf, range, rotation) changes the viewing rotation to an
|
||||||
* the range.
|
absolute value. Appropriate rotations are 0, 90, 180, 270."""
|
||||||
*/
|
|
||||||
void cpdf_shiftContents(int, int, double, double);
|
|
||||||
|
|
||||||
/*
|
def rotateBy(pdf, r, rotation):
|
||||||
* cpdf_rotate(pdf, range, rotation) changes the viewing rotation to an
|
"""rotateBy(pdf, range, rotation) changes the viewing rotation by a
|
||||||
* absolute value. Appropriate rotations are 0, 90, 180, 270.
|
given number of degrees. Appropriate values are 90, 180, 270."""
|
||||||
*/
|
|
||||||
void cpdf_rotate(int, int, int);
|
|
||||||
|
|
||||||
/*
|
def rotateContents(pdf, r, rotation):
|
||||||
* cpdf_rotateBy(pdf, range, rotation) changes the viewing rotation by a
|
"""rotateContents(pdf, range, angle) rotates the content about the centre
|
||||||
* given number of degrees. Appropriate values are 90, 180, 270.
|
of the page by the given number of degrees, in a clockwise direction."""
|
||||||
*/
|
|
||||||
void cpdf_rotateBy(int, int, int);
|
|
||||||
|
|
||||||
/*
|
def upright(pdf, r):
|
||||||
* cpdf_rotateContents(pdf, range, angle) rotates the content about the
|
"""upright(pdf, range) changes the viewing rotation of the pages in the
|
||||||
* centre of the page by the given number of degrees, in a clockwise
|
range, counter-rotating the dimensions and content such that there is no
|
||||||
* direction.
|
visual change."""
|
||||||
*/
|
|
||||||
void cpdf_rotateContents(int, int, double);
|
|
||||||
|
|
||||||
/*
|
def hFlip(pdf, r):
|
||||||
* cpdf_upright(pdf, range) changes the viewing rotation of the pages in the
|
"""hFlip(pdf, range) flips horizontally the pages in the range."""
|
||||||
* range, counter-rotating the dimensions and content such that there is no
|
|
||||||
* visual change.
|
|
||||||
*/
|
|
||||||
void cpdf_upright(int, int);
|
|
||||||
|
|
||||||
/* cpdf_hFlip(pdf, range) flips horizontally the pages in the range. */
|
def vFlip(pdf, r):
|
||||||
void cpdf_hFlip(int, int);
|
"""vFlip(pdf, range) flips vertically the pages in the range."""
|
||||||
|
|
||||||
/* cpdf_vFlip(pdf, range) flips vertically the pages in the range. */
|
def crop(pdf, r, x, y, w, h):
|
||||||
void cpdf_vFlip(int, int);
|
"""crop(pdf, range, x, y, w, h) crops a page, replacing any existing
|
||||||
|
crop box. The dimensions are in points."""
|
||||||
|
|
||||||
/*
|
def removeCrop(pdf, r):
|
||||||
* cpdf_crop(pdf, range, x, y, w, h) crops a page, replacing any existing
|
"""removeCrop(pdf, range) removes any crop box from pages in the range."""
|
||||||
* crop box. The dimensions are in points.
|
|
||||||
*/
|
|
||||||
void cpdf_crop(int, int, double, double, double, double);
|
|
||||||
|
|
||||||
/* cpdf_removeCrop(pdf, range) removes any crop box from pages in the range. */
|
def removeTrim(pdf, r):
|
||||||
void cpdf_removeCrop(int, int);
|
"""removeTrim(pdf, range) removes any crop box from pages in the range."""
|
||||||
|
|
||||||
/* cpdf_removeTrim(pdf, range) removes any crop box from pages in the range. */
|
def removeArt(pdf, r):
|
||||||
void cpdf_removeTrim(int, int);
|
"""removeArt(pdf, range) removes any crop box from pages in the range."""
|
||||||
|
|
||||||
/* cpdf_removeArt(pdf, range) removes any crop box from pages in the range. */
|
def removeBleed(pdf, r):
|
||||||
void cpdf_removeArt(int, int);
|
"""removeBleed(pdf, range) removes any crop box from pages in the range."""
|
||||||
|
|
||||||
/* cpdf_removeBleed(pdf, range) removes any crop box from pages in the range. */
|
def trimMarks(pdf, r):
|
||||||
void cpdf_removeBleed(int, int);
|
"""trimMarks(pdf, range) adds trim marks to the given pages, if the trimbox
|
||||||
|
exists."""
|
||||||
|
|
||||||
/*
|
def showBoxes(pdf, r):
|
||||||
* cpdf_trimMarks(pdf, range) adds trim marks to the given pages, if the
|
"""showBoxes(pdf, range) shows the boxes on the given pages, for debug."""
|
||||||
* trimbox exists.
|
|
||||||
*/
|
|
||||||
void cpdf_trimMarks(int, int);
|
|
||||||
|
|
||||||
/* cpdf_showBoxes(pdf, range) shows the boxes on the given pages, for debug. */
|
|
||||||
void cpdf_showBoxes(int, int);
|
|
||||||
|
|
||||||
/* cpdf_hardBox make a given box a 'hard box' i.e clips it explicitly. */
|
|
||||||
void cpdf_hardBox(int, int, const char[]);
|
|
||||||
|
|
||||||
|
def hardBox(pdf, r, boxname):
|
||||||
|
"""hardBox make a given box a 'hard box' i.e clips it explicitly."""
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
/* CHAPTER 4. Encryption */
|
# CHAPTER 4. Encryption
|
||||||
|
|
||||||
/* Encryption covered under Chapter 1 in cpdflib. */
|
|
||||||
|
|
||||||
|
# Encryption covered under Chapter 1 in pycpdflib
|
||||||
|
|
|
@ -1,17 +1,12 @@
|
||||||
/* CHAPTER 5. Compression */
|
# CHAPTER 5. Compression
|
||||||
|
|
||||||
/*
|
def compress(pdf):
|
||||||
* cpdf_compress(pdf) compresses any uncompressed streams in the given PDF
|
"""compress(pdf) compresses any uncompressed streams in the given PDF
|
||||||
* using the Flate algorithm.
|
using the Flate algorithm."""
|
||||||
*/
|
|
||||||
void cpdf_compress(int);
|
|
||||||
|
|
||||||
/*
|
def decompress(pdf):
|
||||||
* cpdf_uncompress(pdf) uncompresses any streams in the given PDF, so long as
|
"""uncompress(pdf) uncompresses any streams in the given PDF, so long as
|
||||||
* the compression method is supported.
|
the compression method is supported."""
|
||||||
*/
|
|
||||||
void cpdf_decompress(int);
|
|
||||||
|
|
||||||
/* cpdf_squeezeToMemory(pdf) squeezes a pdf in memory. */
|
|
||||||
void cpdf_squeezeInMemory(int);
|
|
||||||
|
|
||||||
|
def squeezeInMemory(pdf):
|
||||||
|
"""squeezeToMemory(pdf) squeezes a pdf in memory."""
|
||||||
|
|
|
@ -1,70 +1,9 @@
|
||||||
/* CHAPTER 6. Bookmarks */
|
# CHAPTER 6. Bookmarks
|
||||||
|
|
||||||
/*
|
def getBookmarks(pdf):
|
||||||
* cpdf_startGetBookmarkInfo(pdf) start the bookmark retrieval process for a
|
"""Get the bookmarks for a PDF as a list of tuples.
|
||||||
* given PDF.
|
(level : int, page : int, text : string, openstatus : bool)"""
|
||||||
*/
|
|
||||||
void cpdf_startGetBookmarkInfo(int);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* cpdf_numberBookmarks gets the number of bookmarks for the PDF given to
|
|
||||||
* cpdf_startGetBookmarkInfo.
|
|
||||||
*/
|
|
||||||
int cpdf_numberBookmarks(void);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* cpdf_getBookmarkLevel(serial) get bookmark level for the given bookmark
|
|
||||||
* (0...(n - 1)).
|
|
||||||
*/
|
|
||||||
int cpdf_getBookmarkLevel(int);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* cpdf_getBookmarkPage gets the bookmark target page for the given PDF
|
|
||||||
* (which must be the same as the PDF passed to cpdf_startSetBookmarkInfo)
|
|
||||||
* and bookmark (0...(n - 1)).
|
|
||||||
*/
|
|
||||||
int cpdf_getBookmarkPage(int, int);
|
|
||||||
|
|
||||||
/* cpdf_getBookmarkText returns the text of bookmark (0...(n - 1)). */
|
|
||||||
char *cpdf_getBookmarkText(int);
|
|
||||||
|
|
||||||
/* cpdf_getBookmarkOpenStatus(pdf) is true if the bookmark is open. */
|
|
||||||
int cpdf_getBookmarkOpenStatus(int);
|
|
||||||
|
|
||||||
/* cpdf_endGetBookmarkInfo ends the bookmark retrieval process, cleaning up. */
|
|
||||||
void cpdf_endGetBookmarkInfo(void);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* cpdf_startGetBookmarkInfo(n) start the bookmark setting process for n
|
|
||||||
* bookmarks.
|
|
||||||
*/
|
|
||||||
void cpdf_startSetBookmarkInfo(int);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* cpdf_setBookmarkLevel(n, level) set bookmark level for the given bookmark
|
|
||||||
* (0...(n - 1)).
|
|
||||||
*/
|
|
||||||
void cpdf_setBookmarkLevel(int, int);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* cpdf_setBookmarkPage(pdf, bookmark, targetpage) sets the bookmark target
|
|
||||||
* page for the given PDF (which must be the same as the PDF to be passed to
|
|
||||||
* cpdf_endSetBookmarkInfo) and bookmark (0...(n - 1)).
|
|
||||||
*/
|
|
||||||
void cpdf_setBookmarkPage(int, int, int);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* cpdf_setBookmarkOpenStatus(n, status) set the open status of a bookmark,
|
|
||||||
* true or false.
|
|
||||||
*/
|
|
||||||
void cpdf_setBookmarkOpenStatus(int, int);
|
|
||||||
|
|
||||||
/* cpdf_setBookmarkText(n, text) sets the text of bookmark (0...(n - 1)). */
|
|
||||||
void cpdf_setBookmarkText(int, const char[]);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* cpdf_endSetBookmarkInfo(pdf) end the bookmark setting process, writing the
|
|
||||||
* bookmarks to the given PDF.
|
|
||||||
*/
|
|
||||||
void cpdf_endSetBookmarkInfo(int);
|
|
||||||
|
|
||||||
|
def setBookmarks(pdf, marks):
|
||||||
|
"""Set the bookmarks for a PDF as a list of tuples.
|
||||||
|
(level : int, page : int, text : string, openstatus : bool)"""
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
/* CHAPTER 7. Presentations */
|
# CHAPTER 7. Presentations
|
||||||
|
|
||||||
/* Not included in the library version. */
|
|
||||||
|
|
||||||
|
# Not included in the library version
|
||||||
|
|
235
pysplits/c09.tex
235
pysplits/c09.tex
|
@ -1,175 +1,130 @@
|
||||||
/* CHAPTER 8. Logos, Watermarks and Stamps */
|
# CHAPTER 8. Logos, Watermarks and Stamps
|
||||||
|
|
||||||
/*
|
def stampOn(pdf, pdf2, r):
|
||||||
* cpdf_stampOn(stamp_pdf, pdf, range) stamps stamp_pdf on top of all the
|
"""stampOn(stamp_pdf, pdf, range) stamps stamp_pdf on top of all the
|
||||||
* pages in the document which are in the range. The stamp is placed with its
|
pages in the document which are in the range. The stamp is placed with its
|
||||||
* origin at the origin of the target document.
|
origin at the origin of the target document."""
|
||||||
*/
|
|
||||||
void cpdf_stampOn(int, int, int);
|
|
||||||
|
|
||||||
/*
|
def stampUnder(pdf, pdf2, r):
|
||||||
* cpdf_stampUnder(stamp_pdf, pdf, range) stamps stamp_pdf under all the
|
"""stampUnder(stamp_pdf, pdf, range) stamps stamp_pdf under all the pages
|
||||||
* pages in the document which are in the range. The stamp is placed with its
|
in the document which are in the range. The stamp is placed with its origin
|
||||||
* origin at the origin of the target document.
|
at the origin of the target document."""
|
||||||
*/
|
|
||||||
void cpdf_stampUnder(int, int, int);
|
|
||||||
|
|
||||||
/*
|
def stampExtended(pdf, pdf2, r, isover, scale_stamp_to_fit, pos,
|
||||||
* cpdf_stampExtended(pdf, pdf2, range, isover, scale_stamp_to_fit, pos,
|
relative_to_cropbox):
|
||||||
* relative_to_cropbox) is a stamping function with extra features. - isover
|
"""stampExtended(pdf, pdf2, range, isover, scale_stamp_to_fit, pos,
|
||||||
* true, pdf goes over pdf2, isover false, pdf goes under pdf2 -
|
relative_to_cropbox) is a stamping function with extra features.
|
||||||
* scale_stamp_to_fit scales the stamp to fit the page - pos gives the
|
- isover True, pdf goes over pdf2, isover False, pdf goes under pdf2
|
||||||
* position to put the stamp - relative_to_cropbox: if true, pos is relative
|
- scale_stamp_to_fit scales the stamp to fit the page
|
||||||
* to cropbox not mediabox.
|
- pos gives the position to put the stamp
|
||||||
*/
|
- relative_to_cropbox: if True, pos is relative to cropbox not mediabox"""
|
||||||
void cpdf_stampExtended(int, int, int, int, int, struct cpdf_position, int);
|
|
||||||
|
|
||||||
/*
|
def combinePages(pdf, pdf2):
|
||||||
* cpdf_combinePages(under, over) combines the PDFs page-by-page, putting
|
"""combinePages(under, over) combines the PDFs page-by-page, putting
|
||||||
* each page of 'over' over each page of 'under'.
|
each page of 'over' over each page of 'under'"""
|
||||||
*/
|
|
||||||
int cpdf_combinePages(int, int);
|
|
||||||
|
|
||||||
/* Adding text. Adds text to a PDF, if the characters exist in the font. */
|
"""Fonts."""
|
||||||
|
timesRoman
|
||||||
|
timesBold
|
||||||
|
timesItalic
|
||||||
|
timesBoldItalic
|
||||||
|
helvetica
|
||||||
|
helveticaBold
|
||||||
|
helveticaOblique
|
||||||
|
helveticaBoldOblique
|
||||||
|
courier
|
||||||
|
courierBold
|
||||||
|
courierOblique
|
||||||
|
courierBoldOblique
|
||||||
|
|
||||||
|
"""Jusitifications."""
|
||||||
|
leftJustify
|
||||||
|
centreJustify
|
||||||
|
rightJustify
|
||||||
|
|
||||||
|
|
||||||
|
def addText(metrics, pdf, r, text, p, line_spacing, bates, font, size, red,
|
||||||
|
green, blue, underneath, relative_to_cropbox, outline, opacity,
|
||||||
|
justification, midline, topline, filename, line_width,
|
||||||
|
embed_fonts):
|
||||||
|
"""Adding text. Adds text to a PDF, if the characters exist in the font.
|
||||||
|
|
||||||
|
* metrics: If True, don't actually add text but collect metrics.
|
||||||
|
* pdf: Document
|
||||||
|
* r: Page Range
|
||||||
|
* text: The text to add
|
||||||
|
* p: Position to add text at
|
||||||
|
* line_spacing: Linespacing, 1.0 = normal
|
||||||
|
* bates: Starting Bates number
|
||||||
|
* font: Font
|
||||||
|
* size: Font size in points
|
||||||
|
* red: Red component of colour, 0.0 - 1.0
|
||||||
|
* green: Green component of colour, 0.0 - 1.0
|
||||||
|
* blue: Blue component of colour, 0.0 - 1.0
|
||||||
|
* underneath: If True, text is added underneath rather than on top
|
||||||
|
* relative_to_cropbox: If True, position is relative to crop box not
|
||||||
|
media box
|
||||||
|
* outline: If True, text is outline rather than filled
|
||||||
|
* opacity: Opacity, 1.0 = opaque, 0.0 = wholly transparent
|
||||||
|
* justification: Justification
|
||||||
|
* midline: If True, position is relative to midline of text, not
|
||||||
|
baseline
|
||||||
|
* topline: If True, position is relative to topline of text, not
|
||||||
|
baseline
|
||||||
|
* filename: filename that this document was read from (optional)
|
||||||
|
* line_width: line width
|
||||||
|
* embed_fonts: embed fonts
|
||||||
|
|
||||||
|
Special codes
|
||||||
|
|
||||||
/*
|
|
||||||
* Special codes
|
|
||||||
*
|
|
||||||
* %Page Page number in arabic notation (1, 2, 3...)
|
* %Page Page number in arabic notation (1, 2, 3...)
|
||||||
*
|
|
||||||
* %roman Page number in lower-case roman notation (i, ii, iii...)
|
* %roman Page number in lower-case roman notation (i, ii, iii...)
|
||||||
*
|
|
||||||
* %Roman Page number in upper-case roman notation (I, II, III...)
|
* %Roman Page number in upper-case roman notation (I, II, III...)
|
||||||
*
|
|
||||||
* %EndPage Last page of document in arabic notation
|
* %EndPage Last page of document in arabic notation
|
||||||
*
|
|
||||||
* %Label The page label of the page
|
* %Label The page label of the page
|
||||||
*
|
|
||||||
* %EndLabel The page label of the last page
|
* %EndLabel The page label of the last page
|
||||||
*
|
|
||||||
* %filename The full file name of the input document
|
* %filename The full file name of the input document
|
||||||
*
|
|
||||||
* %a Abbreviated weekday name (Sun, Mon etc.)
|
* %a Abbreviated weekday name (Sun, Mon etc.)
|
||||||
*
|
|
||||||
* %A Full weekday name (Sunday, Monday etc.)
|
* %A Full weekday name (Sunday, Monday etc.)
|
||||||
*
|
|
||||||
* %b Abbreviated month name (Jan, Feb etc.)
|
* %b Abbreviated month name (Jan, Feb etc.)
|
||||||
*
|
|
||||||
* %B Full month name (January, February etc.)
|
* %B Full month name (January, February etc.)
|
||||||
*
|
|
||||||
* %d Day of the month (01-31)
|
* %d Day of the month (01-31)
|
||||||
*
|
|
||||||
* %e Day of the month (1-31)
|
* %e Day of the month (1-31)
|
||||||
*
|
|
||||||
* %H Hour in 24-hour clock (00-23)
|
* %H Hour in 24-hour clock (00-23)
|
||||||
*
|
|
||||||
* %I Hour in 12-hour clock (01-12)
|
* %I Hour in 12-hour clock (01-12)
|
||||||
*
|
|
||||||
* %j Day of the year (001-366)
|
* %j Day of the year (001-366)
|
||||||
*
|
|
||||||
* %m Month of the year (01-12)
|
* %m Month of the year (01-12)
|
||||||
*
|
|
||||||
* %M Minute of the hour (00-59)
|
* %M Minute of the hour (00-59)
|
||||||
*
|
|
||||||
* %p "a.m" or "p.m"
|
* %p "a.m" or "p.m"
|
||||||
*
|
|
||||||
* %S Second of the minute (00-61)
|
* %S Second of the minute (00-61)
|
||||||
*
|
|
||||||
* %T Same as %H:%M:%S
|
* %T Same as %H:%M:%S
|
||||||
*
|
|
||||||
* %u Weekday (1-7, 1 = Monday)
|
* %u Weekday (1-7, 1 = Monday)
|
||||||
*
|
|
||||||
* %w Weekday (0-6, 0 = Monday)
|
* %w Weekday (0-6, 0 = Monday)
|
||||||
*
|
|
||||||
* %Y Year (0000-9999)
|
* %Y Year (0000-9999)
|
||||||
*
|
* %% The % character"""
|
||||||
* %% The % character
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* The standard fonts */
|
def addTextSimple(pdf, r, text, p, font, size):
|
||||||
enum cpdf_font {
|
"""like addText, but with most parameters default
|
||||||
cpdf_timesRoman, /* Times Roman */
|
* pdf = the document
|
||||||
cpdf_timesBold, /* Times Bold */
|
* r = the range
|
||||||
cpdf_timesItalic, /* Times Italic */
|
* p = the position
|
||||||
cpdf_timesBoldItalic, /* Times Bold Italic */
|
* font = the font
|
||||||
cpdf_helvetica, /* Helvetica */
|
* size = the font size"""
|
||||||
cpdf_helveticaBold, /* Helvetica Bold */
|
|
||||||
cpdf_helveticaOblique, /* Helvetica Oblique */
|
|
||||||
cpdf_helveticaBoldOblique, /* Helvetica Bold Oblique */
|
|
||||||
cpdf_courier, /* Courier */
|
|
||||||
cpdf_courierBold, /* Courier Bold */
|
|
||||||
cpdf_courierOblique, /* Courier Oblique */
|
|
||||||
cpdf_courierBoldOblique /* Courier Bold Oblique */
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Justifications for multi line text */
|
def removeText(pdf, r):
|
||||||
enum cpdf_justification {
|
"""removeText(pdf, range) will remove any text added by libcpdf from the
|
||||||
cpdf_leftJustify, /* Left justify */
|
given pages."""
|
||||||
cpdf_CentreJustify, /* Centre justify */
|
|
||||||
cpdf_RightJustify /* Right justify */
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Add text */
|
def textWidth(font, string):
|
||||||
void cpdf_addText(int, /* If true, don't actually add text but
|
"""Return the width of a given string in the given font in thousandths of a
|
||||||
* collect metrics. */
|
point."""
|
||||||
int, /* Document */
|
|
||||||
int, /* Page Range */
|
|
||||||
const char[], /* The text to add */
|
|
||||||
struct cpdf_position, /* Position to add text at */
|
|
||||||
double, /* Linespacing, 1.0 = normal */
|
|
||||||
int, /* Starting Bates number */
|
|
||||||
enum cpdf_font, /* Font */
|
|
||||||
double, /* Font size in points */
|
|
||||||
double, /* Red component of colour, 0.0 - 1.0 */
|
|
||||||
double, /* Green component of colour, 0.0 - 1.0 */
|
|
||||||
double, /* Blue component of colour, 0.0 - 1.0 */
|
|
||||||
int, /* If true, text is added underneath rather
|
|
||||||
* than on top */
|
|
||||||
int, /* If true, position is relative to crop box
|
|
||||||
* not media box */
|
|
||||||
int, /* If true, text is outline rather than
|
|
||||||
* filled */
|
|
||||||
double, /* Opacity, 1.0 = opaque, 0.0 = wholly
|
|
||||||
* transparent */
|
|
||||||
enum cpdf_justification, /* Justification */
|
|
||||||
int, /* If true, position is relative to midline
|
|
||||||
* of text, not baseline */
|
|
||||||
int, /* If true, position is relative to topline
|
|
||||||
* of text, not baseline */
|
|
||||||
const char[], /* filename that this document was read from
|
|
||||||
* (optional) */
|
|
||||||
double, /* line width */
|
|
||||||
int /* embed fonts */
|
|
||||||
);
|
|
||||||
|
|
||||||
/* Add text, with most parameters default. */
|
def addContent(content, before, pdf, r):
|
||||||
void cpdf_addTextSimple(int, /* Document */
|
"""addContent(content, before, range, pdf) adds page content before (if
|
||||||
int, /* Page range */
|
True) or after (if False) the existing content to pages in the given range
|
||||||
const char[], /* The text to add */
|
in the given PDF."""
|
||||||
struct cpdf_position, /* Position to add text
|
|
||||||
* at */
|
|
||||||
enum cpdf_font, /* font */
|
|
||||||
double); /* font size */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* cpdf_removeText(pdf, range) will remove any text added by libcpdf from the
|
|
||||||
* given pages.
|
|
||||||
*/
|
|
||||||
void cpdf_removeText(int, int);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Return the width of a given string in the given font in thousandths of a
|
|
||||||
* point.
|
|
||||||
*/
|
|
||||||
int cpdf_textWidth(enum cpdf_font, const char[]);
|
|
||||||
|
|
||||||
/* cpdf_addContent(content, before, range, pdf) adds page content before (if
|
|
||||||
* true) or after (if false) the existing content to pages in the given range
|
|
||||||
* in the given PDF. */
|
|
||||||
void cpdf_addContent(const char[], int, int, int);
|
|
||||||
|
|
||||||
/* cpdf_stampAsXObject(pdf, range, stamp_pdf) 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. */
|
|
||||||
char *cpdf_stampAsXObject(int, int, int);
|
|
||||||
|
|
||||||
|
def stampAsXObject(pdf, r, stamp_pdf):
|
||||||
|
"""stampAsXObject(pdf, range, stamp_pdf) 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."""
|
||||||
|
|
|
@ -1,37 +1,30 @@
|
||||||
/* CHAPTER 9. Multipage facilities */
|
# CHAPTER 9. Mulitpage facilities
|
||||||
|
|
||||||
/*
|
def twoUp(pdf):
|
||||||
* Impose a document two up. cpdf_twoUp does so by retaining the existing
|
"""Impose a document two up. twoUp does so by retaining the existing page
|
||||||
* page size, scaling pages down. cpdf_twoUpStack does so by doubling the
|
size, scaling pages down. twoUpStack does so by doubling the page size,
|
||||||
* page size, to fit two pages on one.
|
to fit two pages on one."""
|
||||||
*/
|
|
||||||
void cpdf_twoUp(int);
|
|
||||||
void cpdf_twoUpStack(int);
|
|
||||||
|
|
||||||
/*
|
def twoUpStack(pdf):
|
||||||
* cpdf_padBefore(pdf, range) adds a blank page before each page in the given
|
"""Impose a document two up. twoUp does so by retaining the existing page
|
||||||
* range.
|
size, scaling pages down. twoUpStack does so by doubling the page size,
|
||||||
*/
|
to fit two pages on one."""
|
||||||
void cpdf_padBefore(int, int);
|
|
||||||
|
|
||||||
/*
|
def padBefore(pdf, r):
|
||||||
* cpdf_padAfter(pdf, range) adds a blank page after each page in the given
|
"""padBefore(pdf, range) adds a blank page before each page in the given
|
||||||
* range.
|
range"""
|
||||||
*/
|
|
||||||
void cpdf_padAfter(int, int);
|
|
||||||
|
|
||||||
/* cpdf_pageEvery(pdf, n) adds a blank page after every n pages. */
|
def padAfter(pdf, r):
|
||||||
void cpdf_padEvery(int, int);
|
"""padAfter(pdf, range) adds a blank page after each page in the given
|
||||||
|
range"""
|
||||||
|
|
||||||
/*
|
def padEvery(pdf, n):
|
||||||
* cpdf_padMultiple(pdf, n) adds pages at the end to pad the file to a
|
"""pageEvery(pdf, n) adds a blank page after every n pages"""
|
||||||
* multiple of n pages in length.
|
|
||||||
*/
|
|
||||||
void cpdf_padMultiple(int, int);
|
|
||||||
|
|
||||||
/*
|
def padMultiple(pdf, n):
|
||||||
* cpdf_padMultiple(pdf, n) adds pages at the beginning to pad the file to a
|
"""padMultiple(pdf, n) adds pages at the end to pad the file to a multiple
|
||||||
* multiple of n pages in length.
|
of n pages in length."""
|
||||||
*/
|
|
||||||
void cpdf_padMultipleBefore(int, int);
|
|
||||||
|
|
||||||
|
def padMultipleBefore(pdf, n):
|
||||||
|
"""padMultiple(pdf, n) adds pages at the beginning to pad the file to a
|
||||||
|
multiple of n pages in length."""
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
/* CHAPTER 10. Annotations */
|
# CHAPTER 10. Annotations
|
||||||
|
|
||||||
/* Not in the library version */
|
|
||||||
|
|
||||||
|
# Not in the library version.
|
||||||
|
|
527
pysplits/c12.tex
527
pysplits/c12.tex
|
@ -1,303 +1,298 @@
|
||||||
/* CHAPTER 11. Document Information and Metadata */
|
# CHAPTER 11. Document Information and Metadata
|
||||||
|
|
||||||
/*
|
def isLinearized(filename):
|
||||||
* cpdf_isLinearized(filename) finds out if a document is linearized as
|
"""isLinearized(filename) finds out if a document is linearized as quickly
|
||||||
* quickly as possible without loading it.
|
as possible without loading it."""
|
||||||
*/
|
|
||||||
int cpdf_isLinearized(const char[]);
|
|
||||||
|
|
||||||
/* cpdf_getVersion(pdf) returns the minor version number of a document. */
|
def getVersion(pdf):
|
||||||
int cpdf_getVersion(int);
|
"""vetVersion(pdf) returns the minor version number of a document."""
|
||||||
|
|
||||||
/* cpdf_getMajorVersion(pdf) returns the minor version number of a document. */
|
def getMajorVersion(pdf):
|
||||||
int cpdf_getMajorVersion(int);
|
"""getMajorVersion(pdf) returns the minor version number of a document."""
|
||||||
|
|
||||||
/* cpdf_getTitle(pdf) returns the title of a document. */
|
def getTitle(pdf):
|
||||||
char *cpdf_getTitle(int);
|
"""getTitle(pdf) returns the title of a document."""
|
||||||
|
|
||||||
/* cpdf_getAuthor(pdf) returns the author of a document. */
|
def getAuthor(pdf):
|
||||||
char *cpdf_getAuthor(int);
|
"""getSubject(pdf) returns the subject of a document."""
|
||||||
|
|
||||||
/* cpdf_getSubject(pdf) returns the subject of a document. */
|
def getSubject(pdf):
|
||||||
char *cpdf_getSubject(int);
|
"""getSubject(pdf) returns the subject of a document."""
|
||||||
|
|
||||||
/* cpdf_getKeywords(pdf) returns the keywords of a document. */
|
def getKeywords(pdf):
|
||||||
char *cpdf_getKeywords(int);
|
"""getKeywords(pdf) returns the keywords of a document."""
|
||||||
|
|
||||||
/* cpdf_getCreator(pdf) returns the creator of a document. */
|
def getCreator(pdf):
|
||||||
char *cpdf_getCreator(int);
|
"""getCreator(pdf) returns the creator of a document."""
|
||||||
|
|
||||||
/* cpdf_getProducer(pdf) returns the producer of a document. */
|
def getProducer(pdf):
|
||||||
char *cpdf_getProducer(int);
|
"""getProducer(pdf) returns the producer of a document."""
|
||||||
|
|
||||||
/* cpdf_getCreationDate(pdf) returns the creation date of a document. */
|
def getCreationDate(pdf):
|
||||||
char *cpdf_getCreationDate(int);
|
"""getCreationDate(pdf) returns the creation date of a document."""
|
||||||
|
|
||||||
/* cpdf_getModificationDate(pdf) returns the modification date of a document. */
|
def getModificationDate(pdf):
|
||||||
char *cpdf_getModificationDate(int);
|
"""getModificationDate(pdf) returns the modification date of a document."""
|
||||||
|
|
||||||
/* cpdf_getTitleXMP(pdf) returns the XMP title of a document. */
|
def getTitleXMP(pdf):
|
||||||
char *cpdf_getTitleXMP(int);
|
"""getTitleXMP(pdf) returns the XMP title of a document."""
|
||||||
|
|
||||||
/* cpdf_getAuthorXMP(pdf) returns the XMP author of a document. */
|
def getAuthorXMP(pdf):
|
||||||
char *cpdf_getAuthorXMP(int);
|
"""getAuthorXMP(pdf) returns the XMP author of a document."""
|
||||||
|
|
||||||
/* cpdf_getSubjectXMP(pdf) returns the XMP subject of a document. */
|
def getSubjectXMP(pdf):
|
||||||
char *cpdf_getSubjectXMP(int);
|
"""getSubjectXMP(pdf) returns the XMP subject of a document."""
|
||||||
|
|
||||||
/* cpdf_getKeywordsXMP(pdf) returns the XMP keywords of a document. */
|
def getKeywordsXMP(pdf):
|
||||||
char *cpdf_getKeywordsXMP(int);
|
"""getKeywordsXMP(pdf) returns the XMP keywords of a document."""
|
||||||
|
|
||||||
/* cpdf_getCreatorXMP(pdf) returns the XMP creator of a document. */
|
def getCreatorXMP(pdf):
|
||||||
char *cpdf_getCreatorXMP(int);
|
"""getCreatorXMP(pdf) returns the XMP creator of a document."""
|
||||||
|
|
||||||
/* cpdf_getProducerXMP(pdf) returns the XMP producer of a document. */
|
def getProducerXMP(pdf):
|
||||||
char *cpdf_getProducerXMP(int);
|
"""getProducerXMP(pdf) returns the XMP producer of a document."""
|
||||||
|
|
||||||
/* cpdf_getCreationDateXMP(pdf) returns the XMP creation date of a document. */
|
def getCreationDateXMP(pdf):
|
||||||
char *cpdf_getCreationDateXMP(int);
|
"""getCreationDateXMP(pdf) returns the XMP creation date of a document."""
|
||||||
|
|
||||||
/*
|
def getModificationDateXMP(pdf):
|
||||||
* cpdf_getModificationDateXMP(pdf) returns the XMP modification date of a
|
"""getModificationDateXMP(pdf) returns the XMP modification date of a
|
||||||
* document.
|
document."""
|
||||||
*/
|
|
||||||
char *cpdf_getModificationDateXMP(int);
|
|
||||||
|
|
||||||
/* cpdf_setTitle(pdf) sets the title of a document. */
|
def setTitle(pdf, s):
|
||||||
void cpdf_setTitle(int, const char[]);
|
"""setTitle(pdf) sets the title of a document."""
|
||||||
|
|
||||||
/* cpdf_setAuthor(pdf) sets the author of a document. */
|
def setAuthor(pdf, s):
|
||||||
void cpdf_setAuthor(int, const char[]);
|
"""setAuthor(pdf) sets the author of a document."""
|
||||||
|
|
||||||
/* cpdf_setSubject(pdf) sets the subject of a document. */
|
def setSubject(pdf, s):
|
||||||
void cpdf_setSubject(int, const char[]);
|
"""setSubject(pdf) sets the subject of a document."""
|
||||||
|
|
||||||
/* cpdf_setKeywords(pdf) sets the keywords of a document. */
|
def setKeywords(pdf, s):
|
||||||
void cpdf_setKeywords(int, const char[]);
|
"""setKeywords(pdf) sets the keywords of a document."""
|
||||||
|
|
||||||
/* cpdf_setCreator(pdf) sets the creator of a document. */
|
def setCreator(pdf, s):
|
||||||
void cpdf_setCreator(int, const char[]);
|
"""setCreator(pdf) sets the creator of a document."""
|
||||||
|
|
||||||
/* cpdf_setProducer(pdf) sets the producer of a document. */
|
def setProducer(pdf, s):
|
||||||
void cpdf_setProducer(int, const char[]);
|
"""setProducer(pdf) sets the producer of a document."""
|
||||||
|
|
||||||
/* cpdf_setCreationDate(pdf) sets the creation date of a document. */
|
def setCreationDate(pdf, s):
|
||||||
void cpdf_setCreationDate(int, const char[]);
|
"""setCreationDate(pdf) sets the creation date of a document."""
|
||||||
|
|
||||||
/* cpdf_setModificationDate(pdf) sets the modifcation date of a document. */
|
def setModificationDate(pdf, s):
|
||||||
void cpdf_setModificationDate(int, const char[]);
|
"""setModificationDate(pdf) sets the modifcation date of a document."""
|
||||||
|
|
||||||
/* cpdf_setTitleXMP(pdf) set the XMP title of a document. */
|
def setTitleXMP(pdf, s):
|
||||||
void cpdf_setTitleXMP(int, const char[]);
|
"""setTitleXMP(pdf) set the XMP title of a document."""
|
||||||
|
|
||||||
/* cpdf_setAuthorXMP(pdf) set the XMP author of a document. */
|
def setAuthorXMP(pdf, s):
|
||||||
void cpdf_setAuthorXMP(int, const char[]);
|
"""setAuthorXMP(pdf) set the XMP author of a document."""
|
||||||
|
|
||||||
/* cpdf_setSubjectXMP(pdf) set the XMP subject of a document. */
|
def setSubjectXMP(pdf, s):
|
||||||
void cpdf_setSubjectXMP(int, const char[]);
|
"""setSubjectXMP(pdf) set the XMP subject of a document."""
|
||||||
|
|
||||||
/* cpdf_setKeywordsXMP(pdf) set the XMP keywords of a document. */
|
def setKeywordsXMP(pdf, s):
|
||||||
void cpdf_setKeywordsXMP(int, const char[]);
|
"""setKeywordsXMP(pdf) set the XMP keywords of a document."""
|
||||||
|
|
||||||
/* cpdf_setCreatorXMP(pdf) set the XMP creator of a document. */
|
|
||||||
void cpdf_setCreatorXMP(int, const char[]);
|
|
||||||
|
|
||||||
/* cpdf_setProducerXMP(pdf) set the XMP producer of a document. */
|
|
||||||
void cpdf_setProducerXMP(int, const char[]);
|
|
||||||
|
|
||||||
/* cpdf_setCreationDateXMP(pdf) set the XMP creation date of a document. */
|
def setCreatorXMP(pdf, s):
|
||||||
void cpdf_setCreationDateXMP(int, const char[]);
|
"""setCreatorXMP(pdf) set the XMP creator of a document."""
|
||||||
|
|
||||||
/*
|
def setProducerXMP(pdf, s):
|
||||||
* cpdf_setModificationDateXMP(pdf) set the XMP modification date of a
|
"""setProducerXMP(pdf) set the XMP producer of a document."""
|
||||||
* document.
|
|
||||||
*/
|
|
||||||
void cpdf_setModificationDateXMP(int, const char[]);
|
|
||||||
|
|
||||||
/*
|
def setCreationDateXMP(pdf, s):
|
||||||
* Dates: Month 1-31, day 1-31, hours (0-23), minutes (0-59), seconds (0-59),
|
"""setCreationDateXMP(pdf) set the XMP creation date of a document."""
|
||||||
* hour_offset is the offset from UT in hours (-23 to 23); minute_offset is
|
|
||||||
* the offset from UT in minutes (-59 to 59).
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
def setModificationDateXMP(pdf, s):
|
||||||
* cpdf_getDateComponents(datestring, year, month, day, hour, minute, second,
|
"""setModificationDateXMP(pdf) set the XMP modification date of a
|
||||||
* hour_offset, minute_offset) returns the components from a PDF date string.
|
document."""
|
||||||
*/
|
|
||||||
void cpdf_getDateComponents(const char[], int *, int *, int *, int *, int *,
|
|
||||||
int *, int *, int *);
|
|
||||||
|
|
||||||
/*
|
def getDateComponents(string):
|
||||||
* cpdf_dateStringOfComponents(year, month, day, hour, minute, second,
|
"""Dates: Month 1-31, day 1-31, hours (0-23), minutes (0-59), seconds
|
||||||
* hour_offset, minute_offset) builds a PDF date string from individual
|
(0-59), hour_offset is the offset from UT in hours (-23 to 23);
|
||||||
* components.
|
minute_offset is the offset from UT in minutes (-59 to 59).
|
||||||
*/
|
|
||||||
char *cpdf_dateStringOfComponents(int, int, int, int, int, int, int, int);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* cpdf_getPageRotation(pdf, pagenumber) gets the viewing rotation for a
|
|
||||||
* given page.
|
|
||||||
*/
|
|
||||||
int cpdf_getPageRotation(int, int);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* cpdf_hasBox(pdf, pagenumber, boxname) returns true, if that page has the
|
|
||||||
* given box. E.g "/CropBox".
|
|
||||||
*/
|
|
||||||
int cpdf_hasBox(int, int, const char[]);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* These functions get a box given the document, page range, min x, max x,
|
|
||||||
* min y, max y in points. Only succeeds if such a box exists, as checked by
|
|
||||||
* cpdf_hasBox.
|
|
||||||
*/
|
|
||||||
void cpdf_getMediaBox(int, int, double *, double *, double *, double *);
|
|
||||||
void cpdf_getCropBox(int, int, double *, double *, double *, double *);
|
|
||||||
void cpdf_getTrimBox(int, int, double *, double *, double *, double *);
|
|
||||||
void cpdf_getArtBox(int, int, double *, double *, double *, double *);
|
|
||||||
void cpdf_getBleedBox(int, int, double *, double *, double *, double *);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* These functions set a box given the document, page range, min x, max x,
|
|
||||||
* min y, max y in points.
|
|
||||||
*/
|
|
||||||
void cpdf_setMediabox(int, int, double, double, double, double);
|
|
||||||
void cpdf_setCropBox(int, int, double, double, double, double);
|
|
||||||
void cpdf_setTrimBox(int, int, double, double, double, double);
|
|
||||||
void cpdf_setArtBox(int, int, double, double, double, double);
|
|
||||||
void cpdf_setBleedBox(int, int, double, double, double, double);
|
|
||||||
|
|
||||||
/* cpdf_markTrapped(pdf) marks a document as trapped. */
|
|
||||||
void cpdf_markTrapped(int);
|
|
||||||
|
|
||||||
/* cpdf_markUntrapped(pdf) marks a document as untrapped. */
|
|
||||||
void cpdf_markUntrapped(int);
|
|
||||||
|
|
||||||
/* cpdf_markTrappedXMP(pdf) marks a document as trapped in XMP metadata. */
|
|
||||||
void cpdf_markTrappedXMP(int);
|
|
||||||
|
|
||||||
/* cpdf_markUntrappedXMP(pdf) marks a document as untrapped in XMP metadata. */
|
|
||||||
void cpdf_markUntrappedXMP(int);
|
|
||||||
|
|
||||||
/* Document Layouts. */
|
|
||||||
enum cpdf_layout {
|
|
||||||
cpdf_singlePage,
|
|
||||||
cpdf_oneColumn,
|
|
||||||
cpdf_twoColumnLeft,
|
|
||||||
cpdf_twoColumnRight,
|
|
||||||
cpdf_twoPageLeft,
|
|
||||||
cpdf_twoPageRight
|
|
||||||
};
|
|
||||||
|
|
||||||
/* cpdf_setPageLayout(pdf, layout) sets the page layout for a document. */
|
|
||||||
void cpdf_setPageLayout(int, enum cpdf_layout);
|
|
||||||
|
|
||||||
/* Document page modes. */
|
|
||||||
enum cpdf_pageMode {
|
|
||||||
cpdf_useNone,
|
|
||||||
cpdf_useOutlines,
|
|
||||||
cpdf_useThumbs,
|
|
||||||
cpdf_useOC,
|
|
||||||
cpdf_useAttachments
|
|
||||||
};
|
|
||||||
|
|
||||||
/* cpdf_setPageMode(pdf, mode) sets the page mode for a document. */
|
|
||||||
void cpdf_setPageMode(int, enum cpdf_pageMode);
|
|
||||||
|
|
||||||
/* cpdf_hideToolbar(pdf, flag) sets the hide toolbar flag. */
|
|
||||||
void cpdf_hideToolbar(int, int);
|
|
||||||
|
|
||||||
/* cpdf_hideMenubar(pdf, flag) sets the hide menu bar flag. */
|
|
||||||
void cpdf_hideMenubar(int, int);
|
|
||||||
|
|
||||||
/* cpdf_hideWindowUi(pdf, flag) sets the hide window UI flag. */
|
|
||||||
void cpdf_hideWindowUi(int, int);
|
|
||||||
|
|
||||||
/* cpdf_fitWindow(pdf, flag) sets the fit window flag. */
|
|
||||||
void cpdf_fitWindow(int, int);
|
|
||||||
|
|
||||||
/* cpdf_centerWindow(pdf, flag) sets the center window flag. */
|
|
||||||
void cpdf_centerWindow(int, int);
|
|
||||||
|
|
||||||
/* cpdf_displayDocTitle(pdf, flag) sets the display doc title flag. */
|
|
||||||
void cpdf_displayDocTitle(int, int);
|
|
||||||
|
|
||||||
/* cpdf_openAtPage(pdf, fit, pagenumber) sets the PDF to open, possibly with
|
|
||||||
* zoom-to-fit, at the given page number. */
|
|
||||||
void cpdf_openAtPage(int, int, int);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* cpdf_setMetadataFromFile(pdf, filename) set the XMP metadata of a
|
|
||||||
* document, given a file name.
|
|
||||||
*/
|
|
||||||
void cpdf_setMetadataFromFile(int, const char[]);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* cpdf_setMetadataFromByteArray(pdf, data, length) set the XMP metadata from
|
|
||||||
* an array of bytes.
|
|
||||||
*/
|
|
||||||
void cpdf_setMetadataFromByteArray(int, void *, int);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* cpdf_getMetadata(pdf, &length) returns the XMP metadata and fills in
|
|
||||||
* length.
|
|
||||||
*/
|
|
||||||
void *cpdf_getMetadata(int, int *);
|
|
||||||
|
|
||||||
/* cpdf_removeMetadata(pdf) removes the XMP metadata from a document. */
|
|
||||||
void cpdf_removeMetadata(int);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* cpdf_createMetadata(pdf) builds fresh metadata as best it can from
|
|
||||||
* existing metadata in the document.
|
|
||||||
*/
|
|
||||||
void cpdf_createMetadata(int);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* cpdf_setMetadataDate(pdf, date) 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.
|
|
||||||
*/
|
|
||||||
void cpdf_setMetadataDate(int, const char[]);
|
|
||||||
|
|
||||||
/* Styles of page label */
|
|
||||||
enum cpdf_pageLabelStyle {
|
|
||||||
cpdf_decimalArabic, /* 1, 2, 3... */
|
|
||||||
cpdf_uppercaseRoman, /* I, II, III... */
|
|
||||||
cpdf_lowercaseRoman, /* i, ii, iii... */
|
|
||||||
cpdf_uppercaseLetters, /* A, B, C... */
|
|
||||||
cpdf_lowercaseLetters /* a, b, c... */
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Add page labels.
|
|
||||||
*
|
|
||||||
* cpdf_addPageLabels(pdf, style, prefix, offset, range, progress)
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
void cpdf_addPageLabels(int, enum cpdf_pageLabelStyle, const char[], int, int,
|
|
||||||
int);
|
|
||||||
|
|
||||||
/* cpdf_removePageLabels(pdf) removes the page labels from the document. */
|
|
||||||
void cpdf_removePageLabels(int);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* cpdf_getPageLabelStringForPage(pdf, page number) calculates the full label
|
|
||||||
* string for a given page, and returns it.
|
|
||||||
*/
|
|
||||||
char *cpdf_getPageLabelStringForPage(int, int);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Get page label data. Call cpdf_startGetPageLabels to find out how many
|
|
||||||
* there are, then use these serial numbers to get the style, prefix, offset
|
|
||||||
* and range. Call cpdf_endGetPageLabels to clean up.
|
|
||||||
*/
|
|
||||||
int cpdf_startGetPageLabels(int);
|
|
||||||
enum cpdf_pageLabelStyle cpdf_getPageLabelStyle(int);
|
|
||||||
char *cpdf_getPageLabelPrefix(int);
|
|
||||||
int cpdf_getPageLabelOffset(int);
|
|
||||||
int cpdf_getPageLabelRange(int);
|
|
||||||
void cpdf_endGetPageLabels();
|
|
||||||
|
|
||||||
|
getDateComponents(datestring, year, month, day, hour, minute, second,
|
||||||
|
hour_offset, minute_offset) returns the components from a PDF date
|
||||||
|
string."""
|
||||||
|
|
||||||
|
def dateStringOfComponents(cs):
|
||||||
|
"""Dates: Month 1-31, day 1-31, hours (0-23), minutes (0-59), seconds
|
||||||
|
(0-59), hour_offset is the offset from UT in hours (-23 to 23);
|
||||||
|
minute_offset is the offset from UT in minutes (-59 to 59).
|
||||||
|
|
||||||
|
dateStringOfComponents(year, month, day, hour, minute, second,
|
||||||
|
hour_offset, minute_offset) builds a PDF date string from individual
|
||||||
|
components."""
|
||||||
|
|
||||||
|
def getPageRotation(pdf, pagenumber):
|
||||||
|
"""getPageRotation(pdf, pagenumber) gets the viewing rotation for a given
|
||||||
|
page."""
|
||||||
|
|
||||||
|
def hasBox(pdf, pagenumber, boxname):
|
||||||
|
"""hasBox(pdf, pagenumber, boxname) returns True, if that page has the
|
||||||
|
given box. E.g "/CropBox" """
|
||||||
|
|
||||||
|
def getMediaBox(pdf, pagenumber):
|
||||||
|
"""These functions get a box given the document, page range, min x, max x,
|
||||||
|
min y, max y in points. Only suceeds if such a box exists, as checked by
|
||||||
|
hasBox"""
|
||||||
|
|
||||||
|
def getCropBox(pdf, pagenumber):
|
||||||
|
"""These functions get a box given the document, page range, min x, max x,
|
||||||
|
min y, max y in points. Only suceeds if such a box exists, as checked by
|
||||||
|
hasBox"""
|
||||||
|
|
||||||
|
def getTrimBox(pdf, pagenumber):
|
||||||
|
"""These functions get a box given the document, page range, min x, max x,
|
||||||
|
min y, max y in points. Only suceeds if such a box exists, as checked by
|
||||||
|
hasBox"""
|
||||||
|
|
||||||
|
def getArtBox(pdf, pagenumber):
|
||||||
|
"""These functions get a box given the document, page range, min x, max x,
|
||||||
|
min y, max y in points. Only suceeds if such a box exists, as checked by
|
||||||
|
hasBox"""
|
||||||
|
|
||||||
|
def getBleedBox(pdf, pagenumber):
|
||||||
|
"""These functions get a box given the document, page range, min x, max x,
|
||||||
|
min y, max y in points. Only suceeds if such a box exists, as checked by
|
||||||
|
hasBox"""
|
||||||
|
|
||||||
|
def setMediaBox(pdf, r, minx, maxx, miny, maxy):
|
||||||
|
"""These functions set a box given the document, page range, min x, max x,
|
||||||
|
min y, max y in points."""
|
||||||
|
|
||||||
|
def setCropBox(pdf, r, minx, maxx, miny, maxy):
|
||||||
|
"""These functions set a box given the document, page range, min x, max x,
|
||||||
|
min y, max y in points."""
|
||||||
|
|
||||||
|
def setTrimBox(pdf, r, minx, maxx, miny, maxy):
|
||||||
|
"""These functions set a box given the document, page range, min x, max x,
|
||||||
|
min y, max y in points."""
|
||||||
|
|
||||||
|
def setArtBox(pdf, r, minx, maxx, miny, maxy):
|
||||||
|
"""These functions set a box given the document, page range, min x, max x,
|
||||||
|
min y, max y in points."""
|
||||||
|
|
||||||
|
def setBleedBox(pdf, r, minx, maxx, miny, maxy):
|
||||||
|
"""These functions set a box given the document, page range, min x, max x,
|
||||||
|
min y, max y in points."""
|
||||||
|
|
||||||
|
def markTrapped(pdf):
|
||||||
|
"""markTrapped(pdf) marks a document as trapped."""
|
||||||
|
|
||||||
|
def markUntrapped(pdf):
|
||||||
|
"""markUntrapped(pdf) marks a document as untrapped."""
|
||||||
|
|
||||||
|
def markTrappedXMP(pdf):
|
||||||
|
"""markTrappedXMP(pdf) marks a document as trapped in XMP metadata."""
|
||||||
|
|
||||||
|
def markUntrappedXMP(pdf):
|
||||||
|
"""markUntrappedXMP(pdf) marks a document as untrapped in XMP metadata."""
|
||||||
|
|
||||||
|
"""Page layouts."""
|
||||||
|
singlePage
|
||||||
|
oneColumn
|
||||||
|
twoColumnLeft
|
||||||
|
twoColumnRight
|
||||||
|
twoPageLeft
|
||||||
|
twoPageRight
|
||||||
|
|
||||||
|
def setPageLayout(pdf, layout):
|
||||||
|
"""setPageLayout(pdf, layout) sets the page layout for a document."""
|
||||||
|
|
||||||
|
"""Page modes."""
|
||||||
|
useNone
|
||||||
|
useOutlines
|
||||||
|
useThumbs
|
||||||
|
useOC
|
||||||
|
useAttachments
|
||||||
|
|
||||||
|
|
||||||
|
def setPageMode(pdf, mode):
|
||||||
|
"""setPageMode(pdf, mode) sets the page mode for a document."""
|
||||||
|
|
||||||
|
def hideToolbar(pdf, flag):
|
||||||
|
"""hideToolbar(pdf, flag) sets the hide toolbar flag"""
|
||||||
|
|
||||||
|
def hideMenubar(pdf, flag):
|
||||||
|
"""hideMenubar(pdf, flag) sets the hide menu bar flag"""
|
||||||
|
|
||||||
|
def hideWindowUi(pdf, flag):
|
||||||
|
"""hideWindowUi(pdf, flag) sets the hide window UI flag"""
|
||||||
|
|
||||||
|
def fitWindow(pdf, flag):
|
||||||
|
"""fitWindow(pdf, flag) sets the fit window flag"""
|
||||||
|
|
||||||
|
def centerWindow(pdf, flag):
|
||||||
|
"""centerWindow(pdf, flag) sets the center window flag"""
|
||||||
|
|
||||||
|
def displayDocTitle(pdf, flag):
|
||||||
|
"""displayDocTitle(pdf, flag) sets the display doc title flag"""
|
||||||
|
|
||||||
|
def openAtPage(pdf, flag, pagenumber):
|
||||||
|
"""openAtPage(pdf, fit, pagenumber)"""
|
||||||
|
|
||||||
|
def setMetadataFromFile(pdf, filename):
|
||||||
|
"""setMetadataFromFile(pdf, filename) set the XMP metadata of a document,
|
||||||
|
given a file name."""
|
||||||
|
|
||||||
|
def setMetadataFromByteArray(pdf, data):
|
||||||
|
"""setMetadataFromByteArray(pdf, data, length) set the XMP metadata from
|
||||||
|
an array of bytes."""
|
||||||
|
|
||||||
|
def getMetadata(pdf):
|
||||||
|
"""getMetadata(pdf, &length) returns the XMP metadata as a byte array of
|
||||||
|
type bytes"""
|
||||||
|
|
||||||
|
def removeMetadata(pdf):
|
||||||
|
"""removeMetadata(pdf) removes the XMP metadata from a document"""
|
||||||
|
|
||||||
|
def createMetadata(pdf):
|
||||||
|
"""createMetadata(pdf) builds fresh metadata as best it can from existing
|
||||||
|
metadata in the document."""
|
||||||
|
|
||||||
|
def setMetadataDate(pdf, date):
|
||||||
|
"""setMetadataDate(pdf, date) 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."""
|
||||||
|
|
||||||
|
"""Label styles."""
|
||||||
|
decimalArabic
|
||||||
|
uppercaseRoman
|
||||||
|
lowercaseRoman
|
||||||
|
uppercaseLetters
|
||||||
|
lowercaseLetters
|
||||||
|
|
||||||
|
|
||||||
|
def getPageLabels(pdf):
|
||||||
|
"""Get page labels as a list of tuples (style, prefix, offset, startvalue)
|
||||||
|
|
||||||
|
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 """
|
||||||
|
|
||||||
|
def addPageLabels(pdf, label, progress):
|
||||||
|
"""Add page labels.
|
||||||
|
|
||||||
|
addPageLabels(pdf, style, prefix, offset, range, progress)
|
||||||
|
|
||||||
|
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."""
|
||||||
|
|
||||||
|
def removePageLabels(pdf):
|
||||||
|
"""removePageLabels(pdf) removes the page labels from the document."""
|
||||||
|
|
||||||
|
def getPageLabelStringForPage(pdf, pagenumber):
|
||||||
|
"""getPageLabelStringForPage(pdf, page number) calculates the full label
|
||||||
|
|
|
@ -1,55 +1,24 @@
|
||||||
/* CHAPTER 12. File Attachments */
|
# CHAPTER 12. File Attachments
|
||||||
|
|
||||||
/*
|
def attachFile(filename, pdf):
|
||||||
* cpdf_attachFile(filename, pdf) attaches a file to the pdf. It is attached
|
"""attachFile(filename, pdf) attaches a file to the pdf. It is attached at
|
||||||
* at document level.
|
document level."""
|
||||||
*/
|
|
||||||
void cpdf_attachFile(const char[], int);
|
|
||||||
|
|
||||||
/*
|
def attachFileToPage(filename, pdf, pagenumber):
|
||||||
* cpdf_attachFileToPage(filename, pdf, pagenumber) attaches a file, given
|
"""attachFileToPage(filename, pdf, pagenumber) attaches a file, given its
|
||||||
* its file name, pdf, and the page number to which it should be attached.
|
file name, pdf, and the page number to which it should be attached."""
|
||||||
*/
|
|
||||||
void cpdf_attachFileToPage(const char[], int, int);
|
|
||||||
|
|
||||||
/*
|
def attachFileFromMemory(data, filename, pdf):
|
||||||
* cpdf_attachFileFromMemory(memory, length, filename, pdf) attaches from
|
"""attachFileFromMemory(memory, length, filename, pdf) attaches from
|
||||||
* memory, just like cpdf_attachFile.
|
memory, just like attachFile."""
|
||||||
*/
|
|
||||||
void cpdf_attachFileFromMemory(void *, int, const char[], int);
|
|
||||||
|
|
||||||
/*
|
def attachFileToPageFromMemory(data, filename, pdf, pagenumber):
|
||||||
* cpdf_attachFileToPageFromMemory(memory, length, filename, pdf, pagenumber)
|
"""attachFileToPageFromMemory(memory, length, filename, pdf, pagenumber)
|
||||||
* attaches from memory, just like cpdf_attachFileToPage.
|
attaches from memory, just like attachFileToPage."""
|
||||||
*/
|
|
||||||
void cpdf_attachFileToPageFromMemory(void *, int, const char[], int, int);
|
|
||||||
|
|
||||||
/* Remove all page- and document-level attachments from a document */
|
def removeAttachedFiles(pdf):
|
||||||
void cpdf_removeAttachedFiles(int);
|
"""Remove all page- and document-level attachments from a document"""
|
||||||
|
|
||||||
/*
|
|
||||||
* List information about attachments. Call cpdf_startGetAttachments(pdf)
|
|
||||||
* first, then cpdf_numberGetAttachments to find out how many there are. Then
|
|
||||||
* cpdf_getAttachmentName to return each one 0...(n - 1). Finally, call
|
|
||||||
* cpdf_endGetAttachments to clean up.
|
|
||||||
*/
|
|
||||||
void cpdf_startGetAttachments(int);
|
|
||||||
|
|
||||||
/* Get the number of attachments. */
|
|
||||||
int cpdf_numberGetAttachments(void);
|
|
||||||
|
|
||||||
/* Get the name of the attachment. */
|
|
||||||
char *cpdf_getAttachmentName(int);
|
|
||||||
|
|
||||||
/* Gets the page number. 0 = document level. */
|
|
||||||
int cpdf_getAttachmentPage(int);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* cpdf_getAttachmentData(serial number, &length) returns a pointer to the
|
|
||||||
* data, and its length.
|
|
||||||
*/
|
|
||||||
void *cpdf_getAttachmentData(int, int *);
|
|
||||||
|
|
||||||
/* Clean up after getting attachments. */
|
|
||||||
void cpdf_endGetAttachments(void);
|
|
||||||
|
|
||||||
|
def getAttachments(pdf):
|
||||||
|
"""List information about attachements. Returns a list of tuples
|
||||||
|
(name, page number, byte array of data)"""
|
||||||
|
|
|
@ -1,20 +1,6 @@
|
||||||
/* CHAPTER 13. Images. */
|
# CHAPTER 13. Images
|
||||||
|
|
||||||
/*
|
|
||||||
* Get image data, including resolution at all points of use. Call
|
|
||||||
* cpdf_startGetImageResolution(pdf, min_required_resolution) will 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..<total number> - 1, to retrieve the data. Finally, call
|
|
||||||
* cpdf_endGetImageResolution to clean up.
|
|
||||||
*/
|
|
||||||
int cpdf_startGetImageResolution(int, float);
|
|
||||||
int cpdf_getImageResolutionPageNumber(int);
|
|
||||||
char *cpdf_getImageResolutionImageName(int);
|
|
||||||
int cpdf_getImageResolutionXPixels(int);
|
|
||||||
int cpdf_getImageResolutionYPixels(int);
|
|
||||||
double cpdf_getImageResolutionXRes(int);
|
|
||||||
double cpdf_getImageResolutionYRes(int);
|
|
||||||
void cpdf_endGetImageResolution(void);
|
|
||||||
|
|
||||||
|
def getImageResolution(pdf, min_required_resolution):
|
||||||
|
"""Return a list of all uses of images in the PDF which do not meet the
|
||||||
|
minimum required resolution in dpi as tuples of:
|
||||||
|
(pagenumber, name, x pixels, y pixels, x resolution, y resolution)"""
|
||||||
|
|
|
@ -1,27 +1,13 @@
|
||||||
/* CHAPTER 14. Fonts. */
|
# CHAPTER 14. Fonts
|
||||||
|
|
||||||
/*
|
def getFontInfo(pdf):
|
||||||
* Retrieving font information. First, call cpdf_startGetFontInfo(pdf). Now
|
"""Get a list of (pagenumber, fontname, fonttype, fontencoding) tuples,
|
||||||
* call cpdf_numberFonts to return the number of fonts. For each font, call
|
showing each font used on each page."""
|
||||||
* one or more of cpdf_getFontPage, cpdf_getFontName, cpdf_getFontType, and
|
|
||||||
* cpdf_getFontEncoding giving a serial number 0..<number of fonts> - 1 to
|
|
||||||
* return information. Finally, call cpdf_endGetFontInfo to clean up.
|
|
||||||
*/
|
|
||||||
void cpdf_startGetFontInfo(int);
|
|
||||||
int cpdf_numberFonts(void);
|
|
||||||
int cpdf_getFontPage(int);
|
|
||||||
char *cpdf_getFontName(int);
|
|
||||||
char *cpdf_getFontType(int);
|
|
||||||
char *cpdf_getFontEncoding(int);
|
|
||||||
void cpdf_endGetFontInfo(void);
|
|
||||||
|
|
||||||
/* cpdf_removeFonts(pdf) removes all font data from a file. */
|
def removeFonts(pdf):
|
||||||
void cpdf_removeFonts(int);
|
"""removeFonts(pdf) removes all font data from a file."""
|
||||||
|
|
||||||
/*
|
|
||||||
* cpdf_copyFont(from, to, range, pagenumber, fontname) 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 it's font name.
|
|
||||||
*/
|
|
||||||
void cpdf_copyFont(int, int, int, int, const char[]);
|
|
||||||
|
|
||||||
|
def copyFont(pdf, pdf2, r, pagenumber, fontname):
|
||||||
|
"""copyFont(from, to, range, pagenumber, fontname) 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 it's font name."""
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
/* CHAPTER 15. PDF and JSON */
|
# CHAPTER 15. PDF and JSON
|
||||||
|
|
||||||
/* cpdf_outputJSON(filename, parse_content, no_stream_data, pdf) 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 suppressed entirely.
|
|
||||||
* */
|
|
||||||
void cpdf_outputJSON(const char[], int, int, int);
|
|
||||||
|
|
||||||
|
def outputJSON(filename, parse_content, no_stream_data, pdf):
|
||||||
|
"""outputJSON(filename, parse_content, no_stream_data, pdf) 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 suppressed
|
||||||
|
entirely."""
|
||||||
|
|
|
@ -1,24 +1,16 @@
|
||||||
/* CHAPTER 16. Optional Content Groups */
|
# CHAPTER 16. Optional Content Groups
|
||||||
|
|
||||||
/* Begin retrieving optional content group names. The serial number 0..<n - 1>
|
def getOCGList(pdf):
|
||||||
* is returned. */
|
"""Return a list of Optional Content Groups in the given pdf."""
|
||||||
int cpdf_startGetOCGList(int pdf);
|
|
||||||
|
|
||||||
/* Retrieve an OCG name, given its serial number 0..<n - 1>. */
|
def OCGRename(pdf, n_from, n_to):
|
||||||
char *cpdf_OCGListEntry(int i);
|
"""OCGRename(pdf, n_from, n_to) will rename an optional content group."""
|
||||||
|
|
||||||
/* End retrieval of optional content group names. */
|
def OCGOrderAll(pdf):
|
||||||
void cpdf_endGetOCGList(void);
|
"""Ensure that every optional content group appears in the OCG order list."""
|
||||||
|
|
||||||
/* cpdf_OCGRename(pdf, from, to) will rename an optional content group. */
|
|
||||||
void cpdf_OCGRename(int, const char[], const char[]);
|
|
||||||
|
|
||||||
/* Ensure that every optional content group appears in the OCG order list. */
|
|
||||||
void cpdf_OCGOrderAll(int);
|
|
||||||
|
|
||||||
/* Coalesce 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
|
|
||||||
* content groups. This function will merge the two into a single optional
|
|
||||||
* content group. */
|
|
||||||
void cpdf_OCGCoalesce(int);
|
|
||||||
|
|
||||||
|
def OCGCoalesce(pdf):
|
||||||
|
"""Coalesce 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 content groups. This function will merge the two into a single
|
||||||
|
optional content group."""
|
||||||
|
|
|
@ -1,54 +1,43 @@
|
||||||
/* CHAPTER 17. Miscellaneous */
|
# CHAPTER 17. Miscellaneous
|
||||||
|
|
||||||
/*
|
def draft(pdf, r, boxes):
|
||||||
* cpdf_draft(pdf, range, boxes) removes images on the given pages, replacing
|
"""draft(pdf, range, boxes) removes images on the given pages, replacing
|
||||||
* them with crossed boxes if 'boxes' is true
|
them with crossed boxes if 'boxes' is true"""
|
||||||
*/
|
|
||||||
void cpdf_draft(int, int, int);
|
|
||||||
|
|
||||||
/*
|
def removeAllText(pdf, r):
|
||||||
* cpdf_removeAllText(pdf, range) removes all text from the given pages in a
|
"""removeAllText(pdf, range) removes all text from the given pages in a
|
||||||
* given document.
|
given document."""
|
||||||
*/
|
|
||||||
void cpdf_removeAllText(int, int);
|
|
||||||
|
|
||||||
/* cpdf_blackText(pdf, range) blackens all text on the given pages. */
|
def blackText(pdf, r):
|
||||||
void cpdf_blackText(int, int);
|
"""blackText(pdf, range) blackens all text on the given pages."""
|
||||||
|
|
||||||
/* cpdf_blackLines(pdf, range) blackens all lines on the given pages. */
|
def blackLines(pdf, r):
|
||||||
void cpdf_blackLines(int, int);
|
"""blackLines(pdf, range) blackens all lines on the given pages."""
|
||||||
|
|
||||||
/* cpdf_blackFills(pdf, range) blackens all fills on the given pages. */
|
def blackFills(pdf, r):
|
||||||
void cpdf_blackFills(int, int);
|
"""blackFills(pdf, range) blackens all fills on the given pages."""
|
||||||
|
|
||||||
/*
|
def thinLines(pdf, r, linewidth):
|
||||||
* cpdf_thinLines(pdf, range, min_thickness) thickens every line less than
|
"""thinLines(pdf, range, min_thickness) thickens every line less than
|
||||||
* min_thickness to min_thickness. Thickness given in points.
|
min_thickness to min_thickness. Thickness given in points."""
|
||||||
*/
|
|
||||||
void cpdf_thinLines(int, int, double);
|
|
||||||
|
|
||||||
/* cpdf_copyId(from, to) copies the /ID from one document to another. */
|
def copyId(pdf, pdf2):
|
||||||
void cpdf_copyId(int, int);
|
"""copyId(from, to) copies the /ID from one document to another."""
|
||||||
|
|
||||||
/* cpdf_removeId(pdf) removes a document's /ID. */
|
def removeId(pdf):
|
||||||
void cpdf_removeId(int);
|
"""removeId(pdf) removes a document's /ID"""
|
||||||
|
|
||||||
/* cpdf_setVersion(pdf, version) sets the minor version number of a document. */
|
def setVersion(pdf, version):
|
||||||
void cpdf_setVersion(int, int);
|
"""setVersion(pdf, version) sets the minor version number of a document."""
|
||||||
|
|
||||||
/* cpdf_setFullVersion(pdf, major_version, minor_version) sets the full version
|
def setFullVersion(pdf, major, minor):
|
||||||
* number of a document. */
|
"""setFullVersion(pdf, version) sets the major and minor version number of
|
||||||
void cpdf_setFullVersion(int, int, int);
|
a document."""
|
||||||
|
|
||||||
/*
|
def removeDictEntry(pdf, key):
|
||||||
* cpdf_removeDictEntry(pdf, key) removes any dictionary entry with the given
|
"""removeDictEntry(pdf, key) removes any dictionary entry with the given
|
||||||
* key anywhere in the document.
|
key anywhere in the document"""
|
||||||
*/
|
|
||||||
void cpdf_removeDictEntry(int, const char[]);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* cpdf_removeClipping(pdf, range) removes all clipping from pages in the
|
|
||||||
* given range.
|
|
||||||
*/
|
|
||||||
void cpdf_removeClipping(int, int);
|
|
||||||
|
|
||||||
|
def removeClipping(pdf, r):
|
||||||
|
"""removeClipping(pdf, range) removes all clipping from pages in the given
|
||||||
|
range"""
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
/* CHAPTER X. Internal or undocumented. */
|
|
||||||
|
|
||||||
/* Internal. Used for demo versions of the commercial version of cpdflib. */
|
|
||||||
void cpdf_setDemo(int);
|
|
Loading…
Reference in New Issue