Click or drag to resize

PdfiumFPDFPage_Flatten Method

Flat a pdf page, annotations or form fields will become part of the page contents.

Namespace: Patagames.Pdf
Assembly: Patagames.Pdf (in Patagames.Pdf.dll) Version: 4.94.2704
Syntax
public static FlattenResults FPDFPage_Flatten(
	IntPtr page,
	FlattenFlags flag
)

Parameters

page  IntPtr
Handle to the page. Returned by FPDF_LoadPage(IntPtr, Int32)function.
flag  FlattenFlags
the flag for the use of flatten result. Zero for normal display, 1 for print.

Return Value

FlattenResults
The result flag of the function, See flags above ( FLATTEN_FAIL, FLATTEN_SUCCESS, FLATTEN_NOTHINGTODO ).
Remarks
Current Version on all fails return zero.
Example
C#
public void FPDFPage_Flatten()
{
    IntPtr doc = Pdfium.FPDF_LoadDocument(@"Files\test001.pdf");
    IntPtr page = Pdfium.FPDF_LoadPage(doc, 0);

    var ret = Pdfium.FPDFPage_Flatten(page, FlattenFlags.FlatPrint);
    if (ret != FlattenResults.Success)
           throw new Exception();

    ret = Pdfium.FPDFPage_Flatten(page, FlattenFlags.NormalDisplay);
    if (ret != FlattenResults.NothingTodo)
        throw new Exception();

    Pdfium.FPDF_ClosePage(page);
    Pdfium.FPDF_CloseDocument(doc);
}
See Also