#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include "grid_sheet.h"
#include "handler.h"
#include "utils.h"
int no = 0;
void
{
char buf[512];
no++;
HPDF_snprintf (buf, 512,
".[%d]%0.2f %0.2f", no, pos.
x, pos.
y);
}
int
main (int argc, char **argv)
{
char fname[256];
float angle1;
float angle2;
float rad1;
float rad2;
int i;
const char* SAMP_TXT = "The quick brown fox jumps over the lazy dog. ";
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;
}
print_grid (pdf, page);
angle1 = 5;
angle2 = 10;
angle1 = 5;
angle1 = 360 / (strlen (SAMP_TXT));
angle2 = 180;
for (i = 0; i < strlen (SAMP_TXT); i++) {
char buf[2];
float x;
float y;
rad1 = (angle2 - 90) / 180 *
HPDF_PI;
x = 210 + cos(rad2) * 122;
y = 190 + sin(rad2) * 122;
buf[0] = SAMP_TXT[i];
buf[1] = 0;
angle2 -= angle1;
}
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_Stroke(HPDF_Page page)
Paint current path.
HPDF_STATUS HPDF_Page_SetTextLeading(HPDF_Page page, HPDF_REAL value)
Set text leading (line spacing).
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_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_Concat(HPDF_Page page, HPDF_REAL a, HPDF_REAL b, HPDF_REAL c, HPDF_REAL d, HPDF_REAL x, HPDF_REAL y)
Concatenate the page's transformation matrix and specified matrix.
HPDF_STATUS HPDF_Page_Circle(HPDF_Page page, HPDF_REAL x, HPDF_REAL y, HPDF_REAL radius)
Append circle to current path.
HPDF_STATUS HPDF_Page_ShowText(HPDF_Page page, const char *text)
Put text at the current text position on the page.
HPDF_STATUS HPDF_Page_GRestore(HPDF_Page page)
Restore graphics state which is saved by HPDF_Page_GSave().
HPDF_STATUS HPDF_Page_SetGrayStroke(HPDF_Page page, HPDF_REAL value)
Set stroking color (Gray).
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_STATUS HPDF_Page_TextRect(HPDF_Page page, HPDF_REAL left, HPDF_REAL top, HPDF_REAL right, HPDF_REAL bottom, const char *text, HPDF_TextAlignment align, HPDF_UINT *len)
Put text inside the specified region.
HPDF_Point HPDF_Page_GetCurrentTextPos(HPDF_Page page)
Get current position for text showing.
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.
HPDF_STATUS HPDF_Page_SetTextMatrix(HPDF_Page page, HPDF_REAL a, HPDF_REAL b, HPDF_REAL c, HPDF_REAL d, HPDF_REAL x, HPDF_REAL y)
#define HPDF_PI
Definition: hpdf_consts.h:32
@ HPDF_PAGE_SIZE_A5
ISO 216 "A5" page size (148.0mm x 210.0mm)
Definition: hpdf_page_sizes.h:139
@ HPDF_TALIGN_RIGHT
Definition: hpdf_types.h:605
@ HPDF_TALIGN_LEFT
Definition: hpdf_types.h:604
@ HPDF_TALIGN_CENTER
Definition: hpdf_types.h:606
@ HPDF_TALIGN_JUSTIFY
Definition: hpdf_types.h:607
@ HPDF_PAGE_PORTRAIT
Portrait orientation (longest size vertical)
Definition: hpdf_types.h:575
Definition: hpdf_objects.h:421
Definition: hpdf_doc.h:36
Definition: hpdf_types.h:105
HPDF_REAL y
Definition: hpdf_types.h:107
HPDF_REAL x
Definition: hpdf_types.h:106
Definition: hpdf_types.h:110
HPDF_REAL top
Definition: hpdf_types.h:114
HPDF_REAL right
Definition: hpdf_types.h:113
HPDF_REAL bottom
Definition: hpdf_types.h:112
HPDF_REAL left
Definition: hpdf_types.h:111