DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadDocument(FPDF_STRING file_path, FPDF_BYTESTRING password) { CPDF_Parser* pParser = FX_NEW CPDF_Parser; pParser->SetPassword(password); FX_DWORD err_code = pParser->StartParse((FX_LPCSTR)file_path); if (err_code) { delete pParser; ProcessParseError(err_code); return NULL; } return pParser->GetDocument(); }
DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadCustomDocument(FPDF_FILEACCESS* pFileAccess, FPDF_BYTESTRING password) { CPDF_Parser* pParser = new CPDF_Parser; pParser->SetPassword(password); CPDF_CustomAccess* pFile = new CPDF_CustomAccess(pFileAccess); FX_DWORD err_code = pParser->StartParse(pFile); if (err_code) { delete pParser; ProcessParseError(err_code); return NULL; } CPDF_Document * pDoc = NULL; pDoc = pParser?pParser->GetDocument():NULL; CheckUnSupportError(pDoc, err_code); return pParser->GetDocument(); }
DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadMemDocument(const void* data_buf, int size, FPDF_BYTESTRING password) { CPDF_Parser* pParser = new CPDF_Parser; pParser->SetPassword(password); CMemFile* pMemFile = new CMemFile((uint8_t*)data_buf, size); FX_DWORD err_code = pParser->StartParse(pMemFile); if (err_code) { delete pParser; ProcessParseError(err_code); return NULL; } CPDF_Document * pDoc = NULL; pDoc = pParser?pParser->GetDocument():NULL; CheckUnSupportError(pDoc, err_code); return pParser->GetDocument(); }
DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadMemDocument(const void* data_buf, int size, FPDF_BYTESTRING password) { CPDF_Parser* pParser = FX_NEW CPDF_Parser; pParser->SetPassword(password); try { CMemFile* pMemFile = FX_NEW CMemFile((FX_BYTE*)data_buf, size); FX_DWORD err_code = pParser->StartParse(pMemFile); if (err_code) { delete pParser; ProcessParseError(err_code); return NULL; } CPDF_Document * pDoc = NULL; pDoc = pParser?pParser->GetDocument():NULL; CheckUnSupportError(pDoc, err_code); } catch (...) { delete pParser; SetLastError(FPDF_ERR_UNKNOWN); return NULL; } return pParser->GetDocument(); }