1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
7 #ifndef _TRANSFORMPAGE_H_
8 #define _TRANSFORMPAGE_H_
14 typedef void* FPDF_PAGEARCSAVER;
15 typedef void* FPDF_PAGEARCLOADER;
17 * Set "MediaBox" entry to the page dictionary.
18 * @param[in] page - Handle to a page.
19 * @param[in] left - The left of the rectangle.
20 * @param[in] bottom - The bottom of the rectangle.
21 * @param[in] right - The right of the rectangle.
22 * @param[in] top - The top of the rectangle.
24 * @note The method can not support to set this feature for the document which consists of dynamic XFA fields.
26 DLLEXPORT void STDCALL FPDFPage_SetMediaBox(FPDF_PAGE page, float left, float bottom, float right, float top);
29 * Set "CropBox" entry to the page dictionary.
30 * @param[in] page - Handle to a page.
31 * @param[in] left - The left of the rectangle.
32 * @param[in] bottom - The bottom of the rectangle.
33 * @param[in] right - The right of the rectangle.
34 * @param[in] top - The top of the rectangle.
36 * @note The method can not support to set this feature for the document which consists of dynamic XFA fields.
38 DLLEXPORT void STDCALL FPDFPage_SetCropBox(FPDF_PAGE page, float left, float bottom, float right, float top);
41 /** Get "MediaBox" entry from the page dictionary.
42 * @param[in] page - Handle to a page.
43 * @param[in] left - Pointer to a double value receiving the left of the rectangle.
44 * @param[in] bottom - Pointer to a double value receiving the bottom of the rectangle.
45 * @param[in] right - Pointer to a double value receiving the right of the rectangle.
46 * @param[in] top - Pointer to a double value receiving the top of the rectangle.
47 * @retval True if success,else fail.
48 * @note The method can not support to get this feature for the document which consists of dynamic XFA fields.
50 DLLEXPORT FPDF_BOOL STDCALL FPDFPage_GetMediaBox(FPDF_PAGE page, float* left, float* bottom, float* right, float* top);
52 /** Get "CropBox" entry from the page dictionary.
53 * @param[in] page - Handle to a page.
54 * @param[in] left - Pointer to a double value receiving the left of the rectangle.
55 * @param[in] bottom - Pointer to a double value receiving the bottom of the rectangle.
56 * @param[in] right - Pointer to a double value receiving the right of the rectangle.
57 * @param[in] top - Pointer to a double value receiving the top of the rectangle.
58 * @retval True if success,else fail.
59 * @note The method can not support to get this feature for the document which consists of dynamic XFA fields.
61 DLLEXPORT FPDF_BOOL STDCALL FPDFPage_GetCropBox(FPDF_PAGE page, float* left, float* bottom, float* right, float* top);
64 * Transform the whole page with a specified matrix, then clip the page content region.
66 * @param[in] page - A page handle.
67 * @param[in] matrix - The transform matrix.
68 * @param[in] clipRect - A rectangle page area to be clipped.
69 * @Note. This function will transform the whole page, and would take effect to all the objects in the page.
70 * The method can not support to get this feature for the document which consists of dynamic XFA fields.
72 DLLEXPORT FPDF_BOOL STDCALL FPDFPage_TransFormWithClip(FPDF_PAGE page, FS_MATRIX* matrix, FS_RECTF* clipRect);
75 * Transform (scale, rotate, shear, move) the clip path of page object.
76 * @param[in] page_object - Handle to a page object. Returned by FPDFPageObj_NewImageObj.
77 * @param[in] a - The coefficient "a" of the matrix.
78 * @param[in] b - The coefficient "b" of the matrix.
79 * @param[in] c - The coefficient "c" of the matrix.
80 * @param[in] d - The coefficient "d" of the matrix.
81 * @param[in] e - The coefficient "e" of the matrix.
82 * @param[in] f - The coefficient "f" of the matrix.
85 DLLEXPORT void STDCALL FPDFPageObj_TransformClipPath(FPDF_PAGEOBJECT page_object,double a, double b, double c, double d, double e, double f);
88 * Create a new clip path, with a rectangle inserted.
90 * @param[in] left - The left of the clip box.
91 * @param[in] bottom - The bottom of the clip box.
92 * @param[in] right - The right of the clip box.
93 * @param[in] top - The top of the clip box.
94 * @retval a handle to the clip path.
96 DLLEXPORT FPDF_CLIPPATH STDCALL FPDF_CreateClipPath(float left, float bottom, float right, float top);
99 * Destroy the clip path.
101 * @param[in] clipPath - A handle to the clip path.
102 * Destroy the clip path.
105 DLLEXPORT void STDCALL FPDF_DestroyClipPath(FPDF_CLIPPATH clipPath);
108 * Clip the page content, the page content that outside the clipping region become invisible.
110 * @param[in] page - A page handle.
111 * @param[in] clipPath - A handle to the clip path.
112 * @Note. A clip path will be inserted before the page content stream or content array. In this way, the page content will be clipped
113 * by this clip path. The method can not support this feature for the document consists of dynamic XFA fields.
115 DLLEXPORT void STDCALL FPDFPage_InsertClipPath(FPDF_PAGE page,FPDF_CLIPPATH clipPath);