#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <setjmp.h>
#include "handler.h"
#include "utils.h"
static const int PAGE_WIDTH = 420;
static const int PAGE_HEIGHT = 400;
static const int CELL_WIDTH = 20;
static const int CELL_HEIGHT = 20;
void
void
void
{
char buf[50];
int i;
for (i = 0; i <= 17; i++) {
int x = i * CELL_WIDTH + 40;
if (i > 0 && i <= 16) {
HPDF_snprintf(buf, 5, "%X", i - 1);
}
}
for (i = 0; i <= 15; i++) {
int y = i * CELL_HEIGHT + 40;
if (i < 14) {
HPDF_snprintf(buf, 5, "%X", 15 - i);
}
}
}
void
{
int i;
int j;
for (i = 1; i < 17; i++) {
for (j = 1; j < 17; j++) {
unsigned char buf[2];
int y = PAGE_HEIGHT - 55 - ((i - 1) * CELL_HEIGHT);
int x = j * CELL_WIDTH + 50;
buf[1] = 0x00;
buf[0] = (i - 1) * 16 + (j - 1);
if (buf[0] >= 32) {
double d;
}
}
}
}
int main (int argc, char **argv)
{
char fname[256];
const char *font_name;
int i = 0;
const char *encodings[] = {
"StandardEncoding",
"MacRomanEncoding",
"WinAnsiEncoding",
"ISO8859-2",
"ISO8859-3",
"ISO8859-4",
"ISO8859-5",
"ISO8859-9",
"ISO8859-10",
"ISO8859-13",
"ISO8859-14",
"ISO8859-15",
"ISO8859-16",
"CP1250",
"CP1251",
"CP1252",
"CP1254",
"CP1257",
"KOI8-R",
"Symbol-Set",
"ZapfDingbats-Set",
NULL
};
pdf =
HPDF_NewEx (demo_error_handler, NULL, NULL, 0, NULL);
if (!pdf) {
printf ("error: cannot create PdfDoc object\n");
return 1;
}
if (setjmp(env)) {
return 1;
}
strcpy (fname, argv[0]);
strcat (fname, ".pdf");
#ifdef __WIN32__
"type1\\a010013l.pfb");
#else
"type1/a010013l.pfb");
#endif
while (encodings[i]) {
draw_graph (page);
if (strcmp (encodings[i], "Symbol-Set") == 0)
else if (strcmp (encodings[i], "ZapfDingbats-Set") == 0)
else
draw_fonts (page);
i++;
}
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_NewEx(HPDF_Error_Handler user_error_fn, HPDF_Alloc_Func user_alloc_fn, HPDF_Free_Func user_free_fn, HPDF_UINT mem_pool_buf_size, 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.
const char * HPDF_LoadType1FontFromFile(HPDF_Doc pdf, const char *afm_filename, const char *data_filename)
Load Type1 font from external file and register it in the document object.
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_Stroke(HPDF_Page page)
Paint current path.
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_TextOut(HPDF_Page page, HPDF_REAL xpos, HPDF_REAL ypos, const char *text)
Put text to the specified position.
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_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_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_STATUS HPDF_Destination_SetXYZ(HPDF_Destination dst, HPDF_REAL left, HPDF_REAL top, HPDF_REAL zoom)
Define page appearance with three parameters which are left, top and zoom.
HPDF_Destination HPDF_Page_CreateDestination(HPDF_Page page)
Create new destination object for the page.
HPDF_Outline HPDF_CreateOutline(HPDF_Doc pdf, HPDF_Outline parent, const char *title, HPDF_Encoder encoder)
Create new outline object.
HPDF_STATUS HPDF_Outline_SetOpened(HPDF_Outline outline, HPDF_BOOL opened)
Set whether this outline node is opened when the outline is displayed for the first time.
HPDF_STATUS HPDF_Outline_SetDestination(HPDF_Outline outline, HPDF_Destination dst)
Set target destination object to jump to when outline object is clicked.
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_STATUS HPDF_SetPageMode(HPDF_Doc pdf, HPDF_PageMode mode)
Set document display mode.
HPDF_STATUS HPDF_Page_SetWidth(HPDF_Page page, HPDF_REAL value)
Change page width.
HPDF_STATUS HPDF_Page_SetHeight(HPDF_Page page, HPDF_REAL value)
Change page height.
HPDF_STATUS HPDF_SetCompressionMode(HPDF_Doc pdf, HPDF_UINT mode)
Set compression mode.
#define HPDF_COMP_ALL
Definition: hpdf_consts.h:82
#define HPDF_TRUE
Definition: hpdf_consts.h:26
@ HPDF_PAGE_MODE_USE_OUTLINE
Definition: hpdf_types.h:362
Definition: hpdf_objects.h:333
Definition: hpdf_objects.h:421
Definition: hpdf_doc.h:36