cpdf-source/javascriptsplits/c04.tex

135 lines
4.5 KiB
TeX
Raw Normal View History

2022-05-12 17:57:13 +02:00
/* CHAPTER 3. Pages */
/** Scales the page dimensions
and content by the given scale, about (0, 0). Other boxes (crop etc. are
altered as appropriate).
@param pdf PDF document
@param range page range
@param sx X scale
@param sy Y scale*/
public native void scalePages(Pdf pdf, Range range, double sx, double sy)
throws CpdfError;
/** Scales the content to fit new page dimensions (width x height)
multiplied by scale (typically 1.0). Other boxes (crop etc. are altered as
appropriate).
@param pdf PDF document
@param range page range
@param w width in points
@param h height in points
@param scale scale (typically 1.0)
*/
public native void scaleToFit(Pdf pdf, Range range, double w, double h,
double scale)
throws CpdfError;
/** Scales the page content to fit the given page size, possibly multiplied
by scale (typically 1.0).
@param pdf PDF document
@param range page range
@param papersize paper size, such as {@link #a4portrait a0portrait}
@param scale scale (typically 1.0)
*/
public native void scaleToFitPaper(Pdf pdf, Range range, int papersize,
double scale)
throws CpdfError;
/** Scales the contents of the pages in the range about the point given by
the <code>anchor</code>, <code>p1</code> and <code>p2</code> by the scale
given. See the documentation for the chosen anchor.
@param pdf PDF document
@param range page range
@param anchor position anchor, such as {@link #posCentre posCentre}
@param p1 position parameter 1
@param p2 position parameter 2
@param scale scale
*/
public native void scaleContents(Pdf pdf, Range range, int anchor,
double p1, double p2, double scale)
throws CpdfError;
/** Shifts the content of the pages in the range.
@param pdf PDF document
@param range page range
@param dx X shift
@param dy Y shift
*/
public native void shiftContents(Pdf pdf, Range range, double dx,
double dy)
throws CpdfError;
/** Changes the viewing rotation to an absolute value. Appropriate
rotations are 0, 90, 180, 270.
@param pdf PDF document
@param range page range
@param angle viewing rotation
*/
public native void rotate(Pdf pdf, Range range, int angle)
throws CpdfError;
/** Changes the viewing rotation by a relative value. Appropriate
rotations are 0, 90, 180, 270.
@param pdf PDF document
@param range page range
@param angle viewing rotation
*/
public native void rotateBy(Pdf pdf, Range range, int angle)
throws CpdfError;
/** Rotates the content about the centre of the page by the given number of
degrees, in a clockwise direction.
@param pdf PDF document
@param range page range
@param angle angle in degrees
*/
public native void rotateContents(Pdf pdf, Range range, double angle)
throws CpdfError;
/** Changes the viewing rotation of the pages in the range,
counter-rotating the dimensions and content such that there is no visual
change. */
public native void upright(Pdf pdf, Range range) throws CpdfError;
/** Flips horizontally the pages in the range. */
public native void hFlip(Pdf pdf, Range range) throws CpdfError;
/** Flips vertically the pages in the range. */
public native void vFlip(Pdf pdf, Range range) throws CpdfError;
/** Crops a page, replacing any existing crop box. The dimensions are in
points.
@param pdf PDF document
@param range page range
@param x minimum X
@param y minimum Y
@param w width
@param h height */
public native void crop(Pdf pdf, Range range, double x, double y, double w,
double h)
throws CpdfError;
/** Removes any crop box from pages in the range. */
public native void removeCrop(Pdf pdf, Range range) throws CpdfError;
/** Removes any trim box from pages in the range. */
public native void removeTrim(Pdf pdf, Range range) throws CpdfError;
/** Removes any art box from pages in the range. */
public native void removeArt(Pdf pdf, Range range) throws CpdfError;
/** Removes any bleed box from pages in the range. */
public native void removeBleed(Pdf pdf, Range range) throws CpdfError;
/** Adds trim marks to the given pages, if the trimbox exists. */
public native void trimMarks(Pdf pdf, Range range) throws CpdfError;
/** Shows the boxes on the given pages, for debug. */
public native void showBoxes(Pdf pdf, Range range) throws CpdfError;
/** Makes a given box a 'hard box' i.e clips it explicitly.
@param pdf PDF document
@param range page range
@param box box name e.g "/CropBox" */
public native void hardBox(Pdf pdf, Range range, String box)
throws CpdfError;