#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <setjmp.h>
#include "handler.h"
#include "utils.h"
#ifdef LIBHPDF_HAVE_LIBPNG
void
float x,
float y,
const char *text)
{
char buf[255];
HPDF_snprintf(buf, 255, "(x=%d,y=%d)", (int)x, (int)y);
y - 10);
}
int main (int argc, char **argv)
{
char fname[256];
double x;
double y;
double angle;
double angle1;
double angle2;
double rad;
double rad1;
double rad2;
double iw;
double ih;
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;
}
#ifndef __WIN32__
#else
#endif
#ifndef __WIN32__
#else
#endif
#ifndef __WIN32__
#else
#endif
#ifndef __WIN32__
#else
#endif
x = 100;
show_description (page, x, y, "Actual Size");
x += 150;
show_description (page, x, y, "Scalling image (X direction)");
x += 150;
show_description (page, x, y, "Scalling image (Y direction)");
x = 100;
y -= 120;
angle1 = 10;
angle2 = 20;
show_description (page, x, y, "Skewing image");
x += 150;
angle = 30;
iw * sin(rad),
ih * -sin(rad),
ih * cos(rad),
x, y);
show_description (page, x, y, "Rotating image");
x += 150;
show_description (page, x, y, "masked image");
x = 100;
y -= 120;
show_description (page, x, y, "Color Mask");
return 0;
}
#else
int main()
{
printf("WARNING: image_demo was not built correctly. \n"
"Make sure libpng is installed and CMake is able to find it.\n");
return 0;
}
#endif
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_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_SetRGBFill(HPDF_Page page, HPDF_REAL r, HPDF_REAL g, HPDF_REAL b)
Set filling color (RGB).
HPDF_STATUS HPDF_Page_DrawImage(HPDF_Page page, HPDF_Image image, HPDF_REAL x, HPDF_REAL y, HPDF_REAL width, HPDF_REAL height)
Show an image in one operation.
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_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_ExecuteXObject(HPDF_Page page, HPDF_XObject obj)
Draw XObject using current graphics context.
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_STATUS HPDF_Image_SetColorMask(HPDF_Image image, HPDF_UINT rmin, HPDF_UINT rmax, HPDF_UINT gmin, HPDF_UINT gmax, HPDF_UINT bmin, HPDF_UINT bmax)
Sets transparent color of the image by the RGB range values.
HPDF_STATUS HPDF_Image_SetMaskImage(HPDF_Image image, HPDF_Image mask_image)
Set image mask.
HPDF_UINT HPDF_Image_GetWidth(HPDF_Image image)
Get image width of an image object.
HPDF_Image HPDF_LoadPngImageFromFile(HPDF_Doc pdf, const char *filename)
Load external PNG image file.
HPDF_UINT HPDF_Image_GetHeight(HPDF_Image image)
Get image height of an image object.
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_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_STATUS HPDF_SetOpenAction(HPDF_Doc pdf, HPDF_Destination open_action)
Set the first page to appear when a document is opened.
HPDF_Page HPDF_AddPage(HPDF_Doc pdf)
Create new page and add it after the last page of document.
HPDF_Font HPDF_Page_GetCurrentFont(HPDF_Page page)
Get page current font handle.
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_PI
Definition: hpdf_consts.h:32
Definition: hpdf_objects.h:333
Definition: hpdf_objects.h:421
Definition: hpdf_doc.h:36