[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/mod/assign/feedback/editpdf/classes/ -> pdf.php (summary)

Library code for manipulating PDFs

Copyright: 2012 Davo Smith
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 597 lines (22 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

pdf:: (16 methods):
  combine_pdfs()
  current_page()
  page_count()
  load_pdf()
  set_pdf()
  copy_page()
  create_page_from_source()
  copy_remaining_pages()
  add_comment()
  add_annotation()
  save_pdf()
  set_image_folder()
  get_image()
  ensure_pdf_compatible()
  test_gs_path()
  send_test_image()


Class: pdf  - X-Ref

Library code for manipulating PDFs

combine_pdfs($pdflist, $outfilename)   X-Ref
Combine the given PDF files into a single PDF. Optionally add a coversheet and coversheet fields.

param: string[] $pdflist  the filenames of the files to combine
param: string $outfilename the filename to write to
return: int the number of pages in the combined PDF

current_page()   X-Ref
The number of the current page in the PDF being processed

return: int

page_count()   X-Ref
The total number of pages in the PDF being processed

return: int

load_pdf($filename)   X-Ref
Load the specified PDF and set the initial output configuration
Used when processing comments and outputting a new PDF

param: string $filename the path to the PDF to load
return: int the number of pages in the PDF

set_pdf($filename, $pagecount = 0)   X-Ref
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)

param: string $filename the path to the PDF to process
param: int $pagecount optional the number of pages in the PDF, if known
return: int the number of pages in the PDF

copy_page()   X-Ref
Copy the next page from the source file and set it as the current page

return: bool true if successful

create_page_from_source($pageno)   X-Ref
Create a page from a source PDF.

param: int $pageno

copy_remaining_pages()   X-Ref
Copy all the remaining pages in the file


add_comment($text, $x, $y, $width, $colour = 'yellow')   X-Ref
Add a comment to the current page

param: string $text the text of the comment
param: int $x the x-coordinate of the comment (in pixels)
param: int $y the y-coordinate of the comment (in pixels)
param: int $width the width of the comment (in pixels)
param: string $colour optional the background colour of the comment (red, yellow, green, blue, white, clear)
return: bool true if successful (always)

add_annotation($sx, $sy, $ex, $ey, $colour = 'yellow', $type = 'line', $path, $imagefolder)   X-Ref
Add an annotation to the current page

param: int $sx starting x-coordinate (in pixels)
param: int $sy starting y-coordinate (in pixels)
param: int $ex ending x-coordinate (in pixels)
param: int $ey ending y-coordinate (in pixels)
param: string $colour optional the colour of the annotation (red, yellow, green, blue, white, black)
param: string $type optional the type of annotation (line, oval, rectangle, highlight, pen, stamp)
param: int[]|string $path optional for 'pen' annotations this is an array of x and y coordinates for
param: string $imagefolder - Folder containing stamp images.
return: bool true if successful (always)

save_pdf($filename)   X-Ref
Save the completed PDF to the given file

param: string $filename the filename for the PDF (including the full path)

set_image_folder($folder)   X-Ref
Set the path to the folder in which to generate page image files

param: string $folder

get_image($pageno)   X-Ref
Generate an image of the specified page in the PDF

param: int $pageno the page to generate the image of
return: string the filename of the generated image

ensure_pdf_compatible(\stored_file $file)   X-Ref
Check to see if PDF is version 1.4 (or below); if not: use ghostscript to convert it

param: stored_file $file
return: string path to copy or converted pdf (false == fail)

test_gs_path($generateimage = true)   X-Ref
Test that the configured path to ghostscript is correct and working.

param: bool $generateimage - If true - a test image will be generated to verify the install.
return: bool

send_test_image()   X-Ref
If the test image has been generated correctly - send it direct to the browser.




Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1