SetaPDF_Core_Writer_Http A writer class for HTTP delivery

File: /SetaPDF v2/Core/Writer/Http.php

Class hierarchy

Implements

Summary

Properties

$_buffer

$_bufferSize

$_filename

protected string SetaPDF_Core_Writer_Http::$_filename = 'document.pdf'

The document filename

$_handle

The file stream resource

$_inline

protected boolean SetaPDF_Core_Writer_Http::$_inline = false

Flag saying that the file should be displayed inline or not

$_outputChunkSize

Chunk size that is output at once.

$_status

Status property


Static Methods

encodeFilenameForHttpHeader()

public static SetaPDF_Core_Writer_Http::encodeFilenameForHttpHeader (
string $filename
): string

Encodes the file name for the http header.

Parameters
$filename : string
 

Methods

__construct()

public SetaPDF_Core_Writer_Http::__construct (
[ string $filename = 'document.pdf' [, boolean $inline = false ]]
)

The constructor.

Parameters
$filename : string

The document filename in UTF-8 encoding

$inline : boolean

Defines if the document should be displayed inline or if a download should be forced

__destruct()

The deconstructor closes the file handle.

_flush()

protected SetaPDF_Core_Writer_TempStream::_flush (
void
): void

Flushes the buffer to the stream and resets the buffer.

_setHandle()

protected SetaPDF_Core_Writer_Stream::_setHandle (
resource $handle
): void

Set the stream handle.

Parameters
$handle : resource
 

cleanUp()

Method which should/will be called when the document objects cleanUp() method is called.

copy()

Copies an existing stream into the target stream.

Parameters
$source : resource|SetaPDF_Core_Writer_Stream
 

finish()

public SetaPDF_Core_Writer_Http::finish (
void
): void

This method is called when the writing process is finished.

It sends the HTTP headers and send the buffer to the client.

Exceptions

Throws SetaPDF_Core_Writer_Exception

getHandle()

public SetaPDF_Core_Writer_TempStream::getHandle (
void
): resource

Gets the handle of the stream.

This method is overwritten to ensure that the handle is only accessed when the writer instance has the status "finished".

getPos()

public SetaPDF_Core_Writer_TempStream::getPos (
void
): integer

Returns the current position.

getStatus()

Get the current status of the writer object.

setOutputChunkSize()

public SetaPDF_Core_Writer_Http::setOutputChunkSize (
int $outputChunkSize
): void

Set the chunk size of the data that is read from the internal stream and echoed.

The default value is 4 MB. You may increase this which may speed up the delivery of large files but will also increase the memory usage respectively.

Parameters
$outputChunkSize : int

Size in bytes.

start()

Method which should/will be called when the writing process starts.

write()

public SetaPDF_Core_Writer_TempStream::write (
string $s
): void

Write content to the stream or buffer.

Parameters
$s : string