Mako 8.1.0 API
Loading...
Searching...
No Matches
JawsMako::IInput Class Referenceabstract

Abstract input source that can open files from disk or a stream and create an IDocumentAssembly for the contents. More...

#include <jawsmako.h>

Inheritance diagram for JawsMako::IInput:

Public Member Functions

virtual IDocumentAssemblyPtr open (const U8String &pathToFile)=0
 Open a file on disk, returning the IDocumentAssembly representing the contents.
 
virtual IDocumentAssemblyPtr open (const String &pathToFile)=0
 Open a file on disk, returning the IDocumentAssembly representing the contents. Takes a wide character string.
 
virtual IDocumentAssemblyPtr open (const IInputStreamPtr &inputStream)=0
 Open a stream, returning the IDocumentAssembly representing the contents.
 
virtual void setSequentialMode (bool sequential)=0
 Set/unset sequential mode on this input.
 
virtual void setParameter (const U8String &param, const U8String &value)=0
 Apply a key value pair output parameter with a string value. The parameter name is case-insensitive. Please refer to the supplied documentation for the details of the available parameters and their ranges.
 
- Public Member Functions inherited from IRCObject
virtual void addRef () const =0
 Increases the reference count of the actual object pointed to. This would take place during an assignment or copying.
 
virtual bool decRef () const =0
 Decreases the reference count of the actual object pointed to. When the reference count falls to Zero, it deletes the actual object pointed to.
 
virtual int32 getRefCount () const =0
 Retrieve the current reference count of the actual object pointed to.
 

Static Public Member Functions

static JAWSMAKO_API IInputPtr create (const IJawsMakoPtr &jawsMako, eFileFormat format, const IProgressMonitorPtr &progressMonitor=IProgressMonitorPtr())
 Create an input for reading source documents in the given format. The following formats are currently supported:
 

Additional Inherited Members

- Protected Member Functions inherited from IRCObject
virtual ~IRCObject ()
 Virtual destructor.
 

Detailed Description

Abstract input source that can open files from disk or a stream and create an IDocumentAssembly for the contents.

Member Function Documentation

◆ create()

static JAWSMAKO_API IInputPtr JawsMako::IInput::create ( const IJawsMakoPtr & jawsMako,
eFileFormat format,
const IProgressMonitorPtr & progressMonitor = IProgressMonitorPtr() )
static

Create an input for reading source documents in the given format. The following formats are currently supported:

  • PDF
  • XPS
  • OpenXPS
  • PCL5
  • PCL/XL
  • PostScript
  • Encapsulated PostScript
  • IJPDS
  • PPML
  • PRN
Parameters
jawsMakoA smart pointer to an IJawsMako object.
formatThe file format of the input file.
progressMonitorA smart pointer to an IProgressMonitor object which can be NULL if no object was passed.
Returns
IInputPtr The input

◆ open() [1/3]

virtual IDocumentAssemblyPtr JawsMako::IInput::open ( const IInputStreamPtr & inputStream)
pure virtual

Open a stream, returning the IDocumentAssembly representing the contents.

Parameters
inputStreamThe input stream to read from.
Returns
IDocumentAssemblyPtr the document assembly.

◆ open() [2/3]

virtual IDocumentAssemblyPtr JawsMako::IInput::open ( const String & pathToFile)
pure virtual

Open a file on disk, returning the IDocumentAssembly representing the contents. Takes a wide character string.

Parameters
pathToFileThe path to the file to open.
Returns
IDocumentAssemblyPtr The document assembly.

◆ open() [3/3]

virtual IDocumentAssemblyPtr JawsMako::IInput::open ( const U8String & pathToFile)
pure virtual

Open a file on disk, returning the IDocumentAssembly representing the contents.

Parameters
pathToFileThe path to the file to open.
Returns
IDocumentAssemblyPtr the document assembly.

◆ setParameter()

virtual void JawsMako::IInput::setParameter ( const U8String & param,
const U8String & value )
pure virtual

Apply a key value pair output parameter with a string value. The parameter name is case-insensitive. Please refer to the supplied documentation for the details of the available parameters and their ranges.

Parameters
paramKey
valueValue

◆ setSequentialMode()

virtual void JawsMako::IInput::setSequentialMode ( bool sequential)
pure virtual

Set/unset sequential mode on this input.

The Mako APIs allow random access to pages for all input types. However some input formats, particularly PCL/5 do not lend themselves to efficient random access. An input may need to buffer up page information as it passes it in order to allow pages to be re-fetched or accessed in random order.

This API allows the user to hint to the input that pages will be accessed in sequential order and will not be re-requested. This may allow the input to use more memory efficient methods.

Should this mode be enabled and a page requested out of order, or re-requested, an exception may result. Also with this mode, do not used IDocument::getNumPages() or IDocumentAssembly::getNumDocuments(). Instead use an idiom, similar to the following, to advance through the documents and pages:

for (uint32 docNum = 0; ; docNum++)
{
    IDocumentPtr doc;

    try
    {
        doc = assembly->getDocument(docNum);
    }
    catch (IError &e)
    {
        if (e.getErrorCode() == JM_ERR_DOCUMENT_NOT_FOUND)
        {
            // No more documents
            break;
        }
        // Some other error
        throw;
    }

    for (uint32 pageNum = 0; ; pageNum++)
    {
        IPagePtr page;
        try
        {
            page = doc->getPage(pageNum);
        }
        catch (IError &e)
        {
            if (e.getErrorCode() == JM_ERR_PAGE_NOT_FOUND)
            {
                // No more pages
                break;
            }
            // Some other failure. Propagate.
            throw;
        }
    }
}
Note
Currently this mode is only implemented for PCL/5.

The default is false.

Parameters
sequentialWhether to use sequential mode.

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