#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <setjmp.h>
#include "grid_sheet.h"
#include "handler.h"
#include "utils.h"
int
main (int argc, char **argv)
{
char fname[256];
char buf[1024];
FILE *cp932;
FILE *cp936;
const char *fcp936_name;
const char *fcp932_name;
if (argc < 4) {
printf ("chfont_demo <cp936-ttc-font-file-name> "
"<cp936-index> <cp932-ttc-font-file-name> <cp932-index>\n");
return 1;
}
strcpy (fname, "mbtext");
strcat (fname, FILE_SEPARATOR);
strcat (fname, "cp932.txt");
cp932 = fopen (fname, "rb");
if (!cp932) {
printf ("error: cannot open cp932.txt\n");
return 1;
}
strcpy (fname, "mbtext");
strcat (fname, FILE_SEPARATOR);
strcat (fname, "cp936.txt");
cp936 = fopen (fname, "rb");
if (!cp936) {
printf ("error: cannot open cp936.txt\n");
return 1;
}
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);
while (fgets (buf, 1024, cp936)) {
buf [strlen (buf)] = 0;
if (fgets (buf, 1024, cp932)) {
buf [strlen (buf)] = 0;
}
}
fclose (cp936);
fclose (cp932);
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_STATUS HPDF_UseCNSEncodings(HPDF_Doc pdf)
Enable simplified Chinese encodings.
HPDF_STATUS HPDF_UseJPEncodings(HPDF_Doc pdf)
Enable Japanese encodings.
HPDF_Font HPDF_GetFont(HPDF_Doc pdf, const char *font_name, const char *encoding_name)
Get requested font object handle.
const char * HPDF_LoadTTFontFromFile2(HPDF_Doc pdf, const char *filename, HPDF_UINT index, HPDF_BOOL embedding)
Load TrueType font from TrueType collection file *.ttc and register it in the document object.
HPDF_STATUS HPDF_Page_SetTextLeading(HPDF_Page page, HPDF_REAL value)
Set text leading (line spacing).
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_MoveToNextLine(HPDF_Page page)
Move current position for text showing depending on current text showing point and text leading.
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_MoveTextPos(HPDF_Page page, HPDF_REAL x, HPDF_REAL y)
Change current text position using the specified offset values.
HPDF_Page HPDF_AddPage(HPDF_Doc pdf)
Create new page and add it after the last page of document.
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
Definition: hpdf_objects.h:421
Definition: hpdf_doc.h:36