<?php
/**
 * tcpdf_include.php – minimal autoloader for TCPDF
 * This works with the files you already have (tcpdf.php, tcpdf_autoconfig.php).
 */

// 1. Load autoconfig if it exists (it defines many constants)
if (file_exists(dirname(__FILE__) . '/tcpdf_autoconfig.php')) {
    require_once(dirname(__FILE__) . '/tcpdf_autoconfig.php');
}

// 2. Define any missing constants that TCPDF expects
if (!defined('K_PATH_MAIN')) {
    define('K_PATH_MAIN', dirname(__FILE__) . '/');
}
if (!defined('K_PATH_URL')) {
    define('K_PATH_URL', K_PATH_MAIN);
}
if (!defined('K_PATH_FONTS')) {
    define('K_PATH_FONTS', K_PATH_MAIN . 'fonts/');
}
if (!defined('K_PATH_CACHE')) {
    define('K_PATH_CACHE', sys_get_temp_dir() . '/');
}
if (!defined('K_PATH_IMAGES')) {
    define('K_PATH_IMAGES', K_PATH_MAIN . 'images/');
}
if (!defined('K_BLANK_IMAGE')) {
    define('K_BLANK_IMAGE', K_PATH_IMAGES . '_blank.png');
}
if (!defined('PDF_PAGE_FORMAT')) {
    define('PDF_PAGE_FORMAT', 'A4');
}
if (!defined('PDF_PAGE_ORIENTATION')) {
    define('PDF_PAGE_ORIENTATION', 'P');
}
if (!defined('PDF_CREATOR')) {
    define('PDF_CREATOR', 'TCPDF');
}
if (!defined('PDF_AUTHOR')) {
    define('PDF_AUTHOR', 'PowerVentures Ltd');
}
if (!defined('PDF_HEADER_TITLE')) {
    define('PDF_HEADER_TITLE', 'PowerVentures Ltd');
}
if (!defined('PDF_HEADER_STRING')) {
    define('PDF_HEADER_STRING', "© " . date('Y') . " PowerVentures Ltd - All rights reserved.");
}
if (!defined('PDF_UNIT')) {
    define('PDF_UNIT', 'mm');
}
if (!defined('PDF_MARGIN_HEADER')) {
    define('PDF_MARGIN_HEADER', 5);
}
if (!defined('PDF_MARGIN_FOOTER')) {
    define('PDF_MARGIN_FOOTER', 10);
}
if (!defined('PDF_MARGIN_TOP')) {
    define('PDF_MARGIN_TOP', 27);
}
if (!defined('PDF_MARGIN_BOTTOM')) {
    define('PDF_MARGIN_BOTTOM', 25);
}
if (!defined('PDF_MARGIN_LEFT')) {
    define('PDF_MARGIN_LEFT', 15);
}
if (!defined('PDF_MARGIN_RIGHT')) {
    define('PDF_MARGIN_RIGHT', 15);
}
if (!defined('PDF_FONT_NAME_MAIN')) {
    define('PDF_FONT_NAME_MAIN', 'helvetica');
}
if (!defined('PDF_FONT_SIZE_MAIN')) {
    define('PDF_FONT_SIZE_MAIN', 10);
}
if (!defined('PDF_FONT_NAME_DATA')) {
    define('PDF_FONT_NAME_DATA', 'helvetica');
}
if (!defined('PDF_FONT_SIZE_DATA')) {
    define('PDF_FONT_SIZE_DATA', 8);
}
if (!defined('PDF_FONT_MONOSPACED')) {
    define('PDF_FONT_MONOSPACED', 'courier');
}
if (!defined('PDF_IMAGE_SCALE_RATIO')) {
    define('PDF_IMAGE_SCALE_RATIO', 1.25);
}
if (!defined('HEAD_MAGNIFICATION')) {
    define('HEAD_MAGNIFICATION', 1.1);
}
if (!defined('K_CELL_HEIGHT_RATIO')) {
    define('K_CELL_HEIGHT_RATIO', 1.25);
}
if (!defined('K_TITLE_MAGNIFICATION')) {
    define('K_TITLE_MAGNIFICATION', 1.3);
}
if (!defined('K_SMALL_RATIO')) {
    define('K_SMALL_RATIO', 2/3);
}
if (!defined('K_THAI_TOPCHARS')) {
    define('K_THAI_TOPCHARS', true);
}
if (!defined('K_TCPDF_CALLS_IN_HTML')) {
    define('K_TCPDF_CALLS_IN_HTML', true);
}
if (!defined('K_TCPDF_THROW_EXCEPTION_ERROR')) {
    define('K_TCPDF_THROW_EXCEPTION_ERROR', false);
}
if (!defined('K_TIMEZONE')) {
    define('K_TIMEZONE', 'UTC');
}

// 3. Finally, include the main TCPDF class
require_once(dirname(__FILE__) . '/tcpdf.php');
?>