PROGRAMMING GUIDE
PDF documents can be defined with a wide variety of page layout. Here is a description of the different techniques that HOOPS Publish can support. The application sample DemoFunctionalities provided in the HOOPS Publish package illustrates all these variety of page layout definitions.
Using HOOPS Publish functions, the definition of a PDF document can start by creating an empty document (A3DPDFDocumentCreateEmpty), or by using an existing PDF file (A3DPDFDocumentCreateFromPDFFile).
Pages can be appended to any document with A3DPDFDocumentAppendNewPage or A3DPDFDocumentAppendPageFromPDFFileEx (this one should be preferred to import pages from PDF files that contain form fields). A page is determined with a predefined set of formats (A4, letter ...) and an orientation (portrait / landscape). The unit of a page is a point. A point is approximately 1/72 inch.
Pages objects are returned by append functions or can be accessed at any time using A3DPDFDocumentGetNumberPages and A3DPDFDocumentGetPage functions.
Or
Once a page is accessed, functions can be used to create and position entities such as 3D, text, image, table, or link. See insertion functions described in section Inserting data on a page.
Form fields on pages can be populated using the field functions described in section Populating page fields.
The functions A3DPDFPageGetFields and A3DPDFFieldGetInformation can be used to get information on the fields in a page. Ultimately these functions can be useful to dynamically generate reports with only a sub-set of fields selected beyond a large possible list (the application supports hundreds of type of fields, but the end-user only selects a limited number of them to figure in the report).
You can set some PDF properties on the document. These properties are shown in the Adobe Reader with the menu File / Properties. To set PDF properties, use the function A3DPDFDocumentSetInformation.
You can store files as attached in the PDF file. These attachments are shown in the Adobe Reader with the dedicated panel (accessible with icons on the left). To add a file attachment on the PDF, use the function A3DPDFDocumentAddFileAttachment.
HOOPS Publish has a function to secure the PDF file with passwords. This is a native functionality of Adobe Reader and a secured PDF file will display a password dialog box when the Reader is initialized.
PDF documents may also be secured defining a permissions field and passing it to the function A3DPDFDocumentSetDocumentPermissions. Among other things, these permissions gives the document author the ability to control whether the document may be edited, saved, copied, or printed. The bit field is documented here.
On the end the document needs to be saved. For this, use the function A3DPDFDocumentSave. The file is saved to be optimized.
Whatever the way the document was opened, it needs to be closed on the end of the working session. During this close, all memory allocated by HOOPS Publish is freed.