NAME
PDFio::FFI - Perl FFI bindings for the PDFio C library
VERSION
Version 0.01
SYNOPSIS
DESCRIPTION
PDFio::FFI
provides Perl bindings to the PDFio C library using FFI::Platypus. It allows you to read, write, and manipulate PDF files from Perl by exposing the PDFio API.
EXPORT
FUNCTIONS
The following functions are exported by default. Each function maps directly to a PDFio C API call.
fileCreate
Creates a new PDF file for writing.
fileCreate($filename, $version, $media_box, $crop_box, $error_cb, $error_data) -> pdfio_file_t
fileClose
Closes a PDF file and frees resources.
fileClose($file) -> bool
fileCreatePage
Creates a new page in the PDF file.
fileCreatePage($file, $dict) -> pdfio_stream_t
arrayAppendArray
Appends an array to a PDF array.
arrayAppendArray($array, $value) -> bool
arrayAppendBinary
Appends binary data to a PDF array.
arrayAppendBinary($array, $data, $size) -> bool
arrayAppendBoolean
Appends a boolean value to a PDF array.
arrayAppendBoolean($array, $bool) -> bool
arrayAppendDate
Appends a date value to a PDF array.
arrayAppendDate($array, $time_t) -> bool
arrayAppendDict
Appends a dictionary to a PDF array.
arrayAppendDict($array, $dict) -> bool
arrayAppendName
Appends a name to a PDF array.
arrayAppendName($array, $name) -> bool
arrayAppendNumber
Appends a number to a PDF array.
arrayAppendNumber($array, $number) -> bool
arrayAppendObj
Appends an object to a PDF array.
arrayAppendObj($array, $obj) -> bool
arrayAppendString
Appends a string to a PDF array.
arrayAppendString($array, $string) -> bool
arrayCopy
Copies a PDF array.
arrayCopy($file, $array) -> pdfio_array_t
arrayCreate
Creates a new PDF array.
arrayCreate($file) -> pdfio_array_t
arrayGetArray
Gets an array element from a PDF array.
arrayGetArray($array, $index) -> pdfio_array_t
arrayGetBinary
Gets binary data from a PDF array.
arrayGetBinary($array, $index, $buffer) -> opaque
arrayGetBoolean
Gets a boolean value from a PDF array.
arrayGetBoolean($array, $index) -> bool
arrayGetDate
Gets a date value from a PDF array.
arrayGetDate($array, $index) -> time_t
arrayGetDict
Gets a dictionary from a PDF array.
arrayGetDict($array, $index) -> pdfio_dict_t
arrayGetName
Gets a name from a PDF array.
arrayGetName($array, $index) -> string
arrayGetNumber
Gets a number from a PDF array.
arrayGetNumber($array, $index) -> double
arrayGetObj
Gets an object from a PDF array.
arrayGetObj($array, $index) -> pdfio_obj_t
arrayGetSize
Gets the number of elements in a PDF array.
arrayGetSize($array) -> size_t
arrayGetString
Gets a string from a PDF array.
arrayGetString($array, $index) -> string
arrayGetType
Gets the type of an element in a PDF array.
arrayGetType($array, $index) -> int
arrayRemove
Removes an element from a PDF array.
arrayRemove($array, $index) -> bool
dictClear
Removes a key from a PDF dictionary.
dictClear($dict, $key) -> bool
dictCopy
Copies a PDF dictionary.
dictCopy($file, $dict) -> pdfio_dict_t
dictCreate
Creates a new PDF dictionary.
dictCreate($file) -> pdfio_dict_t
dictGetArray
Gets an array from a PDF dictionary by key.
dictGetArray($dict, $key) -> pdfio_array_t
dictGetBinary
Gets binary data from a PDF dictionary.
dictGetBinary($dict, $key, $buffer) -> opaque
dictGetBoolean
Gets a boolean value from a PDF dictionary.
dictGetBoolean($dict, $key) -> bool
dictGetDate
Gets a date value from a PDF dictionary.
dictGetDate($dict, $key) -> time_t
dictGetDict
Gets a dictionary from a PDF dictionary.
dictGetDict($dict, $key) -> pdfio_dict_t
dictGetKey
Gets a key from a PDF dictionary by index.
dictGetKey($dict, $index) -> string
dictGetName
Gets a name from a PDF dictionary.
dictGetName($dict, $key) -> string
dictGetNumPairs
Gets the number of key-value pairs in a PDF dictionary.
dictGetNumPairs($dict) -> size_t
dictGetNumber
Gets a number from a PDF dictionary.
dictGetNumber($dict, $key) -> double
dictGetObj
Gets an object from a PDF dictionary.
dictGetObj($dict, $key) -> pdfio_obj_t
dictGetRect
Gets a rectangle from a PDF dictionary.
dictGetRect($dict, $key, $rect) -> pdfio_rect_t
dictGetString
Gets a string from a PDF dictionary.
dictGetString($dict, $key) -> string
dictGetType
Gets the type of a value in a PDF dictionary.
dictGetType($dict, $key) -> int
dictSetArray
Sets an array value in a PDF dictionary.
dictSetArray($dict, $key, $array) -> bool
dictSetBinary
Sets binary data in a PDF dictionary.
dictSetBinary($dict, $key, $data, $size) -> bool
dictSetBoolean
Sets a boolean value in a PDF dictionary.
dictSetBoolean($dict, $key, $bool) -> bool
dictSetDate
Sets a date value in a PDF dictionary.
dictSetDate($dict, $key, $time_t) -> bool
dictSetDict
Sets a dictionary value in a PDF dictionary.
dictSetDict($dict, $key, $dict2) -> bool
dictSetName
Sets a name value in a PDF dictionary.
dictSetName($dict, $key, $name) -> bool
dictSetNull
Sets a null value in a PDF dictionary.
dictSetNull($dict, $key) -> bool
dictSetNumber
Sets a number value in a PDF dictionary.
dictSetNumber($dict, $key, $number) -> bool
dictSetObj
Sets an object value in a PDF dictionary.
dictSetObj($dict, $key, $obj) -> bool
dictSetRect
Sets a rectangle value in a PDF dictionary.
dictSetRect($dict, $key, $rect) -> bool
dictSetString
Sets a string value in a PDF dictionary.
dictSetString($dict, $key, $string) -> bool
fileCreateArrayObj
Creates an array object in a PDF file.
fileCreateArrayObj($file, $array) -> pdfio_obj_t
fileCreateNameObj
Creates a name object in a PDF file.
fileCreateNameObj($file, $name) -> pdfio_obj_t
fileCreateNumberObj
Creates a number object in a PDF file.
fileCreateNumberObj($file, $number) -> pdfio_obj_t
fileCreateObj
Creates an object in a PDF file.
fileCreateObj($file, $dict) -> pdfio_obj_t
fileCreateOutput
Creates a PDF file with a custom output callback.
fileCreateOutput($output_cb, $output_data, $version, $media_box, $crop_box, $error_cb, $error_data) -> pdfio_file_t
fileCreateStringObj
Creates a string object in a PDF file.
fileCreateStringObj($file, $string) -> pdfio_obj_t
fileCreateTemporary
Creates a temporary PDF file.
fileCreateTemporary($buffer, $bufsize, $version, $media_box, $crop_box, $error_cb, $error_data) -> pdfio_file_t
fileFindObj
Finds an object in a PDF file by number.
fileFindObj($file, $number) -> pdfio_obj_t
fileGetAuthor
Gets the author metadata from a PDF file.
fileGetAuthor($file) -> string
fileGetCatalog
Gets the catalog dictionary from a PDF file.
fileGetCatalog($file) -> pdfio_dict_t
fileGetCreationDate
Gets the creation date from a PDF file.
fileGetCreationDate($file) -> time_t
fileGetCreator
Gets the creator metadata from a PDF file.
fileGetCreator($file) -> string
fileGetID
Gets the file ID array from a PDF file.
fileGetID($file) -> pdfio_array_t
fileGetKeywords
Gets the keywords metadata from a PDF file.
fileGetKeywords($file) -> string
fileGetModificationDate
Gets the modification date from a PDF file.
fileGetModificationDate($file) -> time_t
fileGetName
Gets the file name.
fileGetName($file) -> string
fileGetNumObjs
Gets the number of objects in a PDF file.
fileGetNumObjs($file) -> size_t
fileGetNumPages
Gets the number of pages in a PDF file.
fileGetNumPages($file) -> size_t
fileGetObj
Gets an object from a PDF file by number.
fileGetObj($file, $number) -> pdfio_obj_t
fileGetPage
Gets a page object from a PDF file by index.
fileGetPage($file, $index) -> pdfio_obj_t
fileGetPermissions
Gets permissions from a PDF file.
fileGetPermissions($file, $encryption) -> int
fileGetProducer
Gets the producer metadata from a PDF file.
fileGetProducer($file) -> string
fileGetSubject
Gets the subject metadata from a PDF file.
fileGetSubject($file) -> string
fileGetTitle
Gets the title metadata from a PDF file.
fileGetTitle($file) -> string
fileGetVersion
Gets the PDF version.
fileGetVersion($file) -> string
fileOpen
Opens a PDF file for reading.
fileOpen($filename, $password_cb, $password_data, $error_cb, $error_data) -> pdfio_file_t
fileSetAuthor
Sets the author metadata in a PDF file.
fileSetAuthor($file, $author) -> void
fileSetCreationDate
Sets the creation date in a PDF file.
fileSetCreationDate($file, $time_t) -> void
fileSetCreator
Sets the creator metadata in a PDF file.
fileSetCreator($file, $creator) -> void
fileSetKeywords
Sets the keywords metadata in a PDF file.
fileSetKeywords($file, $keywords) -> void
fileSetModificationDate
Sets the modification date in a PDF file.
fileSetModificationDate($file, $time_t) -> void
fileSetPermissions
Sets permissions in a PDF file.
fileSetPermissions($file, $permissions, $encryption, $owner_pass, $user_pass) -> bool
fileSetSubject
Sets the subject metadata in a PDF file.
fileSetSubject($file, $subject) -> void
fileSetTitle
Sets the title metadata in a PDF file.
fileSetTitle($file, $title) -> void
fileCreateFontObjFromBase
Creates a font object from a base font.
fileCreateFontObjFromBase($file, $basefont) -> pdfio_obj_t
fileCreateFontObjFromFile
Creates a font object from a font file.
fileCreateFontObjFromFile($file, $filename, $embed) -> pdfio_obj_t
fileCreateICCObjFromData
Creates an ICC object from data.
fileCreateICCObjFromData($file, $data, $size, $ncomps) -> pdfio_obj_t
fileCreateICCObjFromFile
Creates an ICC object from a file.
fileCreateICCObjFromFile($file, $filename, $ncomps) -> pdfio_obj_t
fileCreateImageObjFromData
Creates an image object from data.
fileCreateImageObjFromData($file, $data, $width, $height, $bpc, $decode, $indexed, $mask) -> pdfio_obj_t
fileCreateImageObjFromFile
Creates an image object from a file.
fileCreateImageObjFromFile($file, $filename, $mask) -> pdfio_obj_t
imageGetBytesPerLine
Gets the number of bytes per line in an image.
imageGetBytesPerLine($obj) -> size_t
imageGetHeight
Gets the height of an image.
imageGetHeight($obj) -> double
imageGetWidth
Gets the width of an image.
imageGetWidth($obj) -> double
pageDictAddColorSpace
Adds a color space to a page dictionary.
pageDictAddColorSpace($dict, $name, $array) -> bool
pageDictAddFont
Adds a font to a page dictionary.
pageDictAddFont($dict, $name, $obj) -> bool
pageDictAddImage
Adds an image to a page dictionary.
pageDictAddImage($dict, $name, $obj) -> bool
arrayCreateColorFromICCObj
Creates a color array from an ICC object.
arrayCreateColorFromICCObj($file, $obj) -> pdfio_array_t
arrayCreateColorFromMatrix
Creates a color array from a matrix.
arrayCreateColorFromMatrix($file, $n, $matrix, $decode, $range) -> pdfio_array_t
arrayCreateColorFromPalette
Creates a color array from a palette.
arrayCreateColorFromPalette($file, $n, $palette) -> pdfio_array_t
arrayCreateColorFromPrimaries
Creates a color array from primaries.
arrayCreateColorFromPrimaries($file, $n, $xr, $xg, $xb, $yr, $yg, $yb, $zr, $zg, $zb, $zw) -> pdfio_array_t
arrayCreateColorFromStandard
Creates a color array from a standard.
arrayCreateColorFromStandard($file, $n, $standard) -> pdfio_array_t
contentClip
Sets the clipping path in a content stream.
contentClip($stream, $even_odd) -> bool
contentDrawImage
Draws an image in a content stream.
contentDrawImage($stream, $name, $x, $y, $width, $height) -> bool
contentFill
Fills the current path in a content stream.
contentFill($stream, $even_odd) -> bool
contentFillAndStroke
Fills and strokes the current path in a content stream.
contentFillAndStroke($stream, $even_odd) -> bool
contentMatrixConcat
Concatenates a matrix in a content stream.
contentMatrixConcat($stream, $matrix) -> bool
contentMatrixRotate
Rotates the matrix in a content stream.
contentMatrixRotate($stream, $angle) -> bool
contentMatrixScale
Scales the matrix in a content stream.
contentMatrixScale($stream, $sx, $sy) -> bool
contentMatrixTranslate
Translates the matrix in a content stream.
contentMatrixTranslate($stream, $tx, $ty) -> bool
contentPathClose
Closes the current path in a content stream.
contentPathClose($stream) -> bool
contentPathCurve
Adds a curve to the current path in a content stream.
contentPathCurve($stream, $x1, $y1, $x2, $y2, $x3, $y3) -> bool
contentPathCurve13
Adds a curve (variant 1-3) to the current path.
contentPathCurve13($stream, $x1, $y1, $x3, $y3) -> bool
contentPathCurve23
Adds a curve (variant 2-3) to the current path.
contentPathCurve23($stream, $x2, $y2, $x3, $y3) -> bool
contentPathEnd
Ends the current path in a content stream.
contentPathEnd($stream) -> bool
contentPathLineTo
Adds a line to the current path.
contentPathLineTo($stream, $x, $y) -> bool
contentPathMoveTo
Moves to a point in the current path.
contentPathMoveTo($stream, $x, $y) -> bool
contentPathRect
Adds a rectangle to the current path.
contentPathRect($stream, $x, $y, $width, $height) -> bool
contentRestore
Restores graphics state in a content stream.
contentRestore($stream) -> bool
contentSave
Saves graphics state in a content stream.
contentSave($stream) -> bool
contentSetDashPattern
Sets the dash pattern in a content stream.
contentSetDashPattern($stream, $phase, $length, $gap) -> bool
contentSetFillColorDeviceCMYK
Sets fill color (DeviceCMYK) in a content stream.
contentSetFillColorDeviceCMYK($stream, $c, $m, $y, $k) -> bool
contentSetFillColorDeviceGray
Sets fill color (DeviceGray) in a content stream.
contentSetFillColorDeviceGray($stream, $gray) -> bool
contentSetFillColorDeviceRGB
Sets fill color (DeviceRGB) in a content stream.
contentSetFillColorDeviceRGB($stream, $r, $g, $b) -> bool
contentSetFillColorGray
Sets fill color (Gray) in a content stream.
contentSetFillColorGray($stream, $gray) -> bool
contentSetFillColorRGB
Sets fill color (RGB) in a content stream.
contentSetFillColorRGB($stream, $r, $g, $b) -> bool
contentSetFillColorSpace
Sets fill color space in a content stream.
contentSetFillColorSpace($stream, $name) -> bool
contentSetFlatness
Sets flatness in a content stream.
contentSetFlatness($stream, $flatness) -> bool
contentSetLineCap
Sets line cap style in a content stream.
contentSetLineCap($stream, $cap) -> bool
contentSetLineJoin
Sets line join style in a content stream.
contentSetLineJoin($stream, $join) -> bool
contentSetLineWidth
Sets line width in a content stream.
contentSetLineWidth($stream, $width) -> bool
contentSetMiterLimit
Sets miter limit in a content stream.
contentSetMiterLimit($stream, $limit) -> bool
contentSetStrokeColorDeviceCMYK
Sets stroke color (DeviceCMYK) in a content stream.
contentSetStrokeColorDeviceCMYK($stream, $c, $m, $y, $k) -> bool
contentSetStrokeColorDeviceGray
Sets stroke color (DeviceGray) in a content stream.
contentSetStrokeColorDeviceGray($stream, $gray) -> bool
contentSetStrokeColorDeviceRGB
Sets stroke color (DeviceRGB) in a content stream.
contentSetStrokeColorDeviceRGB($stream, $r, $g, $b) -> bool
contentSetStrokeColorGray
Sets stroke color (Gray) in a content stream.
contentSetStrokeColorGray($stream, $gray) -> bool
contentSetStrokeColorRGB
Sets stroke color (RGB) in a content stream.
contentSetStrokeColorRGB($stream, $r, $g, $b) -> bool
contentSetStrokeColorSpace
Sets stroke color space in a content stream.
contentSetStrokeColorSpace($stream, $name) -> bool
contentSetTextCharacterSpacing
Sets text character spacing in a content stream.
contentSetTextCharacterSpacing($stream, $spacing) -> bool
contentSetTextFont
Sets text font in a content stream.
contentSetTextFont($stream, $font, $size) -> bool
contentSetTextLeading
Sets text leading in a content stream.
contentSetTextLeading($stream, $leading) -> bool
contentSetTextMatrix
Sets text matrix in a content stream.
contentSetTextMatrix($stream, $matrix) -> bool
contentSetTextRenderingMode
Sets text rendering mode in a content stream.
contentSetTextRenderingMode($stream, $mode) -> bool
contentSetTextRise
Sets text rise in a content stream.
contentSetTextRise($stream, $rise) -> bool
contentSetTextWordSpacing
Sets text word spacing in a content stream.
contentSetTextWordSpacing($stream, $spacing) -> bool
contentSetTextXScaling
Sets text X scaling in a content stream.
contentSetTextXScaling($stream, $scaling) -> bool
contentStroke
Strokes the current path in a content stream.
contentStroke($stream) -> bool
contentTextBegin
Begins a text object in a content stream.
contentTextBegin($stream) -> bool
contentTextEnd
Ends a text object in a content stream.
contentTextEnd($stream) -> bool
contentTextMeasure
Measures text width in a content stream.
contentTextMeasure($obj, $string, $size) -> double
contentTextMoveLine
Moves to the next line in a text object.
contentTextMoveLine($stream, $dx, $dy) -> bool
contentTextMoveTo
Moves to a position in a text object.
contentTextMoveTo($stream, $x, $y) -> bool
contentTextNewLine
Starts a new line in a text object.
contentTextNewLine($stream) -> bool
contentTextNewLineShow
Shows text and starts a new line.
contentTextNewLineShow($stream, $dx, $dy, $unicode, $string) -> bool
contentTextNextLine
Moves to the next line in a text object.
contentTextNextLine($stream) -> bool
contentTextShow
Shows text in a text object.
contentTextShow($stream, $unicode, $string) -> bool
contentTextShowJustified
Shows justified text in a text object.
contentTextShowJustified($stream, $unicode, $count, $strings, $widths) -> bool
objClose
Closes a PDF object.
objClose($obj) -> bool
objCopy
Copies a PDF object.
objCopy($file, $obj) -> pdfio_obj_t
objCreateStream
Creates a stream in a PDF object.
objCreateStream($obj, $compress) -> pdfio_stream_t
objGetArray
Gets an array from a PDF object.
objGetArray($obj) -> pdfio_array_t
objGetDict
Gets a dictionary from a PDF object.
objGetDict($obj) -> pdfio_dict_t
objGetGeneration
Gets the generation number of a PDF object.
objGetGeneration($obj) -> ushort
objGetLength
Gets the length of a PDF object.
objGetLength($obj) -> size_t
objGetName
Gets the name of a PDF object.
objGetName($obj) -> string
objGetNumber
Gets the number of a PDF object.
objGetNumber($obj) -> size_t
objGetSubtype
Gets the subtype of a PDF object.
objGetSubtype($obj) -> string
objGetType
Gets the type of a PDF object.
objGetType($obj) -> string
objOpenStream
Opens a stream from a PDF object.
objOpenStream($obj, $decode) -> pdfio_stream_t
pageCopy
Copies a page in a PDF file.
pageCopy($file, $obj) -> bool
pageGetNumStreams
Gets the number of streams in a page.
pageGetNumStreams($obj) -> size_t
pageOpenStream
Opens a stream from a page.
pageOpenStream($obj, $index, $decode) -> pdfio_stream_t
streamClose
Closes a PDF stream.
streamClose($stream) -> bool
streamConsume
Consumes bytes from a PDF stream.
streamConsume($stream, $count) -> bool
streamGetToken
Gets a token from a PDF stream.
streamGetToken($stream, $buffer, $size) -> bool
streamPeek
Peeks at bytes in a PDF stream.
streamPeek($stream, $buffer, $size) -> ssize_t
streamPutChar
Writes a character to a PDF stream.
streamPutChar($stream, $char) -> bool
streamPuts
Writes a string to a PDF stream.
streamPuts($stream, $string) -> bool
streamRead
Reads bytes from a PDF stream.
streamRead($stream, $buffer, $size) -> ssize_t
streamWrite
Writes bytes to a PDF stream.
streamWrite($stream, $buffer, $size) -> bool
stringCreate
Creates a PDF string object.
stringCreate($file, $string) -> string
AUTHOR
LNATION, <email at lnation.org>
BUGS
Please report any bugs or feature requests to bug-pdfio-ffi at rt.cpan.org
, or through the web interface at https://rt.cpan.org/NoAuth/ReportBug.html?Queue=PDFio-FFI. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc PDFio::FFI
You can also look for information at:
RT: CPAN's request tracker (report bugs here)
Search CPAN
ACKNOWLEDGEMENTS
LICENSE AND COPYRIGHT
This software is Copyright (c) 2025 by LNATION.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)
2 POD Errors
The following errors were encountered while parsing the POD:
- Around line 695:
You forgot a '=back' before '=head2'
- Around line 1793:
=back without =over