Example #1
0
HPDF_Page_Create3DC3DMeasure(HPDF_Page page,
							 HPDF_Point3D    firstanchorpoint,
							 HPDF_Point3D    textanchorpoint)
{
	HPDF_PageAttr attr;
	HPDF_Annotation measure;

	HPDF_PTRACE((" HPDF_Page_Create3DC3DMeasure\n"));

	if (!HPDF_Page_Validate (page))
		return NULL;

	attr = (HPDF_PageAttr)page->attr;

	measure = HPDF_3DC3DMeasure_New(page->mmgr, attr->xref, firstanchorpoint, textanchorpoint);
	if ( !measure)
		HPDF_CheckError (page->error);

	return measure;
}
Example #2
0
HPDF_Page_Create3DView    (HPDF_Page       page,
                           HPDF_U3D        u3d,
                           HPDF_Annotation    annot3d,
                           const char *name)
{
    HPDF_PageAttr attr;
    HPDF_Dict view;

    HPDF_PTRACE((" HPDF_Page_Create3DView\n"));

    if (!HPDF_Page_Validate (page))
        return NULL;

    attr = (HPDF_PageAttr)page->attr;

    view = HPDF_3DView_New( page->mmgr, attr->xref, u3d, name);
    if (!view) {
        HPDF_CheckError (page->error);
    }
    return view;
}
Example #3
0
HPDF_Page_CreatePD33DMeasure(HPDF_Page       page,
							 HPDF_Point3D    annotationPlaneNormal,
							 HPDF_Point3D    firstAnchorPoint,
							 HPDF_Point3D    secondAnchorPoint,
							 HPDF_Point3D    leaderLinesDirection,
							 HPDF_Point3D    measurementValuePoint,
							 HPDF_Point3D    textYDirection,
							 HPDF_REAL       value,
							 const char*     unitsString
							 )
{
	HPDF_PageAttr attr;
	HPDF_Annotation measure;

	HPDF_PTRACE((" HPDF_Page_CreatePD33DMeasure\n"));

	if (!HPDF_Page_Validate (page))
		return NULL;

	attr = (HPDF_PageAttr)page->attr;

	measure = HPDF_PD33DMeasure_New(page->mmgr, 
		attr->xref, 
		annotationPlaneNormal, 
		firstAnchorPoint,
		secondAnchorPoint,
		leaderLinesDirection,
		measurementValuePoint,
		textYDirection,
		value,
		unitsString
		);
	if ( !measure) 
		HPDF_CheckError (page->error);

	return measure;
}
Example #4
0
HPDF_Box
HPDF_Page_GetMediaBox  (HPDF_Page   page)
{
    HPDF_Box media_box = {0, 0, 0, 0};

    HPDF_PTRACE((" HPDF_Page_GetMediaBox\n"));

    if (HPDF_Page_Validate (page)) {
        HPDF_Array array = HPDF_Page_GetInheritableItem (page, "MediaBox",
                        HPDF_OCLASS_ARRAY);

        if (array) {
            HPDF_Real r;

            r = HPDF_Array_GetItem (array, 0, HPDF_OCLASS_REAL);
            if (r)
                media_box.left = r->value;

            r = HPDF_Array_GetItem (array, 1, HPDF_OCLASS_REAL);
            if (r)
                media_box.bottom = r->value;

            r = HPDF_Array_GetItem (array, 2, HPDF_OCLASS_REAL);
            if (r)
                media_box.right = r->value;

            r = HPDF_Array_GetItem (array, 3, HPDF_OCLASS_REAL);
            if (r)
                media_box.top = r->value;

            HPDF_CheckError (page->error);
        } else HPDF_RaiseError (page->error, HPDF_PAGE_CANNOT_FIND_OBJECT, 0);
    }

    return media_box;
}
Example #5
0
HPDF_Page_SetRotate (HPDF_Page      page,
                     HPDF_UINT16    angle)
{
    HPDF_Number n;
    HPDF_STATUS ret = HPDF_OK;

    HPDF_PTRACE((" HPDF_Page_SetRotate\n"));

    if (!HPDF_Page_Validate (page))
        return HPDF_INVALID_PAGE;

    if (angle % 90 != 0)
        return HPDF_RaiseError (page->error, HPDF_PAGE_INVALID_ROTATE_VALUE,
                (HPDF_STATUS)angle);

    n = HPDF_Page_GetInheritableItem (page, "Rotate", HPDF_OCLASS_NUMBER);

    if (!n)
        ret = HPDF_Dict_AddNumber (page, "Rotate", angle);
    else
        n->value = angle;

    return ret;
}