IGR_Redact_Page_Text¶
IGR_Redact_Page_Text removes the words and blacks out the location for the specified range from the page.
Prototype¶
IGR_LONG IGR_Redact_Page_Text(
HPAGE page,
IGR_LONG from,
IGR_LONG to,
Error_Control_Block* Error);
Parameters¶
Page: HPAGE
Handle to a page, opened by a call to IGR_Open_Page.
From: IGR_LONG
The index of the first word to redact.
To: IGR_LONG
The index to the last word to redact.
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.
Additional information¶
It should be assumed that redacted content will not persist between closing and re-opening a page. To create a redacted Image, PDF or HTML file, open a page, perform the redaction and render the page to a canvas before closing it.
The API allows for redacting single words or a run or range of words. When redacting a range, whitespace between the words will also be redacted.
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)
{
IGR_Redact_Page_Text(PageHandle, 0, 15, &ISYSError);
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);
}