Creating Documents Having Different File Formats
The LEADTOOLS Document Writers SDK can create the following types of file formats:
LEADTOOLS Temporary Document (LTD). This format creates a temporary file on disk that can later be converted to any of the other formats supported by the LEADTOOLS Document Writers.
User-defined document format. This format is not used inside the LEADTOOLS Document Writers toolkit. The User format is one of the available output formats in the LEADTOOLS OCR toolkit. It is a special case that instructs the OCR framework to save the document using the engine’s native format. Refer to Programming with LEADTOOLS OCR.
Before using the LEADTOOLS Document Writers SDK, unlock it using L_UnlockSupport. If you want to use the PDF format you must also unlock PDF support with L_UnlockSupport.
Initialize the LEADTOOLS Document Writers SDK by calling L_DocWriterInit. In addition to initialization this function creates the document handle and sets the format type and format options for the file being created. Each format has its own specific options. These options are passed when the L_DocWriterInit function is called.
The L_DocWriterInit function also sets the progress callback function which shows the job’s progress. The callback function must adhere to the function prototype described in the STATUSCALLBACK function.
To add a page to a new document file, call the L_DocWriterAddPage. This function uses the data in the DOCWRTPAGE structure,which provides information about the page to be inserted. It should have a valid EMF handle for the page to be created. When creating a PDF file an overlay image can be added to the inserted page if the bitmap handle member at DOCWRTPAGE has valid data and DOCWRTPDFOPTIONS is correctly initialized.
Use the L_DocWriterConvert function to convert a file from the LEADTOOLS Temporary Document (LTD) format to any of the listed document file formats. Conversion from LTD format to LTD format is not permitted.
After adding all of the new pages, call the L_DocWriterFinish function to finish file writing and create the document file. This function also frees all allocated resources.