2.1.13.6 export_page_to_image


Description

Export a page to an image using current ini settings or prompt user with export options


Export a page to an image using the specified settings

Syntax

bool export_page_to_image( Page & pg, LPCSTR lpcszFileName, LPCSTR lpcszFormat, BOOL bShowOptions = FALSE )


bool export_page_to_image( LPCSTR lpcszFileName, LPCSTR lpcszFormat, Page & pg, int nWidth, int nHeight, int nBitsPerPixel, int nCompression = 0, bool bGrayScale = false )

Parameters

pg
[input] the page to export
lpcszFileName
[input] the target file name
lpcszFormat
[input] exported format
bShowOptions
[input] TRUE to show the export options dialog, FALSE to use current settings


lpcszFileName
[input] exported image name
lpcszFormat
[input]target image format
pg
[input] source page
nWidth
[input] target image width in pixels. If nHeight parameter is zero then nWidth specifies dots per inch.
nHeight
[input] target image height in pixels. If zero then nWidth specifies dots per inch.
nBitsPerPixel
[input] target image bits per pixel
nCompression
[input] target image compression level. This parameter is ignored by some image formats.
bGrayScale
[input]target image gray scale.

Return

Returns 0 for success, non-zero for error.


Returns TRUE for success, FALSE for failure.

Examples

EX1

int export_page_to_image_ex1()
{
    GraphPage        gp;
    gp.Create();
    if( !gp)
    {
        return 1;
    }
        
    bool bRet=export_page_to_image( gp, "c:\\test.bmp", "bmp", false);
    if( bRet)
        printf("export succeed!");
    else
        printf("export fail!");
    return 0;
}


EX2

void export_page_to_image_ex2()
{
    GraphPage gp;
    gp.Create();
    if( !gp )
    {
        return;
    }
    
    string     strImagePath("C:\\Test.bmp");
    int nRet = export_page_to_image(strImagePath, "bmp", gp, 1024, 768, 8, 0, false);
}

Remark

See Also

Header to Include

origin.h

Reference