Creating a PDF document


PDF documents can be defined with a wide variety of page layouts. Here is a description of the different techniques that HOOPS Publish can support. The application sample DemoFunctionalities provided in the HOOPS Publish package illustrates many of these page layout definitions.

Creating a PDF from scratch

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 A3DPDFDocumentAppendNewPage2 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.

A3DPDFDocument* pDoc = NULL;
A3DPDFPageData2 sPageData;
sPageData.m_ePageSize = kA3DPDFPageLetter; // standard letter format: 612 x 792
A3DPDFPage* pPage = NULL;
iRet = A3DPDFDocumentAppendNewPage2(pDoc, &sPageData, &pPage);


A3DPDFPage* pPage = NULL;
A3DInt32 indexpage, nbpages;
iRet = A3DPDFDocumentAppendPageFromPDFFileEx(pDoc, "c:\\temp\\mypdf.pdf", false, &pPage);
iRet = A3DPDFDocumentGetNumberPages(pDoc, &nbpages);
for (indexpage = 0; indexpage < nbpages; indexpage++)
iRet = A3DPDFDocumentGetPage(pDoc, indexpage, &pPage);

Once a page is accessed, functions can be used to create and position entities such as 3D, text, image, scroll table, or view carousel. See insertion functions described in section Page layout.

Using template

In a template scenario, an existing PDF file is opened with A3DPDFDocumentAppendPageFromPDFFileEx.

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).

Once the page is accessed, widget fields on pages can be populated using the field functions described in Populating fields section.

top_level:1 prog_guide:1