Vanilla.PDF  2.0.0
Cross-platform toolkit for creating and modifying PDF documents
FileHandle Class Reference

Represents low-level file access handle. More...

Inheritance diagram for FileHandle:
IUnknownHandle
error_type CALLING_CONVENTION File_Open (string_type filename, FileHandle **result)
 Opens a file for reading.
 
error_type CALLING_CONVENTION File_OpenStream (InputOutputStreamHandle *input_stream, string_type name, FileHandle **result)
 Opens an input stream for reading.
 
error_type CALLING_CONVENTION File_Create (string_type filename, FileHandle **result)
 Creates a file for writing.
 
error_type CALLING_CONVENTION File_CreateStream (InputOutputStreamHandle *input_stream, string_type name, FileHandle **result)
 Uses arbitrary stream as a file.
 
error_type CALLING_CONVENTION File_Initialize (FileHandle *handle)
 Perform basic intialization.
 
error_type CALLING_CONVENTION File_GetVersion (FileHandle *handle, PDFVersion *result)
 The version of the PDF specification to which the document conforms.
 
error_type CALLING_CONVENTION File_GetFilename (FileHandle *handle, BufferHandle **result)
 Get ASCII representation the name of the current file on the physical filesystem.
 
error_type CALLING_CONVENTION File_IsEncrypted (FileHandle *handle, boolean_type *result)
 Determine if file is encrypted.
 
error_type CALLING_CONVENTION File_SetEncryptionPassword (FileHandle *handle, string_type password)
 Set encryption password.
 
error_type CALLING_CONVENTION File_SetEncryptionKey (FileHandle *handle, EncryptionKeyHandle *key)
 Set files encryption key.
 
error_type CALLING_CONVENTION File_XrefChain (FileHandle *handle, XrefChainHandle **result)
 Get chain of xref tables for iteration.
 
error_type CALLING_CONVENTION File_GetIndirectObject (FileHandle *handle, biguint_type obj_number, ushort_type gen_number, ObjectHandle **result)
 Find exact object within all xref tables.
 
error_type CALLING_CONVENTION File_AllocateNewEntry (FileHandle *handle, XrefUsedEntryHandle **result)
 Find exact object within all xref tables.
 
error_type CALLING_CONVENTION File_ToUnknown (FileHandle *handle, IUnknownHandle **result)
 Reinterpret current object as IUnknownHandle.
 
error_type CALLING_CONVENTION File_FromUnknown (IUnknownHandle *handle, FileHandle **result)
 Convert IUnknownHandle to FileHandle.
 
error_type CALLING_CONVENTION File_Release (FileHandle *handle)
 Decrement the internal reference counter.
 

Additional Inherited Members

- Public Member Functions inherited from IUnknownHandle
error_type CALLING_CONVENTION IUnknown_AddRef (IUnknownHandle *handle)
 Increment the internal reference counter.
 

Detailed Description

Represents low-level file access handle.

The file is basically composed of:

  • Header is basically just a statement about the PDF version this file is referring to
  • Body is just a sequence of Objects described in cross-reference section
  • The trailer contains the XrefHandle itself, with the bytes offset to start of the last cross-reference section.

When the file has been incrementally updated, there may be multiple cross-reference sections.

For more details please visit section 7.5 - File Structure and section 7.5.6 - Incremental Updates.

Examples
decrypt.c, extract.c, main.c, sign.c, sign_custom.c, and write_custom.c.

Member Function Documentation

◆ File_Open()

error_type CALLING_CONVENTION File_Open ( string_type filename,
FileHandle ** result )

Opens a file for reading.

The file must exist.

Friends And Related Symbol Documentation

◆ File_Create()

error_type CALLING_CONVENTION File_Create ( string_type filename,
FileHandle ** result )
related

Creates a file for writing.

Truncates the contents if it already exists.

◆ File_Initialize()

error_type CALLING_CONVENTION File_Initialize ( FileHandle * handle)
related

Perform basic intialization.

Read xref tables, determine if file is encrypted.

◆ File_IsEncrypted()

error_type CALLING_CONVENTION File_IsEncrypted ( FileHandle * handle,
boolean_type * result )
related

Determine if file is encrypted.

If the file was not initialized returns false.

◆ File_SetEncryptionKey()

error_type CALLING_CONVENTION File_SetEncryptionKey ( FileHandle * handle,
EncryptionKeyHandle * key )
related

Set files encryption key.

This is most often certificate.

See also
EncryptionKeyHandle

◆ File_Release()

error_type CALLING_CONVENTION File_Release ( FileHandle * handle)
related

Decrement the internal reference counter.

When the internal counter reaches zero the object is deleted. Releasing already disposed object causes undefined behavior.

See also
IUnknown_Release

The documentation for this class was generated from the following file: