当前位置: 首页>>代码示例>>C++>>正文


C++ HPDF_RaiseError函数代码示例

本文整理汇总了C++中HPDF_RaiseError函数的典型用法代码示例。如果您正苦于以下问题:C++ HPDF_RaiseError函数的具体用法?C++ HPDF_RaiseError怎么用?C++ HPDF_RaiseError使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了HPDF_RaiseError函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: HPDF_ReadFromStream

HPDF_ReadFromStream  (HPDF_Doc       pdf,
                      HPDF_BYTE     *buf,
                      HPDF_UINT32   *size)
{
    HPDF_UINT isize = *size;
    HPDF_STATUS ret;

    if (!HPDF_HasDoc (pdf))
        return HPDF_INVALID_DOCUMENT;

    if (!HPDF_Stream_Validate (pdf->stream))
        return HPDF_RaiseError (&pdf->error, HPDF_INVALID_OPERATION, 0);

    if (*size == 0)
        return HPDF_RaiseError (&pdf->error, HPDF_INVALID_PARAMETER, 0);

    ret = HPDF_Stream_Read (pdf->stream, buf, &isize);

    *size = isize;

    if (ret != HPDF_OK)
        HPDF_CheckError (&pdf->error);

    return ret;
}
开发者ID:GaryShearer,项目名称:BasicOCR,代码行数:25,代码来源:hpdf_doc.c

示例2: HPDF_SetPagesConfiguration

HPDF_SetPagesConfiguration  (HPDF_Doc    pdf,
                             HPDF_UINT   page_per_pages)
{
    HPDF_PTRACE ((" HPDF_SetPagesConfiguration\n"));

    if (!HPDF_HasDoc (pdf))
        return HPDF_INVALID_DOCUMENT;

    if (pdf->cur_page)
        return HPDF_RaiseError (&pdf->error, HPDF_INVALID_DOCUMENT_STATE, 0);

    if (page_per_pages > HPDF_LIMIT_MAX_ARRAY)
        return HPDF_RaiseError (&pdf->error, HPDF_INVALID_PARAMETER, 0);

    if (pdf->cur_pages == pdf->root_pages) {
        pdf->cur_pages = HPDF_Doc_AddPagesTo (pdf, pdf->root_pages);
        if (!pdf->cur_pages)
            return pdf->error.error_no;
        pdf->cur_page_num = 0;
    }

    pdf->page_per_pages = page_per_pages;

    return HPDF_OK;
}
开发者ID:GaryShearer,项目名称:BasicOCR,代码行数:25,代码来源:hpdf_doc.c

示例3: HPDF_Font_MeasureText

HPDF_Font_MeasureText (HPDF_Font          font,
                       const HPDF_BYTE   *text,
                       HPDF_UINT          len,
                       HPDF_REAL          width,
                       HPDF_REAL          font_size,
                       HPDF_REAL          char_space,
                       HPDF_REAL          word_space,
                       HPDF_BOOL          wordwrap,
                       HPDF_REAL         *real_width)
{
    HPDF_FontAttr attr;

    HPDF_PTRACE ((" HPDF_Font_MeasureText\n"));

    if (!HPDF_Font_Validate(font))
        return 0;

    if (len > HPDF_LIMIT_MAX_STRING_LEN) {
        HPDF_RaiseError (font->error, HPDF_STRING_OUT_OF_RANGE, 0);
        return 0;
    }

    attr = (HPDF_FontAttr)font->attr;

    if (!attr->measure_text_fn) {
        HPDF_RaiseError (font->error, HPDF_INVALID_OBJECT, 0);
        return 0;
    }

    return attr->measure_text_fn (font, text, len, width, font_size,
                            char_space, word_space, wordwrap, real_width);
}
开发者ID:xharbour,项目名称:core,代码行数:32,代码来源:hpdf_font.c

示例4: HPDF_Doc_AddPagesTo

HPDF_Pages
HPDF_Doc_AddPagesTo  (HPDF_Doc     pdf,
                      HPDF_Pages   parent)
{
    HPDF_Pages pages;

    HPDF_PTRACE ((" HPDF_AddPagesTo\n"));

    if (!HPDF_HasDoc (pdf))
        return NULL;

    if (!HPDF_Pages_Validate (parent)) {
        HPDF_RaiseError (&pdf->error, HPDF_INVALID_PAGES, 0);
        return NULL;
    }

    /* check whether the page belong to the pdf */
    if (pdf->mmgr != parent->mmgr) {
        HPDF_RaiseError (&pdf->error, HPDF_INVALID_PAGES, 0);
        return NULL;
    }

    pages = HPDF_Pages_New (pdf->mmgr, parent, pdf->xref);
    if (pages)
        pdf->cur_pages = pages;
    else
        HPDF_CheckError (&pdf->error);


    return  pages;
}
开发者ID:GaryShearer,项目名称:BasicOCR,代码行数:31,代码来源:hpdf_doc.c

示例5: HPDF_Page_MeasureText

HPDF_Page_MeasureText  (HPDF_Page          page,
                        const char        *text,
                        HPDF_REAL          width,
                        HPDF_BOOL          wordwrap,
                        HPDF_REAL         *real_width)
{
    HPDF_PageAttr attr;
    HPDF_UINT len = HPDF_StrLen(text, HPDF_LIMIT_MAX_STRING_LEN + 1);
    HPDF_UINT ret;

    if (!HPDF_Page_Validate (page) || len == 0)
        return 0;

    attr = (HPDF_PageAttr )page->attr;

    HPDF_PTRACE((" HPDF_Page_MeasureText\n"));

    /* no font exists */
    if (!attr->gstate->font) {
        HPDF_RaiseError (page->error, HPDF_PAGE_FONT_NOT_FOUND, 0);
        return 0;
    }

    ret = HPDF_Font_MeasureText (attr->gstate->font, (HPDF_BYTE *)text, len, width,
        attr->gstate->font_size, attr->gstate->char_space,
        attr->gstate->word_space, wordwrap, real_width);

    HPDF_CheckError (page->error);

    return ret;
}
开发者ID:porchdog,项目名称:libharu,代码行数:31,代码来源:hpdf_pages.c

示例6: HPDF_GetEncoder

HPDF_GetEncoder  (HPDF_Doc         pdf,
                  const char  *encoding_name)
{
    HPDF_Encoder encoder;
    HPDF_STATUS ret;

    HPDF_PTRACE ((" HPDF_GetEncoder\n"));

    if (!HPDF_HasDoc (pdf))
        return NULL;

    encoder = HPDF_Doc_FindEncoder (pdf, encoding_name);

    if (!encoder) {
        encoder = HPDF_BasicEncoder_New (pdf->mmgr, encoding_name);

        if (!encoder) {
            HPDF_CheckError (&pdf->error);
            return NULL;
        }

        if ((ret = HPDF_List_Add (pdf->encoder_list, encoder)) != HPDF_OK) {
            HPDF_Encoder_Free (encoder);
            HPDF_RaiseError (&pdf->error, ret, 0);
            return NULL;
        }
    }

    return encoder;
}
开发者ID:GaryShearer,项目名称:BasicOCR,代码行数:30,代码来源:hpdf_doc.c

示例7: HPDF_AddPageLabel

HPDF_AddPageLabel  (HPDF_Doc             pdf,
                    HPDF_UINT            page_num,
                    HPDF_PageNumStyle    style,
                    HPDF_UINT            first_page,
                    const char     *prefix)
{
    HPDF_Dict page_label;
    HPDF_STATUS ret;

    HPDF_PTRACE ((" HPDF_AddPageLabel\n"));

    if (!HPDF_HasDoc (pdf))
        return HPDF_INVALID_DOCUMENT;

    page_label = HPDF_PageLabel_New (pdf, style, first_page, prefix);

    if (!page_label)
        return HPDF_CheckError (&pdf->error);

    if (style < 0 || style >= HPDF_PAGE_NUM_STYLE_EOF)
        return HPDF_RaiseError (&pdf->error, HPDF_PAGE_NUM_STYLE_OUT_OF_RANGE,
                    (HPDF_STATUS)style);

    ret = HPDF_Catalog_AddPageLabel (pdf->catalog, page_num, page_label);
    if (ret != HPDF_OK)
        return HPDF_CheckError (&pdf->error);

    return HPDF_OK;
}
开发者ID:GaryShearer,项目名称:BasicOCR,代码行数:29,代码来源:hpdf_doc.c

示例8: HPDF_GetFontDef

HPDF_FontDef
HPDF_GetFontDef  (HPDF_Doc          pdf,
                  const char  *font_name)
{
    HPDF_STATUS ret;
    HPDF_FontDef def;

    HPDF_PTRACE ((" HPDF_GetFontDef\n"));

    if (!HPDF_HasDoc (pdf))
        return NULL;

    def = HPDF_Doc_FindFontDef (pdf, font_name);

    if (!def) {
        def = HPDF_Base14FontDef_New (pdf->mmgr, font_name);

        if (!def)
            return NULL;

        if ((ret = HPDF_List_Add (pdf->fontdef_list, def)) != HPDF_OK) {
            HPDF_FontDef_Free (def);
            HPDF_RaiseError (&pdf->error, ret, 0);
            def = NULL;
        }
    }

    return def;
}
开发者ID:GaryShearer,项目名称:BasicOCR,代码行数:29,代码来源:hpdf_doc.c

示例9: HPDF_Destination_SetXYZ

HPDF_Destination_SetXYZ  (HPDF_Destination  dst,
                          HPDF_REAL         left,
                          HPDF_REAL         top,
                          HPDF_REAL         zoom)
{
    HPDF_STATUS ret = HPDF_OK;
    HPDF_Page target;

    HPDF_PTRACE((" HPDF_Destination_SetXYZ\n"));

    if (!HPDF_Destination_Validate (dst))
        return HPDF_INVALID_DESTINATION;

    if (left < 0 || top < 0 || zoom < 0.08 || zoom > 32)
        return HPDF_RaiseError (dst->error, HPDF_INVALID_PARAMETER, 0);


    target = (HPDF_Page)HPDF_Array_GetItem (dst, 0, HPDF_OCLASS_DICT);

    if (dst->list->count > 1) {
        HPDF_Array_Clear (dst);
        ret += HPDF_Array_Add (dst, target);
    }

    ret += HPDF_Array_AddName (dst,
                HPDF_DESTINATION_TYPE_NAMES[(HPDF_INT)HPDF_XYZ]);
    ret += HPDF_Array_AddReal (dst, left);
    ret += HPDF_Array_AddReal (dst, top);
    ret += HPDF_Array_AddReal (dst, zoom);

    if (ret != HPDF_OK)
        return HPDF_CheckError (dst->error);

    return HPDF_OK;
}
开发者ID:Allamaprabhu7,项目名称:APPDfTest,代码行数:35,代码来源:hpdf_destination.c

示例10: HPDF_Page_SetSize

HPDF_Page_SetSize  (HPDF_Page             page,
                    HPDF_PageSizes        size,
                    HPDF_PageDirection    direction)
{
    HPDF_STATUS ret = HPDF_OK;

    HPDF_PTRACE((" HPDF_Page_SetSize\n"));

    if (!HPDF_Page_Validate (page))
        return HPDF_INVALID_PAGE;

    if ((int)size < 0 || size > HPDF_PAGE_SIZE_EOF)   //CAL:Supress "comparison of unsigned expression < 0 is always false" warning
        return HPDF_RaiseError (page->error, HPDF_PAGE_INVALID_SIZE,
                (HPDF_STATUS)direction);

    if (direction == HPDF_PAGE_LANDSCAPE) {
        ret += HPDF_Page_SetHeight (page,
            HPDF_PREDEFINED_PAGE_SIZES[(HPDF_UINT)size].x);
        ret += HPDF_Page_SetWidth (page,
            HPDF_PREDEFINED_PAGE_SIZES[(HPDF_UINT)size].y);
    } else if (direction == HPDF_PAGE_PORTRAIT) {
        ret += HPDF_Page_SetHeight (page,
            HPDF_PREDEFINED_PAGE_SIZES[(HPDF_UINT)size].y);
        ret += HPDF_Page_SetWidth (page,
            HPDF_PREDEFINED_PAGE_SIZES[(HPDF_UINT)size].x);
    } else
        ret = HPDF_SetError (page->error, HPDF_PAGE_INVALID_DIRECTION,
                (HPDF_STATUS)direction);

    if (ret != HPDF_OK)
        return HPDF_CheckError (page->error);

    return HPDF_OK;
}
开发者ID:ykliao,项目名称:jalbumeasy,代码行数:34,代码来源:hpdf_pages.c

示例11: HPDF_Page_SetSize

HPDF_Page_SetSize  (HPDF_Page             page,
                    HPDF_PageSizes        size,
                    HPDF_PageDirection    direction)
{
    HPDF_STATUS ret = HPDF_OK;

    HPDF_PTRACE((" HPDF_Page_SetSize\n"));

    if (!HPDF_Page_Validate (page))
        return HPDF_INVALID_PAGE;

    if (size < 0 || size > HPDF_PAGE_SIZE_EOF)
        return HPDF_RaiseError (page->error, HPDF_PAGE_INVALID_SIZE,
                (HPDF_STATUS)direction);

    if (direction == HPDF_PAGE_LANDSCAPE) {
        ret += HPDF_Page_SetHeight (page,
            HPDF_PREDEFINED_PAGE_SIZES[(HPDF_UINT)size].x);
        ret += HPDF_Page_SetWidth (page,
            HPDF_PREDEFINED_PAGE_SIZES[(HPDF_UINT)size].y);
    } else if (direction == HPDF_PAGE_PORTRAIT) {
        ret += HPDF_Page_SetHeight (page,
            HPDF_PREDEFINED_PAGE_SIZES[(HPDF_UINT)size].y);
        ret += HPDF_Page_SetWidth (page,
            HPDF_PREDEFINED_PAGE_SIZES[(HPDF_UINT)size].x);
    } else
        ret = HPDF_SetError (page->error, HPDF_PAGE_INVALID_DIRECTION,
                (HPDF_STATUS)direction);

    if (ret != HPDF_OK)
        return HPDF_CheckError (page->error);

    return HPDF_OK;
}
开发者ID:porchdog,项目名称:libharu,代码行数:34,代码来源:hpdf_pages.c

示例12: HPDF_Page_CreateTextMarkupAnnot

HPDF_Annotation
HPDF_Page_CreateTextMarkupAnnot (HPDF_Page     page,
                                HPDF_Rect      rect,
                                const char     *text,
                                HPDF_Encoder   encoder,
                                HPDF_AnnotType subType)
{
    HPDF_PageAttr attr;
    HPDF_Annotation annot;

    HPDF_PTRACE((" HPDF_Page_CreateTextMarkupAnnot\n"));

    if (!HPDF_Page_Validate (page))
        return NULL;

    attr = (HPDF_PageAttr)page->attr;

    if (encoder && !HPDF_Encoder_Validate (encoder)) {
        HPDF_RaiseError (page->error, HPDF_INVALID_ENCODER, 0);
        return NULL;
    }

    annot = HPDF_MarkupAnnot_New ( page->mmgr, attr->xref, rect, text, encoder, subType);
    if (annot) {
        if (AddAnnotation (page, annot) != HPDF_OK) {
            HPDF_CheckError (page->error);
            annot = NULL;
        }
    } else
        HPDF_CheckError (page->error);

    return annot;
}
开发者ID:porchdog,项目名称:libharu,代码行数:33,代码来源:hpdf_pages.c

示例13: HPDF_Page_CreateURILinkAnnot

HPDF_Page_CreateURILinkAnnot  (HPDF_Page          page,
                               HPDF_Rect          rect,
                               const char   *uri)
{
    HPDF_PageAttr attr;
    HPDF_Annotation annot;

    HPDF_PTRACE((" HPDF_Page_CreateURILinkAnnot\n"));

    if (!HPDF_Page_Validate (page))
        return NULL;

    attr = (HPDF_PageAttr)page->attr;

    if (HPDF_StrLen (uri, HPDF_LIMIT_MAX_STRING_LEN) <= 0) {
        HPDF_RaiseError (page->error, HPDF_INVALID_URI, 0);
        return NULL;
    }

    annot = HPDF_URILinkAnnot_New (page->mmgr, attr->xref, rect, uri);
    if (annot) {
        if (AddAnnotation (page, annot) != HPDF_OK) {
            HPDF_CheckError (page->error);
            annot = NULL;
        }
    } else
        HPDF_CheckError (page->error);

    return annot;
}
开发者ID:porchdog,项目名称:libharu,代码行数:30,代码来源:hpdf_pages.c

示例14: HPDF_Font_TextWidth

HPDF_Font_TextWidth  (HPDF_Font        font,
                      const HPDF_BYTE  *text,
                      HPDF_UINT        len)
{
    HPDF_TextWidth tw = {0, 0, 0, 0};
    HPDF_FontAttr attr;

    HPDF_PTRACE ((" HPDF_Font_TextWidth\n"));

    if (!HPDF_Font_Validate(font))
        return tw;

    if (len > HPDF_LIMIT_MAX_STRING_LEN) {
        HPDF_RaiseError (font->error, HPDF_STRING_OUT_OF_RANGE, 0);
        return tw;
    }

    attr = (HPDF_FontAttr)font->attr;

    if (!attr->text_width_fn) {
        HPDF_SetError (font->error, HPDF_INVALID_OBJECT, 0);
        return tw;
    }

    tw = attr->text_width_fn (font, text, len);

    return tw;
}
开发者ID:xharbour,项目名称:core,代码行数:28,代码来源:hpdf_font.c

示例15: HPDF_Image_LoadJpegImageFromMem

HPDF_Image
HPDF_Image_LoadJpegImageFromMem  (HPDF_MMgr    mmgr,
                            const HPDF_BYTE   *buf,
                                  HPDF_UINT    size,
                                  HPDF_Xref    xref)
{
	HPDF_Stream jpeg_data;
	HPDF_Image image;

	HPDF_PTRACE ((" HPDF_Image_LoadJpegImageFromMem\n"));

	jpeg_data = HPDF_MemStream_New(mmgr,size);
	if (!HPDF_Stream_Validate (jpeg_data)) {
		HPDF_RaiseError (mmgr->error, HPDF_INVALID_STREAM, 0);
		return NULL;
	}

	if (HPDF_Stream_Write (jpeg_data, buf, size) != HPDF_OK) {
		HPDF_Stream_Free (jpeg_data);
		return NULL;
	}

	image = HPDF_Image_LoadJpegImage(mmgr,jpeg_data,xref);

	/* destroy file stream */
	HPDF_Stream_Free (jpeg_data);

	return image;
}
开发者ID:AKKF,项目名称:libharu,代码行数:29,代码来源:hpdf_image.c


注:本文中的HPDF_RaiseError函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。