IGR_Make_Output_Canvas¶
IGR_Make_Output_Canvas creates a new canvas that is used for rendering page content. The output data will be written to the file specified in Filename. To write to memory or stream, see IGR_Make_Output_Canvas_On.
Prototype¶
IGR_LONG IGR_Make_Output_Canvas(
IGR_LONG Type,
const IGR_UCS2* Filename,
const IGR_UCS2* Options,
HCANVAS* CanvasHandle,
Error_Control_Block* error);
Parameters¶
Type: IGR_LONG
Indicates the type of canvas object to create, can be one of the following:
Name | Value | Description |
---|---|---|
IGR_DEVICE_HTML | 6 | Create a single or multipage HTML5 |
IGR_DEVICE_IMAGE_BMP | 4 | Create a single BMP per page |
IGR_DEVICE_IMAGE_BRK | 17 | Create a single or multipage Brooktrout FAX |
IGR_DEVICE_IMAGE_DCX | 19 | Create a single or multipage DCX |
IGR_DEVICE_IMAGE_EPS | 13 | Create a single EPS (Encapsulated PostScript) per page |
IGR_DEVICE_IMAGE_GIF | 21 | Create a single GIF per page |
IGR_DEVICE_IMAGE_JPEG2000 | 20 | Create a single JPEG2000 per page |
IGR_DEVICE_IMAGE_JPG | 1 | Create a single JPG per page |
IGR_DEVICE_IMAGE_PBM | 7 | Create a single PBM per page |
IGR_DEVICE_IMAGE_PCX | 18 | Create a single PCX per page |
IGR_DEVICE_IMAGE_PDF | 2 | Create a single or multipage PDF |
IGR_DEVICE_IMAGE_PGM | 8 | Create a single PGM per page |
IGR_DEVICE_IMAGE_PNG | 0 | Create a single PNG per page |
IGR_DEVICE_IMAGE_PPM | 9 | Create a single PPM per page |
IGR_DEVICE_IMAGE_PS | 14 | Create a single or multipage PostScript |
IGR_DEVICE_IMAGE_SVG | 12 | Create a single SVG per page |
IGR_DEVICE_IMAGE_TGA | 16 | Create a single TGA per page |
IGR_DEVICE_IMAGE_TIF | 3 | Create a single or multipage TIF |
IGR_DEVICE_IMAGE_WEBP | 10 | Create a single WEBP per page |
IGR_DEVICE_IMAGE_WEBSAFE | 15 | Create a single image per page, where the format is determined based on the palette and number of colors. |
IGR_DEVICE_IMAGE_XPS | 11 | Create a single or multipage XPS |
IGR_DEVICE_JSON | 22 | Create a single or multipage structured JSON |
IGR_DEVICE_PDF | 2 | Create a single or multipage PDF (Alias for IGR_DEVICE_IMAGE_PDF) |
IGR_DEVICE_XML | 5 | Create a single or multipage structured XML |
Filename: Unicode string (UCS2)
Destination filename where the output is written.
CanvasHandle: Pointer to HCANVAS
Returns a handle to be used in subsequent canvas calls.
Error: Pointer to Error_Control_Block
Returns error details if the call fails.
Return value¶
Success: IGR_LONG
Returns IGR_OK.
Failure: IGR_LONG
Returns one of the possible IGR_E error codes.
Sample code¶
Error_Control_Block ISYSError;
IGR_LONG Capabilities, DocType, DocHandle, PageCount;
HPAGE PageHandle;
IGR_LONG RC = IGR_Open_Stream(pStream, IGR_FORMAT_IMAGE, &Capabilities, &DocType, &DocHandle, &ISYSError);
if (RC == IGR_OK)
{
if (IGR_Get_Page_Count(DocHandle, &PageCount, &ISYSError) == IGR_OK)
{
for (IGR_LONG PageIndex = 0; PageIndex < PageCount; PageIndex++)
{
if (IGR_Open_Page(DocHandle, PageIndex, &PageHandle, &ISYSError) == IGR_OK)
{
HCANVAS CanvasHandle;
if (IGR_Make_Output_Canvas(IGR_DEVICE_IMAGE_PNG, L"page.png",
&CanvasHandle, &ISYSError) == IGR_OK)
{
IGR_Render_Page(PageHandle, CanvasHandle, &ISYSError);
IGR_Close_Canvas(CanvasHandle, &ISYSError);
}
IGR_Close_Page(PageHandle, &ISYSError);
}
}
}
IGR_Close_File(DocHandle, &ISYSError);
}
Additional information¶
Some canvas objects allow multiple pages to be rendered to the same file, PDF for example. In this circumstance, create the canvas object outside of the loop and call IGR_Render_Page to the one canvas object. For output formats that support multiple pages, you may choose to write multiple input documents to a single output document.