Last active
August 14, 2024 20:01
-
-
Save terjehelgesen/a7425bab131f267a71fc074a6d3a1f91 to your computer and use it in GitHub Desktop.
Convert a PDF file to PDF/A standard using C++
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int ConvertPDFtoPDFA( WCHAR *SerialNumber, WCHAR *InputFile, WCHAR *OutputFile, int ConformStandard, BSTR *bstrErrors) | |
{ | |
//Declare Conform function | |
typedef int ( *SC_CONFORM_FILE)(WCHAR *SerialNumber, WCHAR *InputFileName, int ConformStandard, WCHAR *OutputFileName, BSTR *Errors); | |
//Load scConverter.dll | |
HINSTANCE hLib = LoadLibraryExW( L"scConverter.dll", nullptr, LOAD_WITH_ALTERED_SEARCH_PATH ); | |
if (!hLib) return -1; | |
//Get Conform function pointer | |
SC_CONFORM_FILE ConformFileFunc = (SC_CONFORM_FILE)GetProcAddress( hLib, "scPDFConform" ); | |
//Call Conform function | |
int result = ConformFileFunc( SerialNumber, InputFile, ConformStandard, OutputFile, bstrErrors); | |
FreeLibrary( hLib ); | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sample usage:
BSTR bstrErrors = nullptr;
int returnvalue = ConvertPDFtoPDFA( L"", L"input.pdf", 6, L"output.pdf", &bstrErrors ); //Conform type 6 = PDF/A-4