Vanilla.PDF  1.6.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;
InputStreamHandle* input_stream = NULL;
RETURN_ERROR_IF_NOT_SUCCESS(LicenseInfo_IsValid(&is_valid));
if (is_valid != VANILLAPDF_RV_FALSE) {
print_text("License is enabled by default\n");
return VANILLAPDF_TEST_ERROR_FAILURE;
}
RETURN_ERROR_IF_NOT_SUCCESS(InputStream_CreateFromFile(license_file, &input_stream));
RETURN_ERROR_IF_NOT_SUCCESS(InputStream_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) {
print_text("Could not enable license\n");
return VANILLAPDF_TEST_ERROR_FAILURE;
}
RETURN_ERROR_IF_NOT_SUCCESS(InputStream_Release(input_stream));
RETURN_ERROR_IF_NOT_SUCCESS(Buffer_Release(license_buffer));
return VANILLAPDF_TEST_ERROR_SUCCESS;
}
Represents memory stored data.
error_type CALLING_CONVENTION Buffer_Release(BufferHandle *handle)
Decrement the internal reference counter.
Input stream can read and interpret input from sequences of characters.
error_type CALLING_CONVENTION InputStream_ToBuffer(InputStreamHandle *handle, BufferHandle **result)
Reads all data from the input stream and returns them as a single large buffer.
error_type CALLING_CONVENTION InputStream_Release(InputStreamHandle *handle)
Decrement the internal reference counter.
error_type CALLING_CONVENTION InputStream_CreateFromFile(string_type filename, InputStreamHandle **result)
Opens an existing file at filename for read.
error_type CALLING_CONVENTION LicenseInfo_SetLicenseBuffer(BufferHandle *data)
Set content of the license file in case it is used as embedded resource.
error_type CALLING_CONVENTION LicenseInfo_IsValid(boolean_type *result)
Determine whether a valid license has been presented.
const boolean_type VANILLAPDF_RV_TRUE
Represents the boolean true value.
const boolean_type VANILLAPDF_RV_FALSE
Represents the boolean false value.
uint32_t error_type
This is return value type of all API functions.
Definition: c_types.h:25
int8_t boolean_type
Boolean type supported in C.
Definition: c_types.h:31
const char * string_type
C-Style string.
Definition: c_types.h:82