FPDFEDIT module is used to add, delete and edit a PDF document. To create a PDF document, please call the functions of FPDF_CreateNewDocument, FPDFPage_New.
FPDF_CreateNewDocument is used to create a blank PDF document, whose page count is 0. To edit the page, please call FPDFPage_New function to add pages first.
Here is an example:
// Create an empty pdf document
FPDF_DOCUMENT pPDFDoc = FPDF_CreateNewDocument();
// Insert a pdf page
FPDF_PAGE pdf_page = FPDFPage_New(pPDFDoc,0,500,600);
// New an image object
FPDF_PAGEOBJECT page_obj = FPDFPageObj_NewImgeObj(pPDFDoc);
// Load the image from file
BOOL ret = FPDFImageObj_LoadFromFile(pdf_page,1,page_obj,file_path);
// Insert a pdf page
FPDFPage_InsertObject(pdf_page,page_obj);
…
// Save the new document
FPDF_SaveAsFile(pPDFDoc,filepath,NULL,NULL,0,NULL,0);