|
| combine_pdfs ($pdflist, $outfilename, $coversheet=null, $fields=null) |
|
| current_page () |
|
| page_count () |
|
| load_pdf ($filename) |
|
| set_pdf ($filename, $pagecount=0) |
|
| copy_page () |
|
| copy_remaining_pages () |
|
| add_comment ($text, $x, $y, $width, $colour= 'yellow') |
|
| add_annotation ($sx, $sy, $ex, $ey, $colour= 'red', $type= 'line', $path=null) |
|
| save_pdf ($filename) |
|
| set_image_folder ($folder) |
|
| get_image ($pageno) |
|
add_annotation |
( |
|
$sx, |
|
|
|
$sy, |
|
|
|
$ex, |
|
|
|
$ey, |
|
|
|
$colour = 'red' , |
|
|
|
$type = 'line' , |
|
|
|
$path = null |
|
) |
| |
Add an annotation to the current page
- Parameters
-
$sx | int starting x-coordinate (in pixels) |
$sy | int starting y-coordinate (in pixels) |
$ex | int ending x-coordinate (in pixels) |
$ey | int ending y-coordinate (in pixels) |
$colour | string optional the colour of the annotation (red, yellow, green, blue, white, black) |
$type | string optional the type of annotation (line, oval, rectangle, highlight, freehand, stamp) |
$path | mixed int[]|string optional for 'freehand' annotations this is an array of x and y coordinates for the line, for 'stamp' annotations it is the name of the stamp file (without the path) |
- Returns
- bool true if successful (always)
add_comment |
( |
|
$text, |
|
|
|
$x, |
|
|
|
$y, |
|
|
|
$width, |
|
|
|
$colour = 'yellow' |
|
) |
| |
Add a comment to the current page
- Parameters
-
$text | string the text of the comment |
$x | int the x-coordinate of the comment (in pixels) |
$y | int the y-coordinate of the comment (in pixels) |
$width | int the width of the comment (in pixels) |
$colour | string optional the background colour of the comment (red, yellow, green, blue, white, clear) |
- Returns
- bool true if successful (always)
combine_pdfs |
( |
|
$pdflist, |
|
|
|
$outfilename, |
|
|
|
$coversheet = null , |
|
|
|
$fields = null |
|
) |
| |
Combine the given PDF files into a single PDF. Optionally add a coversheet and coversheet fields.
- Parameters
-
$pdflist | string[] the filenames of the files to combine |
$outfilename | string the filename to write to |
$coversheet | string optional the coversheet to include |
$fields | stdClass[] optional the fields to write onto the coversheet |
- Returns
- int the number of pages in the combined PDF
Copy the next page from the source file and set it as the current page
- Returns
- bool true if successful
Copy all the remaining pages in the file
create_page_from_source |
( |
|
$pageno | ) |
|
|
protected |
The number of the current page in the PDF being processed
- Returns
- int
static ensure_pdf_compatible |
( |
stored_file |
$file | ) |
|
|
static |
Check to see if PDF is version 1.4 (or below); if not: use ghostscript to convert it
- Parameters
-
- Returns
- bool false if the PDF is invalid, true if the PDF is valid (or has been converted)
Generate an image of the specified page in the PDF
- Parameters
-
$pageno | int the page to generate the image of |
- Exceptions
-
moodle_exception | |
coding_exception | |
- Returns
- string the filename of the generated image
static get_stamp_file |
( |
|
$stampname | ) |
|
|
static |
Get the location of the image file for a given stamp (or false, if it does not exist)
- Parameters
-
- Returns
- mixed string|false the path to the image file for the stamp
Get a list of the available stamp images - the PNG files found within the mod/assign/feedback/pdf/pix/stamps folder
- Returns
- string[] 'stampname' => 'filepath'
Load the specified PDF and set the initial output configuration Used when processing comments and outputting a new PDF
- Parameters
-
$filename | string the path to the PDF to load |
- Returns
- int the number of pages in the PDF
The total number of pages in the PDF being processed
- Returns
- int
Save the completed PDF to the given file
- Parameters
-
$filename | string the filename for the PDF (including the full path) |
static send_test_image |
( |
| ) |
|
|
static |
set_image_folder |
( |
|
$folder | ) |
|
Set the path to the folder in which to generate page image files
- Parameters
-
set_pdf |
( |
|
$filename, |
|
|
|
$pagecount = 0 |
|
) |
| |
Sets the name of the PDF to process, but only loads the file if the pagecount is zero (in order to count the number of pages) Used when generating page images (but not a new PDF)
- Parameters
-
$filename | string the path to the PDF to process |
$pagecount | int optional the number of pages in the PDF, if known |
- Returns
- int the number of pages in the PDF
static test_gs_path |
( |
|
$generateimage = true | ) |
|
|
static |
const GSPATH_DOESNOTEXIST = 'doesnotexist' |
const GSPATH_EMPTY = 'empty' |
const GSPATH_ERROR = 'error' |
const GSPATH_ISDIR = 'isdir' |
const GSPATH_NOTESTFILE = 'notestfile' |
const GSPATH_NOTEXECUTABLE = 'notexecutable' |
The documentation for this class was generated from the following file: