PDF-Make

 view release on metacpan or  search on metacpan

include/pdfmake_page.h  view on Meta::CPAN

 * Add a Standard 14 font to the page's resources.
 * `name` is the resource name (e.g., "F1") used in content streams.
 * `base_font` is the BaseFont name (e.g., "Helvetica").
 * Returns the font's indirect object number, or 0 on error.
 */
uint32_t pdfmake_page_add_font(pdfmake_page_t *page,
                               const char *name,
                               const char *base_font);

/*
 * Add a Standard 14 font by enum.
 */
uint32_t pdfmake_page_add_std14_font(pdfmake_page_t *page,
                                      const char *name,
                                      pdfmake_std14_font_t font);

/*----------------------------------------------------------------------------
 * Content stream
 *--------------------------------------------------------------------------*/

/*
 * Add an image XObject to the page's resources.
 * `name` is the resource name (e.g., "Im0") used in content streams.
 * `img_obj_num` is the indirect object number of the /Image XObject.
 * Returns the resource index, or -1 on error.
 */
int pdfmake_page_add_image(pdfmake_page_t *page,
                           const char *name,
                           uint32_t img_obj_num);

/*
 * Add an ExtGState dictionary to the page's resources.
 * `name` is the resource name (e.g., "GS1") used by the `gs` operator.
 * `extgstate_obj_num` is the indirect object number of the /ExtGState dict.
 * Returns resource index, or -1 on error.
 */
int pdfmake_page_add_extgstate(pdfmake_page_t *page,
                               const char *name,
                               uint32_t extgstate_obj_num);

/*
 * Set the page's content stream from raw bytes.
 * For phase 05, this is a hand-written PDF content stream.
 * Phase 06 will add a content builder API.
 * Returns PDFMAKE_OK on success.
 */
pdfmake_err_t pdfmake_page_set_content(pdfmake_page_t *page,
                                        const uint8_t *data,
                                        size_t len);

/*
 * Set the page's content stream from a null-terminated string.
 * Convenience wrapper for ASCII content streams.
 */
pdfmake_err_t pdfmake_page_set_content_str(pdfmake_page_t *page,
                                            const char *content);

/*
 * Append content bytes to the page's existing content stream.  Wraps the
 * existing content in `q .. Q` and concatenates the new bytes afterwards
 * so overlay drawing starts from a clean graphics state.  When the page
 * has no prior content, this is equivalent to pdfmake_page_set_content.
 */
pdfmake_err_t pdfmake_page_append_content(pdfmake_page_t *page,
                                           const uint8_t *data,
                                           size_t len);

/*----------------------------------------------------------------------------
 * Catalog and page tree
 *--------------------------------------------------------------------------*/

/*
 * Finalize the document structure.
 * Builds the /Catalog and /Pages dictionaries, wires Root in trailer.
 * Called automatically by pdfmake_doc_write if not already called.
 * Returns PDFMAKE_OK on success.
 */
pdfmake_err_t pdfmake_doc_finalize(pdfmake_doc_t *doc);

/*
 * Check if the document has been finalized.
 */
int pdfmake_doc_is_finalized(pdfmake_doc_t *doc);

/*----------------------------------------------------------------------------
 * Default page sizes (in points, 72 points = 1 inch)
 *--------------------------------------------------------------------------*/

#define PDFMAKE_PAGE_A4_WIDTH   595.0
#define PDFMAKE_PAGE_A4_HEIGHT  842.0

#define PDFMAKE_PAGE_LETTER_WIDTH  612.0
#define PDFMAKE_PAGE_LETTER_HEIGHT 792.0

#define PDFMAKE_PAGE_LEGAL_WIDTH   612.0
#define PDFMAKE_PAGE_LEGAL_HEIGHT  1008.0

#ifdef __cplusplus
}
#endif

#endif /* PDFMAKE_PAGE_H */



( run in 0.465 second using v1.01-cache-2.11-cpan-600a1bdf6e4 )