Doc

PDF Document Class

class Doc : IHaruObject {}

Constructors

this
this()

Creates a new Doc instance

this
this(void delegate(HPDF_STATUS error_no, HPDF_STATUS detail_no) _dlg)

Creates a new Doc instance with a delegate which is invoked when an error occurred.

Members

Functions

addPage
Page addPage()

Creates a new page and adds it after the last page of a document.

addPageLabel
HPDF_STATUS addPageLabel(uint pageNum, PageNumStyle style, uint firstPage, string prefix)

Adds a page labeling range for the document.

createOutline
Outline createOutline(string title, Outline parent, Encoder encoder)

Creates an instance of Outline object.

getCurrentEncoder
Encoder getCurrentEncoder()

Gets the handle of the current encoder of the document object.

getCurrentPage
Page getCurrentPage()

Returns current page object.

getEncoder
Encoder getEncoder(string encodingName)

Gets an instance of a Encoder object by specified encoding name

getError
HPDF_STATUS getError()

Returns the last error code.

getFont
Font getFont(string fontName)

Gets a Font instance of the requested font

getFont
Font getFont(string fontName, string encodingName)

Gets a Font instance of the requested font

getHandle
HPDF_HANDLE getHandle()
Undocumented in source. Be warned that the author may not have intended to support it.
getInfoAttr
string getInfoAttr(HaruInfoType type)

Gets an attribute value from info dictionary.

getPageLayout
PageLayout getPageLayout()

Returns the current setting for page layout

getPageMode
PageMode getPageMode()

Returns the current setting for page mode

getStreamSize
uint getStreamSize()

Gets the size of the temporary stream of the document.

insertPage
Page insertPage(Page target)

Creates a new page and inserts it just before the specified page.

loadJpegImageFromFile
Image loadJpegImageFromFile(string filename)

Loads an external JPEG image file

loadPngImageFromFile
Image loadPngImageFromFile(string filename, bool deferred)

Loads an external PNG image file.

loadRawImageFromFile
Image loadRawImageFromFile(string filename, uint width, uint height, ColorSpace colorSpace)

Loads an image which has "raw" image format.

loadRawImageFromMem
Image loadRawImageFromMem(ubyte* buf, uint width, uint height, ColorSpace colorSpace, uint bitsPerComponent)

Loads an image which has raw image format from buffer.

loadTTFontFromFile
string loadTTFontFromFile(string filename, bool embedding)

Loads a TrueType font from an external file and register it to a document object

loadTTFontFromFile
string loadTTFontFromFile(string filename, uint index, bool embedding)

Loads a TrueType font from an external file (at the selected index) and register it to a document object

loadType1FontFromFile
string loadType1FontFromFile(string afmfilename, string pfmfilename)

Loads a Type1 font from an external file and registers it in the document object

readFromStream
HPDF_STATUS readFromStream(ubyte* buf, uint* size)

Copies the data from the temporary stream of the document into a buffer.

resetError
void resetError()

Once an error code is set, IO processing functions cannot be invoked.

resetStream
HPDF_STATUS resetStream()

Rewinds the temporary stream of the document

saveToFile
HPDF_STATUS saveToFile(string filename)

Saves the document to a file.

saveToStream
HPDF_STATUS saveToStream()

Saves the document to a temporary stream.

setCompressionMode
HPDF_STATUS setCompressionMode(CompressionMode mode)

Set the mode of compression.

setCurrentEncoderByName
HPDF_STATUS setCurrentEncoderByName(string encodingName)

Sets the current encoder for the document

setEncryptionMode
HPDF_STATUS setEncryptionMode(HaruEncryptMode mode, uint keyLen)

Set the encryption mode. As the side effect, ups the version of PDF to 1.4 when the mode is set to HaruEncryptMode.R3

setErrorHandler
HPDF_STATUS setErrorHandler(void delegate(HPDF_STATUS, HPDF_STATUS) _dlg)

Sets a user-defined error delegate.

setInfoAttr
HPDF_STATUS setInfoAttr(HaruInfoType type, string value)

Sets the text of an info dictionary attribute, using current encoding of the document

setInfoDateAttr
HPDF_STATUS setInfoDateAttr(HaruInfoType type, HaruDate value)

Sets a datetime attribute in the info dictionary.

setOpenAction
HPDF_STATUS setOpenAction(HPDF_Destination openAction)

Set the first page to appear when a document is opened.

setPageLayout
void setPageLayout(PageLayout layout)

Sets how the page should be displayed.

setPageMode
void setPageMode(PageMode mode)

Sets how the document should be displayed

setPagesConfiguration
HPDF_STATUS setPagesConfiguration(uint pagePerPages)

In the default setting, a Doc object has one "Pages" object as root of pages.

setPassword
HPDF_STATUS setPassword(string ownerPasswd, string userPasswd)

Sets a password for the document. If the password is set, document contents are encrypted

setPermission
HPDF_STATUS setPermission(HaruPermission permission)

Set the permission flags for the document

useCNSEncodings
HPDF_STATUS useCNSEncodings()

Enables simplified Chinese encodings.

useCNSFonts
HPDF_STATUS useCNSFonts()

Enables simplified Chinese fonts.

useCNTEncodings
HPDF_STATUS useCNTEncodings()

Enables traditional Chinese encodings.

useCNTFonts
HPDF_STATUS useCNTFonts()

Enables traditional Chinese fonts.

useJPEncodings
HPDF_STATUS useJPEncodings()

Enables Japanese encodings.

useJPFonts
HPDF_STATUS useJPFonts()

Enables Japanese fonts. After useJPFonts() is involed, an application can use the following Japanese fonts

useKREncodings
HPDF_STATUS useKREncodings()

Enables Korean encodings.

useKRFonts
HPDF_STATUS useKRFonts()

Enables Korean fonts. After useKRFonts() is involed, an application can use the following Korean fonts

Static functions

errorHandler
void errorHandler(HPDF_STATUS error_no, HPDF_STATUS detail_no, Doc doc)
Undocumented in source. Be warned that the author may not have intended to support it.

Variables

_doc
HPDF_Doc _doc;
Undocumented in source.
dlg
void delegate(HPDF_STATUS, HPDF_STATUS) dlg;
Undocumented in source.
fuente
HPDF_Font fuente;
Undocumented in source.

Meta