#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "handler.h"
void
float x,
float y,
const char *label)
{
}
void
float x,
float y,
const char *label)
{
}
void
double x,
double y,
const char *label)
{
}
int main (int argc, char **argv)
{
const char* page_title = "Line Example";
char fname[256];
double x;
double y;
double x1;
double y1;
double x2;
double y2;
double x3;
double y3;
float tw;
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;
}
draw_line (page, 60, 770, "line width = 0");
draw_line (page, 60, 740, "line width = 1.0");
draw_line (page, 60, 710, "line width = 2.0");
draw_line (page, 60, 680, "dash_ptn=[3], phase=1 -- "
"2 on, 3 off, 3 on...");
draw_line (page, 60, 650, "dash_ptn=[7, 3], phase=2 -- "
"5 on 3 off, 7 on,...");
draw_line (page, 60, 620, "dash_ptn=[8, 7, 2, 7], phase=0");
draw_line2 (page, 60, 570, "PDF_BUTT_END");
draw_line2 (page, 60, 505, "PDF_ROUND_END");
draw_line2 (page, 60, 440, "PDF_PROJECTING_SCUARE_END");
draw_rect (page, 300, 770, "Stroke");
draw_rect (page, 300, 720, "Fill");
draw_rect (page, 300, 670, "Fill then Stroke");
draw_rect (page, 300, 620, "Clip Rectangle");
"Clip Clip Clip Clip Clip Clipi Clip Clip Clip");
"Clip Clip Clip Clip Clip Clip Clip Clip Clip");
"Clip Clip Clip Clip Clip Clip Clip Clip Clip");
x = 330;
y = 440;
x1 = 430;
y1 = 530;
x2 = 480;
y2 = 470;
x3 = 480;
y3 = 90;
y -= 150;
y1 -= 150;
y2 -= 150;
y -= 150;
y1 -= 160;
y2 -= 130;
x2 += 10;
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_CurveTo2(HPDF_Page page, HPDF_REAL x2, HPDF_REAL y2, HPDF_REAL x3, HPDF_REAL y3)
Append Bézier curve to current path using current point and (x2, y2) and (x3, y3) as control points....
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_MoveTo(HPDF_Page page, HPDF_REAL x, HPDF_REAL y)
Start new subpath and move current point for drawing path.
HPDF_STATUS HPDF_Page_ShowTextNextLine(HPDF_Page page, const char *text)
Move current text position to the start of the next line, then put the text at the current text posit...
HPDF_STATUS HPDF_Page_SetRGBFill(HPDF_Page page, HPDF_REAL r, HPDF_REAL g, HPDF_REAL b)
Set filling color (RGB).
HPDF_STATUS HPDF_Page_CurveTo3(HPDF_Page page, HPDF_REAL x1, HPDF_REAL y1, HPDF_REAL x3, HPDF_REAL y3)
Append Bézier curve to the current path using two spesified points. The point (x1,...
HPDF_STATUS HPDF_Page_SetTextLeading(HPDF_Page page, HPDF_REAL value)
Set text leading (line spacing).
HPDF_STATUS HPDF_Page_SetLineCap(HPDF_Page page, HPDF_LineCap line_cap)
Set lines endpoints shape style.
HPDF_STATUS HPDF_Page_GSave(HPDF_Page page)
Save the page's current graphics state to the stack.
HPDF_STATUS HPDF_Page_FillStroke(HPDF_Page page)
Fill current path using the even-odd rule.
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_CurveTo(HPDF_Page page, HPDF_REAL x1, HPDF_REAL y1, HPDF_REAL x2, HPDF_REAL y2, HPDF_REAL x3, HPDF_REAL y3)
Append Bézier curve to current path using control points (x1, y1) and (x2, y2) and (x3,...
HPDF_STATUS HPDF_Page_Clip(HPDF_Page page)
Modify current clipping path by intersecting it with current path using the nonzero winding number ru...
HPDF_STATUS HPDF_Page_SetLineJoin(HPDF_Page page, HPDF_LineJoin line_join)
Set line join shape style.
HPDF_STATUS HPDF_Page_Fill(HPDF_Page page)
Fill current path using non-zero winding number rule.
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_LineTo(HPDF_Page page, HPDF_REAL x, HPDF_REAL y)
Append path from current point to specified point.
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_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_MoveTextPos(HPDF_Page page, HPDF_REAL x, HPDF_REAL y)
Change current text position using the specified offset values.
HPDF_REAL HPDF_Page_TextWidth(HPDF_Page page, const char *text)
Get text width in current font size, character spacing and word spacing.
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_REAL HPDF_Page_GetWidth(HPDF_Page page)
Get page width.
@ HPDF_PROJECTING_SQUARE_END
Definition: hpdf_types.h:309
@ HPDF_BUTT_END
Definition: hpdf_types.h:307
@ HPDF_ROUND_END
Definition: hpdf_types.h:308
@ HPDF_BEVEL_JOIN
Definition: hpdf_types.h:319
@ HPDF_MITER_JOIN
Definition: hpdf_types.h:317
@ HPDF_ROUND_JOIN
Definition: hpdf_types.h:318
float HPDF_REAL
Definition: hpdf_types.h:79
Definition: hpdf_objects.h:421
Definition: hpdf_doc.h:36