Vanilla.PDF  1.3.0
Cross-platform toolkit for creating and modifying PDF documents
Set license file
error_type process_license_info(string_type license_file) {
BufferHandle* license_buffer = NULL;
IInputStreamHandle* input_stream = NULL;
RETURN_ERROR_IF_NOT_SUCCESS(LicenseInfo_IsValid(&is_valid));
if (is_valid != VANILLAPDF_RV_FALSE) {
printf("License is enabled by default\n");
return VANILLAPDF_TEST_ERROR_FAILURE;
}
RETURN_ERROR_IF_NOT_SUCCESS(IInputStream_CreateFromFile(license_file, &input_stream));
RETURN_ERROR_IF_NOT_SUCCESS(IInputStream_ToBuffer(input_stream, &license_buffer));
RETURN_ERROR_IF_NOT_SUCCESS(LicenseInfo_SetLicenseBuffer(license_buffer));
RETURN_ERROR_IF_NOT_SUCCESS(LicenseInfo_IsValid(&is_valid));
if (is_valid != VANILLAPDF_RV_TRUE) {
printf("Could not enable license\n");
return VANILLAPDF_TEST_ERROR_FAILURE;
}
RETURN_ERROR_IF_NOT_SUCCESS(IInputStream_Release(input_stream));
RETURN_ERROR_IF_NOT_SUCCESS(Buffer_Release(license_buffer));
return VANILLAPDF_TEST_ERROR_SUCCESS;
}