#include <stdio.h>
#include <string.h>
#include <setjmp.h>
#include "handler.h"
const char *captions[] = {
"Translate",
"Scale",
"Rotate",
"Skew",
"Combined"
};
{
}
{
}
void draw_caption (
HPDF_Page page,
int index)
{
}
int
main (int argc, char **argv)
{
char fname[256];
strcpy (fname, argv[0]);
strcat (fname, ".pdf");
pdf =
HPDF_New (demo_error_handler, NULL);
if (!pdf) {
printf ("error: cannot create PdfDoc object\n");
return 1;
}
if (setjmp(env)) {
return 1;
}
page_height - rect_height - 20*
HPDF_MM,
page_height - rect_height - 90*
HPDF_MM,
page_height - rect_height - 90*
HPDF_MM,
page_height - rect_height - 90*
HPDF_MM};
draw_rect (page);
draw_transformed (page);
draw_caption (page, 0);
draw_rect (page);
draw_transformed (page);
draw_caption (page, 1);
draw_rect (page);
draw_transformed (page);
draw_caption (page, 2);
draw_rect (page);
draw_transformed (page);
draw_caption (page, 3);
draw_rect (page);
draw_transformed (page);
draw_caption (page, 4);
return 0;
}
HPDF_STATUS HPDF_SaveToFile(HPDF_Doc pdf, const char *filename)
Saves the current document to file.
void HPDF_Free(HPDF_Doc pdf)
Revoke a document object and all resources.
HPDF_Doc HPDF_New(HPDF_Error_Handler user_error_fn, void *user_data)
Create an instance of a document object and initialize it.
HPDF_Font HPDF_GetFont(HPDF_Doc pdf, const char *font_name, const char *encoding_name)
Get requested font object handle.
HPDF_STATUS HPDF_Page_SetLineWidth(HPDF_Page page, HPDF_REAL line_width)
Set width of the line used to stroke paths.
HPDF_STATUS HPDF_Page_Skew(HPDF_Page page, HPDF_REAL a, HPDF_REAL b)
Concatenate the page's transformation matrix with skew matrix.
HPDF_STATUS HPDF_Page_Stroke(HPDF_Page page)
Paint current path.
HPDF_STATUS HPDF_Page_SetRGBStroke(HPDF_Page page, HPDF_REAL r, HPDF_REAL g, HPDF_REAL b)
Set stroke color (RGB).
HPDF_STATUS HPDF_Page_TextOut(HPDF_Page page, HPDF_REAL xpos, HPDF_REAL ypos, const char *text)
Put text to the specified position.
HPDF_STATUS HPDF_Page_Scale(HPDF_Page page, HPDF_REAL sx, HPDF_REAL sy)
Concatenate the page's transformation matrix with scale matrix.
HPDF_STATUS HPDF_Page_GSave(HPDF_Page page)
Save the page's current graphics state to the stack.
HPDF_STATUS HPDF_Page_SetFontAndSize(HPDF_Page page, HPDF_Font font, HPDF_REAL size)
Set the type of font and size leading.
HPDF_STATUS HPDF_Page_Rectangle(HPDF_Page page, HPDF_REAL x, HPDF_REAL y, HPDF_REAL width, HPDF_REAL height)
Append rectangle to the current path.
HPDF_STATUS HPDF_Page_Translate(HPDF_Page page, HPDF_REAL dx, HPDF_REAL dy)
Concatenate the page's transformation matrix with translation matrix.
HPDF_STATUS HPDF_Page_SetDash(HPDF_Page page, const HPDF_REAL *dash_pattern, HPDF_UINT num_elem, HPDF_REAL phase)
Set dash pattern for lines in the page.
HPDF_STATUS HPDF_Page_GRestore(HPDF_Page page)
Restore graphics state which is saved by HPDF_Page_GSave().
HPDF_STATUS HPDF_Page_Rotate(HPDF_Page page, HPDF_REAL a)
Concatenate the page's transformation matrix with rotate matrix.
HPDF_STATUS HPDF_Page_BeginText(HPDF_Page page)
Begin text object and set text position to (0, 0).
HPDF_STATUS HPDF_Page_EndText(HPDF_Page page)
Finish text object.
HPDF_REAL HPDF_Page_GetHeight(HPDF_Page page)
Get page height.
HPDF_Page HPDF_AddPage(HPDF_Doc pdf)
Create new page and add it after the last page of document.
HPDF_STATUS HPDF_Page_SetSize(HPDF_Page page, HPDF_PageSizes size, HPDF_PageDirection direction)
Change page size and direction to a predefined ones.
#define HPDF_MM
Predefined value for calculations with millimeters. Equals to 72.0/25.4 (72 points pre inch per mm).
Definition: hpdf_consts.h:178
#define HPDF_PI
Definition: hpdf_consts.h:32
@ HPDF_PAGE_SIZE_A4
ISO 216 "A4" page size (210.0mm x 297.0mm)
Definition: hpdf_page_sizes.h:137
float HPDF_REAL
Definition: hpdf_types.h:79
@ HPDF_PAGE_LANDSCAPE
Landscape orientation (longest size horizontal)
Definition: hpdf_types.h:577
Definition: hpdf_objects.h:421
Definition: hpdf_doc.h:36