Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- define("mPDF_VERSION", "5.6");
- define("_MPDFK", 72 / 25.4);
- define("AUTOFONT_CJK", 1);
- define("AUTOFONT_THAIVIET", 2);
- define("AUTOFONT_RTL", 4);
- define("AUTOFONT_INDIC", 8);
- define("AUTOFONT_ALL", 15);
- define("_BORDER_ALL", 15);
- define("_BORDER_TOP", 8);
- define("_BORDER_RIGHT", 4);
- define("_BORDER_BOTTOM", 2);
- define("_BORDER_LEFT", 1);
- if (!defined("_MPDF_PATH")) {
- define("_MPDF_PATH", dirname(preg_replace("/\\\\/", "/", __FILE__)) . "/");
- }
- if (!defined("_MPDF_URI")) {
- define("_MPDF_URI", _MPDF_PATH);
- }
- require_once(_MPDF_PATH . "includes/functions.php");
- require_once(_MPDF_PATH . "config_cp.php");
- if (!defined("_JPGRAPH_PATH")) {
- define("_JPGRAPH_PATH", _MPDF_PATH . "jpgraph/");
- }
- if (!defined("_MPDF_TEMP_PATH")) {
- define("_MPDF_TEMP_PATH", _MPDF_PATH . "tmp/");
- }
- if (!defined("_MPDF_TTFONTPATH")) {
- define("_MPDF_TTFONTPATH", _MPDF_PATH . "ttfonts/");
- }
- if (!defined("_MPDF_TTFONTDATAPATH")) {
- define("_MPDF_TTFONTDATAPATH", _MPDF_PATH . "ttfontdata/");
- }
- $errorlevel = error_reporting();
- $errorlevel = error_reporting($errorlevel & ~8);
- if (function_exists("date_default_timezone_set") && ini_get("date.timezone") == "") {
- date_default_timezone_set("Europe/London");
- }
- if (!function_exists("mb_strlen")) {
- exit("Error - mPDF requires mb_string functions. Ensure that PHP is compiled with php_mbstring.dll enabled.");
- }
- if (!defined("PHP_VERSION_ID")) {
- $version = explode(".", PHP_VERSION);
- define("PHP_VERSION_ID", $version[0] * 10000 + $version[1] * 100 + $version[2]);
- }
- $test = pack("d", 134455.474557333);
- define("_DSIZE", strlen($test));
- class mPDF
- {
- public $margBuffer = NULL;
- public $splitTableBorderWidth = NULL;
- public $cacheTables = NULL;
- public $bookmarkStyles = NULL;
- public $useActiveForms = NULL;
- public $repackageTTF = NULL;
- public $allowCJKorphans = NULL;
- public $allowCJKoverflow = NULL;
- public $useKerning = NULL;
- public $restrictColorSpace = NULL;
- public $bleedMargin = NULL;
- public $crossMarkMargin = NULL;
- public $cropMarkMargin = NULL;
- public $cropMarkLength = NULL;
- public $nonPrintMargin = NULL;
- public $PDFX = NULL;
- public $PDFXauto = NULL;
- public $PDFA = NULL;
- public $PDFAauto = NULL;
- public $ICCProfile = NULL;
- public $printers_info = NULL;
- public $iterationCounter = NULL;
- public $smCapsScale = NULL;
- public $smCapsStretch = NULL;
- public $backupSubsFont = NULL;
- public $backupSIPFont = NULL;
- public $debugfonts = NULL;
- public $useAdobeCJK = NULL;
- public $percentSubset = NULL;
- public $maxTTFFilesize = NULL;
- public $BMPonly = NULL;
- public $tableMinSizePriority = NULL;
- public $dpi = NULL;
- public $watermarkImgAlphaBlend = NULL;
- public $watermarkImgBehind = NULL;
- public $justifyB4br = NULL;
- public $packTableData = NULL;
- public $pgsIns = NULL;
- public $simpleTables = NULL;
- public $enableImports = NULL;
- public $debug = NULL;
- public $showStats = NULL;
- public $setAutoTopMargin = NULL;
- public $setAutoBottomMargin = NULL;
- public $autoMarginPadding = NULL;
- public $collapseBlockMargins = NULL;
- public $falseBoldWeight = NULL;
- public $normalLineheight = NULL;
- public $progressBar = NULL;
- public $incrementFPR1 = NULL;
- public $incrementFPR2 = NULL;
- public $incrementFPR3 = NULL;
- public $incrementFPR4 = NULL;
- public $hyphenate = NULL;
- public $hyphenateTables = NULL;
- public $SHYlang = NULL;
- public $SHYleftmin = NULL;
- public $SHYrightmin = NULL;
- public $SHYcharmin = NULL;
- public $SHYcharmax = NULL;
- public $SHYlanguages = NULL;
- public $pagenumPrefix = NULL;
- public $pagenumSuffix = NULL;
- public $nbpgPrefix = NULL;
- public $nbpgSuffix = NULL;
- public $showImageErrors = NULL;
- public $allow_output_buffering = NULL;
- public $autoPadding = NULL;
- public $useGraphs = NULL;
- public $autoFontGroupSize = NULL;
- public $tabSpaces = NULL;
- public $useLang = NULL;
- public $restoreBlockPagebreaks = NULL;
- public $watermarkTextAlpha = NULL;
- public $watermarkImageAlpha = NULL;
- public $watermark_size = NULL;
- public $watermark_pos = NULL;
- public $annotSize = NULL;
- public $annotMargin = NULL;
- public $annotOpacity = NULL;
- public $title2annots = NULL;
- public $keepColumns = NULL;
- public $keep_table_proportions = NULL;
- public $ignore_table_widths = NULL;
- public $ignore_table_percents = NULL;
- public $list_align_style = NULL;
- public $list_number_suffix = NULL;
- public $useSubstitutions = NULL;
- public $CSSselectMedia = NULL;
- public $forcePortraitHeaders = NULL;
- public $forcePortraitMargins = NULL;
- public $displayDefaultOrientation = NULL;
- public $ignore_invalid_utf8 = NULL;
- public $allowedCSStags = NULL;
- public $onlyCoreFonts = NULL;
- public $allow_charset_conversion = NULL;
- public $jSWord = NULL;
- public $jSmaxChar = NULL;
- public $jSmaxCharLast = NULL;
- public $jSmaxWordLast = NULL;
- public $orphansAllowed = NULL;
- public $max_colH_correction = NULL;
- public $table_error_report = NULL;
- public $table_error_report_param = NULL;
- public $biDirectional = NULL;
- public $text_input_as_HTML = NULL;
- public $anchor2Bookmark = NULL;
- public $list_indent_first_level = NULL;
- public $shrink_tables_to_fit = NULL;
- public $allow_html_optional_endtags = NULL;
- public $img_dpi = NULL;
- public $defaultheaderfontsize = NULL;
- public $defaultheaderfontstyle = NULL;
- public $defaultheaderline = NULL;
- public $defaultfooterfontsize = NULL;
- public $defaultfooterfontstyle = NULL;
- public $defaultfooterline = NULL;
- public $header_line_spacing = NULL;
- public $footer_line_spacing = NULL;
- public $pregUHCchars = NULL;
- public $pregSJISchars = NULL;
- public $pregCJKchars = NULL;
- public $pregASCIIchars1 = NULL;
- public $pregASCIIchars2 = NULL;
- public $pregASCIIchars3 = NULL;
- public $pregVIETchars = NULL;
- public $pregVIETPluschars = NULL;
- public $pregRTLchars = NULL;
- public $pregHEBchars = NULL;
- public $pregARABICchars = NULL;
- public $pregNonARABICchars = NULL;
- public $pregHIchars = NULL;
- public $pregBNchars = NULL;
- public $pregPAchars = NULL;
- public $pregGUchars = NULL;
- public $pregORchars = NULL;
- public $pregTAchars = NULL;
- public $pregTEchars = NULL;
- public $pregKNchars = NULL;
- public $pregMLchars = NULL;
- public $pregSHchars = NULL;
- public $pregINDextra = NULL;
- public $mirrorMargins = NULL;
- public $default_lineheight_correction = NULL;
- public $watermarkText = NULL;
- public $watermarkImage = NULL;
- public $showWatermarkText = NULL;
- public $showWatermarkImage = NULL;
- public $fontsizes = NULL;
- public $UnvalidatedText = NULL;
- public $TopicIsUnvalidated = NULL;
- public $useOddEven = NULL;
- public $useSubstitutionsMB = NULL;
- public $grad = NULL;
- public $bmp = NULL;
- public $wmf = NULL;
- public $tocontents = NULL;
- public $form = NULL;
- public $directw = NULL;
- public $inMeter = NULL;
- public $CJKleading = NULL;
- public $CJKfollowing = NULL;
- public $CJKoverflow = NULL;
- public $textshadow = NULL;
- public $colsums = NULL;
- public $spanborder = NULL;
- public $spanborddet = NULL;
- public $visibility = NULL;
- public $useRC128encryption = NULL;
- public $uniqid = NULL;
- public $kerning = NULL;
- public $fixedlSpacing = NULL;
- public $minwSpacing = NULL;
- public $lSpacingCSS = NULL;
- public $wSpacingCSS = NULL;
- public $listDir = NULL;
- public $spotColorIDs = NULL;
- public $SVGcolors = NULL;
- public $spotColors = NULL;
- public $defTextColor = NULL;
- public $defDrawColor = NULL;
- public $defFillColor = NULL;
- public $tableBackgrounds = NULL;
- public $inlineDisplayOff = NULL;
- public $kt_y00 = NULL;
- public $kt_p00 = NULL;
- public $upperCase = NULL;
- public $checkSIP = NULL;
- public $checkSMP = NULL;
- public $checkCJK = NULL;
- public $tableCJK = NULL;
- public $watermarkImgAlpha = NULL;
- public $PDFAXwarnings = NULL;
- public $MetadataRoot = NULL;
- public $OutputIntentRoot = NULL;
- public $InfoRoot = NULL;
- public $current_filename = NULL;
- public $parsers = NULL;
- public $current_parser = NULL;
- public $_obj_stack = NULL;
- public $_don_obj_stack = NULL;
- public $_current_obj_id = NULL;
- public $tpls = NULL;
- public $tpl = NULL;
- public $tplprefix = NULL;
- public $_res = NULL;
- public $pdf_version = NULL;
- public $noImageFile = NULL;
- public $lastblockbottommargin = NULL;
- public $baselineC = NULL;
- public $subPos = NULL;
- public $subArrMB = NULL;
- public $ReqFontStyle = NULL;
- public $tableClipPath = NULL;
- public $forceExactLineheight = NULL;
- public $listOcc = NULL;
- public $fullImageHeight = NULL;
- public $inFixedPosBlock = NULL;
- public $fixedPosBlock = NULL;
- public $fixedPosBlockDepth = NULL;
- public $fixedPosBlockBBox = NULL;
- public $fixedPosBlockSave = NULL;
- public $maxPosL = NULL;
- public $maxPosR = NULL;
- public $loaded = NULL;
- public $extraFontSubsets = NULL;
- public $docTemplateStart = NULL;
- public $time0 = NULL;
- public $indic = NULL;
- public $barcode = NULL;
- public $SHYpatterns = NULL;
- public $loadedSHYpatterns = NULL;
- public $loadedSHYdictionary = NULL;
- public $SHYdictionary = NULL;
- public $SHYdictionaryWords = NULL;
- public $spanbgcolorarray = NULL;
- public $default_font = NULL;
- public $list_lineheight = NULL;
- public $headerbuffer = NULL;
- public $lastblocklevelchange = NULL;
- public $nestedtablejustfinished = NULL;
- public $linebreakjustfinished = NULL;
- public $cell_border_dominance_L = NULL;
- public $cell_border_dominance_R = NULL;
- public $cell_border_dominance_T = NULL;
- public $cell_border_dominance_B = NULL;
- public $tbCSSlvl = NULL;
- public $listCSSlvl = NULL;
- public $table_keep_together = NULL;
- public $plainCell_properties = NULL;
- public $inherit_lineheight = NULL;
- public $listitemtype = NULL;
- public $shrin_k1 = NULL;
- public $outerfilled = NULL;
- public $blockContext = NULL;
- public $floatDivs = NULL;
- public $tablecascadeCSS = NULL;
- public $listcascadeCSS = NULL;
- public $patterns = NULL;
- public $pageBackgrounds = NULL;
- public $bodyBackgroundGradient = NULL;
- public $bodyBackgroundImage = NULL;
- public $bodyBackgroundColor = NULL;
- public $writingHTMLheader = NULL;
- public $writingHTMLfooter = NULL;
- public $autoFontGroups = NULL;
- public $angle = NULL;
- public $gradients = NULL;
- public $kwt_Reference = NULL;
- public $kwt_BMoutlines = NULL;
- public $kwt_toc = NULL;
- public $tbrot_Reference = NULL;
- public $tbrot_BMoutlines = NULL;
- public $tbrot_toc = NULL;
- public $col_Reference = NULL;
- public $col_BMoutlines = NULL;
- public $col_toc = NULL;
- public $currentGraphId = NULL;
- public $graphs = NULL;
- public $floatbuffer = NULL;
- public $floatmargins = NULL;
- public $bullet = NULL;
- public $bulletarray = NULL;
- public $rtlAsArabicFarsi = NULL;
- public $currentLang = NULL;
- public $default_lang = NULL;
- public $default_available_fonts = NULL;
- public $pageTemplate = NULL;
- public $docTemplate = NULL;
- public $docTemplateContinue = NULL;
- public $arabGlyphs = NULL;
- public $arabHex = NULL;
- public $persianGlyphs = NULL;
- public $persianHex = NULL;
- public $arabVowels = NULL;
- public $arabPrevLink = NULL;
- public $arabNextLink = NULL;
- public $formobjects = NULL;
- public $InlineProperties = NULL;
- public $InlineAnnots = NULL;
- public $ktAnnots = NULL;
- public $tbrot_Annots = NULL;
- public $kwt_Annots = NULL;
- public $columnAnnots = NULL;
- public $columnForms = NULL;
- public $PageAnnots = NULL;
- public $pageDim = NULL;
- public $breakpoints = NULL;
- public $tableLevel = NULL;
- public $tbctr = NULL;
- public $innermostTableLevel = NULL;
- public $saveTableCounter = NULL;
- public $cellBorderBuffer = NULL;
- public $saveHTMLFooter_height = NULL;
- public $saveHTMLFooterE_height = NULL;
- public $firstPageBoxHeader = NULL;
- public $firstPageBoxHeaderEven = NULL;
- public $firstPageBoxFooter = NULL;
- public $firstPageBoxFooterEven = NULL;
- public $page_box = NULL;
- public $show_marks = NULL;
- public $basepathIsLocal = NULL;
- public $use_kwt = NULL;
- public $kwt = NULL;
- public $kwt_height = NULL;
- public $kwt_y0 = NULL;
- public $kwt_x0 = NULL;
- public $kwt_buffer = NULL;
- public $kwt_Links = NULL;
- public $kwt_moved = NULL;
- public $kwt_saved = NULL;
- public $PageNumSubstitutions = NULL;
- public $table_borders_separate = NULL;
- public $base_table_properties = NULL;
- public $borderstyles = NULL;
- public $listjustfinished = NULL;
- public $blockjustfinished = NULL;
- public $orig_bMargin = NULL;
- public $orig_tMargin = NULL;
- public $orig_lMargin = NULL;
- public $orig_rMargin = NULL;
- public $orig_hMargin = NULL;
- public $orig_fMargin = NULL;
- public $pageheaders = NULL;
- public $pagefooters = NULL;
- public $pageHTMLheaders = NULL;
- public $pageHTMLfooters = NULL;
- public $saveHTMLHeader = NULL;
- public $saveHTMLFooter = NULL;
- public $HTMLheaderPageLinks = NULL;
- public $HTMLheaderPageAnnots = NULL;
- public $HTMLheaderPageForms = NULL;
- public $available_unifonts = NULL;
- public $sans_fonts = NULL;
- public $serif_fonts = NULL;
- public $mono_fonts = NULL;
- public $defaultSubsFont = NULL;
- public $available_CJK_fonts = NULL;
- public $cascadeCSS = NULL;
- public $HTMLHeader = NULL;
- public $HTMLFooter = NULL;
- public $HTMLHeaderE = NULL;
- public $HTMLFooterE = NULL;
- public $bufferoutput = NULL;
- public $showdefaultpagenos = NULL;
- public $Big5_widths = NULL;
- public $GB_widths = NULL;
- public $SJIS_widths = NULL;
- public $UHC_widths = NULL;
- public $encrypted = NULL;
- public $Uvalue = NULL;
- public $Ovalue = NULL;
- public $Pvalue = NULL;
- public $enc_obj_id = NULL;
- public $last_rc4_key = NULL;
- public $last_rc4_key_c = NULL;
- public $encryption_key = NULL;
- public $padding = NULL;
- public $BMoutlines = NULL;
- public $OutlineRoot = NULL;
- public $ColActive = NULL;
- public $Reference = NULL;
- public $CurrCol = NULL;
- public $NbCol = NULL;
- public $y0 = NULL;
- public $ColL = NULL;
- public $ColWidth = NULL;
- public $ColGap = NULL;
- public $ColR = NULL;
- public $ChangeColumn = NULL;
- public $columnbuffer = NULL;
- public $ColDetails = NULL;
- public $columnLinks = NULL;
- public $colvAlign = NULL;
- public $substitute = NULL;
- public $entsearch = NULL;
- public $entsubstitute = NULL;
- public $defaultCSS = NULL;
- public $linemaxfontsize = NULL;
- public $lineheight_correction = NULL;
- public $lastoptionaltag = NULL;
- public $pageoutput = NULL;
- public $charset_in = NULL;
- public $blk = NULL;
- public $blklvl = NULL;
- public $ColumnAdjust = NULL;
- public $ws = NULL;
- public $HREF = NULL;
- public $pgwidth = NULL;
- public $fontlist = NULL;
- public $oldx = NULL;
- public $oldy = NULL;
- public $B = NULL;
- public $U = NULL;
- public $S = NULL;
- public $I = NULL;
- public $tdbegin = NULL;
- public $table = NULL;
- public $cell = NULL;
- public $col = NULL;
- public $row = NULL;
- public $divbegin = NULL;
- public $divalign = NULL;
- public $divwidth = NULL;
- public $divheight = NULL;
- public $divrevert = NULL;
- public $spanbgcolor = NULL;
- public $spanlvl = NULL;
- public $listlvl = NULL;
- public $listnum = NULL;
- public $listtype = NULL;
- public $listoccur = NULL;
- public $listlist = NULL;
- public $listitem = NULL;
- public $pjustfinished = NULL;
- public $ignorefollowingspaces = NULL;
- public $SUP = NULL;
- public $SUB = NULL;
- public $SMALL = NULL;
- public $BIG = NULL;
- public $toupper = NULL;
- public $tolower = NULL;
- public $capitalize = NULL;
- public $dash_on = NULL;
- public $dotted_on = NULL;
- public $strike = NULL;
- public $CSS = NULL;
- public $textbuffer = NULL;
- public $currentfontstyle = NULL;
- public $currentfontfamily = NULL;
- public $currentfontsize = NULL;
- public $colorarray = NULL;
- public $bgcolorarray = NULL;
- public $internallink = NULL;
- public $enabledtags = NULL;
- public $lineheight = NULL;
- public $basepath = NULL;
- public $outlineparam = NULL;
- public $outline_on = NULL;
- public $specialcontent = NULL;
- public $selectoption = NULL;
- public $objectbuffer = NULL;
- public $table_rotate = NULL;
- public $tbrot_maxw = NULL;
- public $tbrot_maxh = NULL;
- public $tablebuffer = NULL;
- public $tbrot_align = NULL;
- public $tbrot_Links = NULL;
- public $divbuffer = NULL;
- public $keep_block_together = NULL;
- public $ktLinks = NULL;
- public $ktBlock = NULL;
- public $ktForms = NULL;
- public $ktReference = NULL;
- public $ktBMoutlines = NULL;
- public $_kttoc = NULL;
- public $tbrot_y0 = NULL;
- public $tbrot_x0 = NULL;
- public $tbrot_w = NULL;
- public $tbrot_h = NULL;
- public $mb_enc = NULL;
- public $directionality = NULL;
- public $extgstates = NULL;
- public $mgl = NULL;
- public $mgt = NULL;
- public $mgr = NULL;
- public $mgb = NULL;
- public $tts = NULL;
- public $ttz = NULL;
- public $tta = NULL;
- public $headerDetails = NULL;
- public $footerDetails = NULL;
- public $page_break_after_avoid = NULL;
- public $margin_bottom_collapse = NULL;
- public $list_indent = NULL;
- public $list_align = NULL;
- public $list_margin_bottom = NULL;
- public $default_font_size = NULL;
- public $original_default_font_size = NULL;
- public $original_default_font = NULL;
- public $watermark_font = NULL;
- public $defaultAlign = NULL;
- public $defaultTableAlign = NULL;
- public $tablethead = NULL;
- public $thead_font_weight = NULL;
- public $thead_font_style = NULL;
- public $thead_font_smCaps = NULL;
- public $thead_valign_default = NULL;
- public $thead_textalign_default = NULL;
- public $tabletfoot = NULL;
- public $tfoot_font_weight = NULL;
- public $tfoot_font_style = NULL;
- public $tfoot_font_smCaps = NULL;
- public $tfoot_valign_default = NULL;
- public $tfoot_textalign_default = NULL;
- public $trow_text_rotate = NULL;
- public $cellPaddingL = NULL;
- public $cellPaddingR = NULL;
- public $cellPaddingT = NULL;
- public $cellPaddingB = NULL;
- public $table_lineheight = NULL;
- public $table_border_attr_set = NULL;
- public $table_border_css_set = NULL;
- public $shrin_k = NULL;
- public $shrink_this_table_to_fit = NULL;
- public $MarginCorrection = NULL;
- public $margin_footer = NULL;
- public $margin_header = NULL;
- public $tabletheadjustfinished = NULL;
- public $usingCoreFont = NULL;
- public $charspacing = NULL;
- public $DisplayPreferences = NULL;
- public $outlines = NULL;
- public $flowingBlockAttr = NULL;
- public $page = NULL;
- public $n = NULL;
- public $offsets = NULL;
- public $buffer = NULL;
- public $pages = NULL;
- public $state = NULL;
- public $compress = NULL;
- public $DefOrientation = NULL;
- public $CurOrientation = NULL;
- public $OrientationChanges = NULL;
- public $k = NULL;
- public $fwPt = NULL;
- public $fhPt = NULL;
- public $fw = NULL;
- public $fh = NULL;
- public $wPt = NULL;
- public $hPt = NULL;
- public $w = NULL;
- public $h = NULL;
- public $lMargin = NULL;
- public $tMargin = NULL;
- public $rMargin = NULL;
- public $bMargin = NULL;
- public $cMarginL = NULL;
- public $cMarginR = NULL;
- public $cMarginT = NULL;
- public $cMarginB = NULL;
- public $DeflMargin = NULL;
- public $DefrMargin = NULL;
- public $x = NULL;
- public $y = NULL;
- public $lasth = NULL;
- public $LineWidth = NULL;
- public $CoreFonts = NULL;
- public $fonts = NULL;
- public $FontFiles = NULL;
- public $images = NULL;
- public $PageLinks = NULL;
- public $links = NULL;
- public $FontFamily = NULL;
- public $FontStyle = NULL;
- public $CurrentFont = NULL;
- public $FontSizePt = NULL;
- public $FontSize = NULL;
- public $DrawColor = NULL;
- public $FillColor = NULL;
- public $TextColor = NULL;
- public $ColorFlag = NULL;
- public $autoPageBreak = NULL;
- public $PageBreakTrigger = NULL;
- public $InFooter = NULL;
- public $InHTMLFooter = NULL;
- public $processingFooter = NULL;
- public $processingHeader = NULL;
- public $ZoomMode = NULL;
- public $LayoutMode = NULL;
- public $title = NULL;
- public $subject = NULL;
- public $author = NULL;
- public $keywords = NULL;
- public $creator = NULL;
- public $aliasNbPg = NULL;
- public $aliasNbPgGp = NULL;
- public $aliasNbPgHex = NULL;
- public $aliasNbPgGpHex = NULL;
- public $ispre = NULL;
- public $outerblocktags = NULL;
- public $innerblocktags = NULL;
- public function __construct($mode = "", $format = "A4", $default_font_size = 0, $default_font = "", $mgl = 15, $mgr = 15, $mgt = 16, $mgb = 16, $mgh = 9, $mgf = 9, $orientation = "P")
- {
- if (!class_exists("grad", false)) {
- include(_MPDF_PATH . "classes/grad.php");
- }
- if (empty($this->grad)) {
- $this->grad = new grad($this);
- }
- if (!class_exists("form", false)) {
- include(_MPDF_PATH . "classes/form.php");
- }
- if (empty($this->form)) {
- $this->form = new form($this);
- }
- $this->time0 = microtime(true);
- $this->_dochecks();
- $this->UnvalidatedText =& $this->watermarkText;
- $this->TopicIsUnvalidated =& $this->showWatermarkText;
- $this->AliasNbPg =& $this->aliasNbPg;
- $this->AliasNbPgGp =& $this->aliasNbPgGp;
- $this->BiDirectional =& $this->biDirectional;
- $this->Anchor2Bookmark =& $this->anchor2Bookmark;
- $this->KeepColumns =& $this->keepColumns;
- $this->useOddEven =& $this->mirrorMargins;
- $this->useSubstitutionsMB =& $this->useSubstitutions;
- $this->visibility = "visible";
- $this->spotColors = array();
- $this->spotColorIDs = array();
- $this->tableBackgrounds = array();
- $this->kt_y00 = "";
- $this->kt_p00 = "";
- $this->iterationCounter = false;
- $this->BMPonly = array();
- $this->page = 0;
- $this->n = 2;
- $this->buffer = "";
- $this->objectbuffer = array();
- $this->pages = array();
- $this->OrientationChanges = array();
- $this->state = 0;
- $this->fonts = array();
- $this->FontFiles = array();
- $this->images = array();
- $this->links = array();
- $this->InFooter = false;
- $this->processingFooter = false;
- $this->processingHeader = false;
- $this->lasth = 0;
- $this->FontFamily = "";
- $this->FontStyle = "";
- $this->FontSizePt = 9;
- $this->U = false;
- $this->upperCase = array();
- $this->S = false;
- $this->smCapsScale = 1;
- $this->smCapsStretch = 100;
- $this->margBuffer = 0;
- $this->inMeter = false;
- $this->defTextColor = $this->TextColor = $this->SetTColor($this->ConvertColor(0), true);
- $this->defDrawColor = $this->DrawColor = $this->SetDColor($this->ConvertColor(0), true);
- $this->defFillColor = $this->FillColor = $this->SetFColor($this->ConvertColor(255), true);
- $this->SVGcolors = array(
- "antiquewhite" => "#FAEBD7",
- "aqua" => "#00FFFF",
- "aquamarine" => "#7FFFD4",
- "beige" => "#F5F5DC",
- "black" => "#000000",
- "blue" => "#0000FF",
- "brown" => "#A52A2A",
- "cadetblue" => "#5F9EA0",
- "chocolate" => "#D2691E",
- "cornflowerblue" => "#6495ED",
- "crimson" => "#DC143C",
- "darkblue" => "#00008B",
- "darkgoldenrod" => "#B8860B",
- "darkgreen" => "#006400",
- "darkmagenta" => "#8B008B",
- "darkorange" => "#FF8C00",
- "darkred" => "#8B0000",
- "darkseagreen" => "#8FBC8F",
- "darkslategray" => "#2F4F4F",
- "darkviolet" => "#9400D3",
- "deepskyblue" => "#00BFFF",
- "dodgerblue" => "#1E90FF",
- "firebrick" => "#B22222",
- "forestgreen" => "#228B22",
- "fuchsia" => "#FF00FF",
- "gainsboro" => "#DCDCDC",
- "gold" => "#FFD700",
- "gray" => "#808080",
- "green" => "#008000",
- "greenyellow" => "#ADFF2F",
- "hotpink" => "#FF69B4",
- "indigo" => "#4B0082",
- "khaki" => "#F0E68C",
- "lavenderblush" => "#FFF0F5",
- "lemonchiffon" => "#FFFACD",
- "lightcoral" => "#F08080",
- "lightgoldenrodyellow" => "#FAFAD2",
- "lightgreen" => "#90EE90",
- "lightsalmon" => "#FFA07A",
- "lightskyblue" => "#87CEFA",
- "lightslategray" => "#778899",
- "lightyellow" => "#FFFFE0",
- "lime" => "#00FF00",
- "limegreen" => "#32CD32",
- "magenta" => "#FF00FF",
- "maroon" => "#800000",
- "mediumaquamarine" => "#66CDAA",
- "mediumorchid" => "#BA55D3",
- "mediumseagreen" => "#3CB371",
- "mediumspringgreen" => "#00FA9A",
- "mediumvioletred" => "#C71585",
- "midnightblue" => "#191970",
- "mintcream" => "#F5FFFA",
- "moccasin" => "#FFE4B5",
- "navy" => "#000080",
- "olive" => "#808000",
- "orange" => "#FFA500",
- "orchid" => "#DA70D6",
- "palegreen" => "#98FB98",
- "palevioletred" => "#D87093",
- "peachpuff" => "#FFDAB9",
- "pink" => "#FFC0CB",
- "powderblue" => "#B0E0E6",
- "purple" => "#800080",
- "red" => "#FF0000",
- "royalblue" => "#4169E1",
- "salmon" => "#FA8072",
- "seagreen" => "#2E8B57",
- "sienna" => "#A0522D",
- "silver" => "#C0C0C0",
- "skyblue" => "#87CEEB",
- "slategray" => "#708090",
- "springgreen" => "#00FF7F",
- "steelblue" => "#4682B4",
- "tan" => "#D2B48C",
- "teal" => "#008080",
- "thistle" => "#D8BFD8",
- "turquoise" => "#40E0D0",
- "violetred" => "#D02090",
- "white" => "#FFFFFF",
- "yellow" => "#FFFF00",
- "aliceblue" => "#f0f8ff",
- "azure" => "#f0ffff",
- "bisque" => "#ffe4c4",
- "blanchedalmond" => "#ffebcd",
- "blueviolet" => "#8a2be2",
- "burlywood" => "#deb887",
- "chartreuse" => "#7fff00",
- "coral" => "#ff7f50",
- "cornsilk" => "#fff8dc",
- "cyan" => "#00ffff",
- "darkcyan" => "#008b8b",
- "darkgray" => "#a9a9a9",
- "darkgrey" => "#a9a9a9",
- "darkkhaki" => "#bdb76b",
- "darkolivegreen" => "#556b2f",
- "darkorchid" => "#9932cc",
- "darksalmon" => "#e9967a",
- "darkslateblue" => "#483d8b",
- "darkslategrey" => "#2f4f4f",
- "darkturquoise" => "#00ced1",
- "deeppink" => "#ff1493",
- "dimgray" => "#696969",
- "dimgrey" => "#696969",
- "floralwhite" => "#fffaf0",
- "ghostwhite" => "#f8f8ff",
- "goldenrod" => "#daa520",
- "grey" => "#808080",
- "honeydew" => "#f0fff0",
- "indianred" => "#cd5c5c",
- "ivory" => "#fffff0",
- "lavender" => "#e6e6fa",
- "lawngreen" => "#7cfc00",
- "lightblue" => "#add8e6",
- "lightcyan" => "#e0ffff",
- "lightgray" => "#d3d3d3",
- "lightgrey" => "#d3d3d3",
- "lightpink" => "#ffb6c1",
- "lightseagreen" => "#20b2aa",
- "lightslategrey" => "#778899",
- "lightsteelblue" => "#b0c4de",
- "linen" => "#faf0e6",
- "mediumblue" => "#0000cd",
- "mediumpurple" => "#9370db",
- "mediumslateblue" => "#7b68ee",
- "mediumturquoise" => "#48d1cc",
- "mistyrose" => "#ffe4e1",
- "navajowhite" => "#ffdead",
- "oldlace" => "#fdf5e6",
- "olivedrab" => "#6b8e23",
- "orangered" => "#ff4500",
- "palegoldenrod" => "#eee8aa",
- "paleturquoise" => "#afeeee",
- "papayawhip" => "#ffefd5",
- "peru" => "#cd853f",
- "plum" => "#dda0dd",
- "rosybrown" => "#bc8f8f",
- "saddlebrown" => "#8b4513",
- "sandybrown" => "#f4a460",
- "seashell" => "#fff5ee",
- "slateblue" => "#6a5acd",
- "slategrey" => "#708090",
- "snow" => "#fffafa",
- "tomato" => "#ff6347",
- "violet" => "#ee82ee",
- "wheat" => "#f5deb3",
- "whitesmoke" => "#f5f5f5",
- "yellowgreen" => "#9acd32"
- );
- $this->ColorFlag = false;
- $this->extgstates = array();
- $this->mb_enc = "windows-1252";
- $this->directionality = "ltr";
- $this->defaultAlign = "L";
- $this->defaultTableAlign = "L";
- $this->fixedPosBlockSave = array();
- $this->extraFontSubsets = 0;
- $this->SHYpatterns = array();
- $this->loadedSHYdictionary = false;
- $this->SHYdictionary = array();
- $this->SHYdictionaryWords = array();
- $this->blockContext = 1;
- $this->floatDivs = array();
- $this->DisplayPreferences = "";
- $this->tablecascadeCSS = array();
- $this->listcascadeCSS = array();
- $this->patterns = array();
- $this->pageBackgrounds = array();
- $this->writingHTMLheader = false;
- $this->writingHTMLfooter = false;
- $this->gradients = array();
- $this->kwt_Reference = array();
- $this->kwt_BMoutlines = array();
- $this->kwt_toc = array();
- $this->tbrot_Reference = array();
- $this->tbrot_BMoutlines = array();
- $this->tbrot_toc = array();
- $this->col_Reference = array();
- $this->col_BMoutlines = array();
- $this->col_toc = array();
- $this->graphs = array();
- $this->pgsIns = array();
- $this->PDFAXwarnings = array();
- $this->inlineDisplayOff = false;
- $this->kerning = false;
- $this->lSpacingCSS = "";
- $this->wSpacingCSS = "";
- $this->fixedlSpacing = false;
- $this->minwSpacing = 0;
- $this->baselineC = 0.35;
- $this->noImageFile = str_replace("\\", "/", dirname(__FILE__)) . "/includes/no_image.jpg";
- $this->subPos = 0;
- $this->forceExactLineheight = false;
- $this->listOcc = 0;
- $this->normalLineheight = 1.3;
- $this->incrementFPR1 = 10;
- $this->incrementFPR2 = 10;
- $this->incrementFPR3 = 10;
- $this->incrementFPR4 = 10;
- $this->fullImageHeight = false;
- $this->floatbuffer = array();
- $this->floatmargins = array();
- $this->autoFontGroups = 0;
- $this->formobjects = array();
- $this->InlineProperties = array();
- $this->InlineAnnots = array();
- $this->ktAnnots = array();
- $this->tbrot_Annots = array();
- $this->kwt_Annots = array();
- $this->columnAnnots = array();
- $this->pageDim = array();
- $this->breakpoints = array();
- $this->tableLevel = 0;
- $this->tbctr = array();
- $this->page_box = array();
- $this->show_marks = "";
- $this->kwt = false;
- $this->kwt_height = 0;
- $this->kwt_y0 = 0;
- $this->kwt_x0 = 0;
- $this->kwt_buffer = array();
- $this->kwt_Links = array();
- $this->kwt_moved = false;
- $this->kwt_saved = false;
- $this->PageNumSubstitutions = array();
- $this->base_table_properties = array();
- $this->borderstyles = array(
- "inset",
- "groove",
- "outset",
- "ridge",
- "dotted",
- "dashed",
- "solid",
- "double"
- );
- $this->tbrot_align = "C";
- $this->pageheaders = array();
- $this->pagefooters = array();
- $this->pageHTMLheaders = array();
- $this->pageHTMLfooters = array();
- $this->HTMLheaderPageLinks = array();
- $this->HTMLheaderPageAnnots = array();
- $this->ktForms = array();
- $this->HTMLheaderPageForms = array();
- $this->columnForms = array();
- $this->tbrotForms = array();
- $this->useRC128encryption = false;
- $this->uniqid = "";
- $this->cascadeCSS = array();
- $this->bufferoutput = false;
- $this->encrypted = false;
- $this->BMoutlines = array();
- $this->ColActive = 0;
- $this->Reference = array();
- $this->CurrCol = 0;
- $this->ColL = array(
- 0
- );
- $this->ColR = array(
- 0
- );
- $this->ChangeColumn = 0;
- $this->columnbuffer = array();
- $this->ColDetails = array();
- $this->columnLinks = array();
- $this->substitute = array();
- $this->entsearch = array();
- $this->entsubstitute = array();
- $this->lastoptionaltag = "";
- $this->charset_in = "";
- $this->blk = array();
- $this->blklvl = 0;
- $this->tts = false;
- $this->ttz = false;
- $this->tta = false;
- $this->ispre = false;
- $this->checkSIP = false;
- $this->checkSMP = false;
- $this->checkCJK = false;
- $this->tableCJK = false;
- $this->headerDetails = array();
- $this->footerDetails = array();
- $this->page_break_after_avoid = false;
- $this->margin_bottom_collapse = false;
- $this->tablethead = 0;
- $this->tabletfoot = 0;
- $this->table_border_attr_set = 0;
- $this->table_border_css_set = 0;
- $this->shrin_k = 1;
- $this->shrink_this_table_to_fit = 0;
- $this->MarginCorrection = 0;
- $this->tabletheadjustfinished = false;
- $this->usingCoreFont = false;
- $this->charspacing = 0;
- $this->outlines = array();
- $this->autoPageBreak = true;
- require(_MPDF_PATH . "config.php");
- $this->_setPageSize($format, $orientation);
- $this->DefOrientation = $orientation;
- $this->margin_header = $mgh;
- $this->margin_footer = $mgf;
- $bmargin = $mgb;
- $this->DeflMargin = $mgl;
- $this->DefrMargin = $mgr;
- $this->orig_tMargin = $mgt;
- $this->orig_bMargin = $bmargin;
- $this->orig_lMargin = $this->DeflMargin;
- $this->orig_rMargin = $this->DefrMargin;
- $this->orig_hMargin = $this->margin_header;
- $this->orig_fMargin = $this->margin_footer;
- if ($this->setAutoTopMargin == "pad") {
- $mgt += $this->margin_header;
- }
- if ($this->setAutoBottomMargin == "pad") {
- $mgb += $this->margin_footer;
- }
- $this->SetMargins($this->DeflMargin, $this->DefrMargin, $mgt);
- $this->SetAutoPageBreak($this->autoPageBreak, $bmargin);
- $this->pgwidth = $this->w - $this->lMargin - $this->rMargin;
- $this->cMarginL = 1;
- $this->cMarginR = 1;
- $this->LineWidth = 0.567 / _MPDFK;
- $this->AliasNbPages();
- $this->AliasNbPageGroups();
- $this->aliasNbPgHex = "{nbHEXmarker}";
- $this->aliasNbPgGpHex = "{nbpgHEXmarker}";
- $this->DisableTags();
- $this->SetDisplayMode(100);
- $this->SetCompression(true);
- $this->SetDisplayPreferences("");
- require(_MPDF_PATH . "config_fonts.php");
- $this->available_unifonts = array();
- foreach ($this->fontdata as $f => $fs) {
- if (isset($fs["R"]) && $fs["R"]) {
- $this->available_unifonts[] = $f;
- }
- if (isset($fs["B"]) && $fs["B"]) {
- $this->available_unifonts[] = $f . "B";
- }
- if (isset($fs["I"]) && $fs["I"]) {
- $this->available_unifonts[] = $f . "I";
- }
- if (isset($fs["BI"]) && $fs["BI"]) {
- $this->available_unifonts[] = $f . "BI";
- }
- }
- $this->default_available_fonts = $this->available_unifonts;
- $optcore = false;
- $onlyCoreFonts = false;
- if (preg_match("/([\\-+])aCJK/i", $mode, $m)) {
- preg_replace("/([\\-+])aCJK/i", "", $mode);
- if ($m[1] == "+") {
- $this->useAdobeCJK = true;
- } else {
- $this->useAdobeCJK = false;
- }
- }
- if (strlen($mode) == 1) {
- if ($mode == "s") {
- $this->percentSubset = 100;
- $mode = "";
- } else {
- if ($mode == "c") {
- $onlyCoreFonts = true;
- $mode = "";
- }
- }
- } else {
- if (substr($mode, -2) == "-s") {
- $this->percentSubset = 100;
- $mode = substr($mode, 0, strlen($mode) - 2);
- } else {
- if (substr($mode, -2) == "-c") {
- $onlyCoreFonts = true;
- $mode = substr($mode, 0, strlen($mode) - 2);
- } else {
- if (substr($mode, -2) == "-x") {
- $optcore = true;
- $mode = substr($mode, 0, strlen($mode) - 2);
- }
- }
- }
- }
- if (strlen($mode) == 5 && $mode != "UTF-8" || strlen($mode) == 2) {
- list($coreSuitable, $mpdf_pdf_unifonts) = GetLangOpts($mode, $this->useAdobeCJK);
- if ($coreSuitable && $optcore) {
- $onlyCoreFonts = true;
- }
- if ($mpdf_pdf_unifonts) {
- $this->RestrictUnicodeFonts($mpdf_pdf_unifonts);
- $this->default_available_fonts = $mpdf_pdf_unifonts;
- }
- $this->currentLang = $mode;
- $this->default_lang = $mode;
- }
- $this->onlyCoreFonts = $onlyCoreFonts;
- if ($this->onlyCoreFonts) {
- $this->setMBencoding("windows-1252");
- } else {
- $this->setMBencoding("UTF-8");
- }
- @mb_regex_encoding("UTF-8");
- $this->available_CJK_fonts = array(
- "gb",
- "big5",
- "sjis",
- "uhc",
- "gbB",
- "big5B",
- "sjisB",
- "uhcB",
- "gbI",
- "big5I",
- "sjisI",
- "uhcI",
- "gbBI",
- "big5BI",
- "sjisBI",
- "uhcBI"
- );
- $this->CoreFonts = array(
- "ccourier" => "Courier",
- "ccourierB" => "Courier-Bold",
- "ccourierI" => "Courier-Oblique",
- "ccourierBI" => "Courier-BoldOblique",
- "chelvetica" => "Helvetica",
- "chelveticaB" => "Helvetica-Bold",
- "chelveticaI" => "Helvetica-Oblique",
- "chelveticaBI" => "Helvetica-BoldOblique",
- "ctimes" => "Times-Roman",
- "ctimesB" => "Times-Bold",
- "ctimesI" => "Times-Italic",
- "ctimesBI" => "Times-BoldItalic",
- "csymbol" => "Symbol",
- "czapfdingbats" => "ZapfDingbats"
- );
- $this->fontlist = array(
- "ctimes",
- "ccourier",
- "chelvetica",
- "csymbol",
- "czapfdingbats"
- );
- $this->setHiEntitySubstitutions();
- if ($this->onlyCoreFonts) {
- $this->useSubstitutions = true;
- $this->SetSubstitutions();
- } else {
- $this->useSubstitutions = false;
- }
- if (file_exists(_MPDF_PATH . "mpdf.css")) {
- $css = file_get_contents(_MPDF_PATH . "mpdf.css");
- $css2 = $this->ReadDefaultCSS($css);
- $this->defaultCSS = $this->array_merge_recursive_unique($this->defaultCSS, $css2);
- }
- if ($default_font == "") {
- if ($this->onlyCoreFonts) {
- if (in_array(strtolower($this->defaultCSS["BODY"]["FONT-FAMILY"]), $this->mono_fonts)) {
- $default_font = "ccourier";
- } else {
- if (in_array(strtolower($this->defaultCSS["BODY"]["FONT-FAMILY"]), $this->sans_fonts)) {
- $default_font = "chelvetica";
- } else {
- $default_font = "ctimes";
- }
- }
- } else {
- $default_font = $this->defaultCSS["BODY"]["FONT-FAMILY"];
- }
- }
- if (!$default_font_size) {
- $mmsize = $this->ConvertSize($this->defaultCSS["BODY"]["FONT-SIZE"]);
- $default_font_size = $mmsize * _MPDFK;
- }
- if ($default_font) {
- $this->SetDefaultFont($default_font);
- }
- if ($default_font_size) {
- $this->SetDefaultFontSize($default_font_size);
- }
- $this->SetLineHeight();
- $this->SetFColor($this->ConvertColor(255));
- $this->HREF = "";
- $this->oldy = -1;
- $this->B = 0;
- $this->U = false;
- $this->S = false;
- $this->I = 0;
- $this->listlvl = 0;
- $this->listnum = 0;
- $this->listtype = "";
- $this->listoccur = array();
- $this->listlist = array();
- $this->listitem = array();
- $this->tdbegin = false;
- $this->table = array();
- $this->cell = array();
- $this->col = -1;
- $this->row = -1;
- $this->cellBorderBuffer = array();
- $this->divbegin = false;
- $this->divalign = "";
- $this->divwidth = 0;
- $this->divheight = 0;
- $this->spanbgcolor = false;
- $this->divrevert = false;
- $this->spanborder = false;
- $this->spanborddet = array();
- $this->blockjustfinished = false;
- $this->listjustfinished = false;
- $this->ignorefollowingspaces = true;
- $this->toupper = false;
- $this->tolower = false;
- $this->capitalize = false;
- $this->dash_on = false;
- $this->dotted_on = false;
- $this->SUP = false;
- $this->SUB = false;
- $this->strike = false;
- $this->textshadow = "";
- $this->currentfontfamily = "";
- $this->currentfontsize = "";
- $this->currentfontstyle = "";
- $this->colorarray = array();
- $this->spanbgcolorarray = array();
- $this->textbuffer = array();
- $this->CSS = array();
- $this->internallink = array();
- $this->basepath = "";
- $this->SetBasePath("");
- $this->outlineparam = array();
- $this->outline_on = false;
- $this->specialcontent = "";
- $this->selectoption = array();
- $this->tpls = array();
- $this->tpl = 0;
- $this->tplprefix = "/TPL";
- $this->res = array();
- if ($this->enableImports) {
- $this->SetImportUse();
- }
- if ($this->progressBar) {
- $this->StartProgressBarOutput($this->progressBar);
- }
- }
- public function _setPageSize($format, &$orientation)
- {
- if (is_string($format)) {
- if ($format == "") {
- $format = "A4";
- }
- $pfo = "P";
- if (preg_match("/([0-9a-zA-Z]*)-L/i", $format, $m)) {
- $format = $m[1];
- $pfo = "L";
- }
- $format = $this->_getPageFormat($format);
- if (!$format) {
- $this->Error("Unknown page format: " . $format);
- } else {
- $orientation = $pfo;
- }
- list($this->fwPt, $this->fhPt) = $format;
- } else {
- if (!$format[0] || !$format[1]) {
- $this->Error("Invalid page format: " . $format[0] . " " . $format[1]);
- }
- $this->fwPt = $format[0] * _MPDFK;
- $this->fhPt = $format[1] * _MPDFK;
- }
- $this->fw = $this->fwPt / _MPDFK;
- $this->fh = $this->fhPt / _MPDFK;
- $orientation = strtolower($orientation);
- if ($orientation == "p" || $orientation == "portrait") {
- $orientation = "P";
- $this->wPt = $this->fwPt;
- $this->hPt = $this->fhPt;
- } else {
- if ($orientation == "l" || $orientation == "landscape") {
- $orientation = "L";
- $this->wPt = $this->fhPt;
- $this->hPt = $this->fwPt;
- } else {
- $this->Error("Incorrect orientation: " . $orientation);
- }
- }
- $this->CurOrientation = $orientation;
- $this->w = $this->wPt / _MPDFK;
- $this->h = $this->hPt / _MPDFK;
- }
- public function _getPageFormat($format)
- {
- switch (strtoupper($format)) {
- case "4A0":
- $format = array(
- 4767.87,
- 6740.79
- );
- break;
- case "2A0":
- $format = array(
- 3370.39,
- 4767.87
- );
- break;
- case "A0":
- $format = array(
- 2383.94,
- 3370.39
- );
- break;
- case "A1":
- $format = array(
- 1683.78,
- 2383.94
- );
- break;
- case "A2":
- $format = array(
- 1190.55,
- 1683.78
- );
- break;
- case "A3":
- $format = array(
- 841.89,
- 1190.55
- );
- break;
- case "A4":
- $format = array(
- 595.28,
- 841.89
- );
- break;
- case "A5":
- $format = array(
- 419.53,
- 595.28
- );
- break;
- case "A6":
- $format = array(
- 297.64,
- 419.53
- );
- break;
- case "A7":
- $format = array(
- 209.76,
- 297.64
- );
- break;
- case "A8":
- $format = array(
- 147.4,
- 209.76
- );
- break;
- case "A9":
- $format = array(
- 104.88,
- 147.4
- );
- break;
- case "A10":
- $format = array(
- 73.7,
- 104.88
- );
- break;
- case "B0":
- $format = array(
- 2834.65,
- 4008.19
- );
- break;
- case "B1":
- $format = array(
- 2004.09,
- 2834.65
- );
- break;
- case "B2":
- $format = array(
- 1417.32,
- 2004.09
- );
- break;
- case "B3":
- $format = array(
- 1000.63,
- 1417.32
- );
- break;
- case "B4":
- $format = array(
- 708.66,
- 1000.63
- );
- break;
- case "B5":
- $format = array(
- 498.9,
- 708.66
- );
- break;
- case "B6":
- $format = array(
- 354.33,
- 498.9
- );
- break;
- case "B7":
- $format = array(
- 249.45,
- 354.33
- );
- break;
- case "B8":
- $format = array(
- 175.75,
- 249.45
- );
- break;
- case "B9":
- $format = array(
- 124.72,
- 175.75
- );
- break;
- case "B10":
- $format = array(
- 87.87,
- 124.72
- );
- break;
- case "C0":
- $format = array(
- 2599.37,
- 3676.54
- );
- break;
- case "C1":
- $format = array(
- 1836.85,
- 2599.37
- );
- break;
- case "C2":
- $format = array(
- 1298.27,
- 1836.85
- );
- break;
- case "C3":
- $format = array(
- 918.43,
- 1298.27
- );
- break;
- case "C4":
- $format = array(
- 649.13,
- 918.43
- );
- break;
- case "C5":
- $format = array(
- 459.21,
- 649.13
- );
- break;
- case "C6":
- $format = array(
- 323.15,
- 459.21
- );
- break;
- case "C7":
- $format = array(
- 229.61,
- 323.15
- );
- break;
- case "C8":
- $format = array(
- 161.57,
- 229.61
- );
- break;
- case "C9":
- $format = array(
- 113.39,
- 161.57
- );
- break;
- case "C10":
- $format = array(
- 79.37,
- 113.39
- );
- break;
- case "RA0":
- $format = array(
- 2437.8,
- 3458.27
- );
- break;
- case "RA1":
- $format = array(
- 1729.13,
- 2437.8
- );
- break;
- case "RA2":
- $format = array(
- 1218.9,
- 1729.13
- );
- break;
- case "RA3":
- $format = array(
- 864.57,
- 1218.9
- );
- break;
- case "RA4":
- $format = array(
- 609.45,
- 864.57
- );
- break;
- case "SRA0":
- $format = array(
- 2551.18,
- 3628.35
- );
- break;
- case "SRA1":
- $format = array(
- 1814.17,
- 2551.18
- );
- break;
- case "SRA2":
- $format = array(
- 1275.59,
- 1814.17
- );
- break;
- case "SRA3":
- $format = array(
- 907.09,
- 1275.59
- );
- break;
- case "SRA4":
- $format = array(
- 637.8,
- 907.09
- );
- break;
- case "LETTER":
- $format = array(
- 612,
- 792
- );
- break;
- case "LEGAL":
- $format = array(
- 612,
- 1008
- );
- break;
- case "LEDGER":
- $format = array(
- 279,
- 432
- );
- break;
- case "TABLOID":
- $format = array(
- 279,
- 432
- );
- break;
- case "EXECUTIVE":
- $format = array(
- 521.86,
- 756
- );
- break;
- case "FOLIO":
- $format = array(
- 612,
- 936
- );
- break;
- case "B":
- $format = array(
- 362.83,
- 561.26
- );
- break;
- case "A":
- $format = array(
- 314.65,
- 504.57
- );
- break;
- case "DEMY":
- $format = array(
- 382.68,
- 612.28
- );
- break;
- case "ROYAL":
- $format = array(
- 433.7,
- 663.3
- );
- break;
- default:
- $format = array(
- 595.28,
- 841.89
- );
- }
- return $format;
- }
- public function StartProgressBarOutput($mode = 1)
- {
- if (!defined("_MPDF_URI")) {
- $this->progressBar = false;
- if ($this->debug) {
- $this->Error("You need to define _MPDF_URI to use the progress bar!");
- } else {
- return false;
- }
- }
- $this->progressBar = $mode;
- if ($this->progbar_altHTML) {
- echo $this->progbar_altHTML;
- } else {
- echo "<html>\r\n\t<head>\r\n\t<title>mPDF File Progress</title>\r\n\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\r\n\t<link rel=\"stylesheet\" type=\"text/css\" href=\"" . _MPDF_URI . "progbar.css\" />\r\n\t\t</head>\r\n\t<body>\r\n\t<div class=\"main\">\r\n\t\t<div class=\"heading\">" . $this->progbar_heading . "</div>\r\n\t\t<div class=\"demo\">\r\n\t ";
- if ($this->progressBar == 2) {
- echo "\t\t<table width=\"100%\"><tr><td style=\"width: 50%;\"> \r\n\t\t\t<span class=\"barheading\">Writing HTML code</span> <br/>\r\n\r\n\t\t\t<div class=\"progressBar\">\r\n\t\t\t<div id=\"element1\" class=\"innerBar\"> </div>\r\n\t\t\t</div>\r\n\t\t\t<span class=\"code\" id=\"box1\"></span>\r\n\t\t\t</td><td style=\"width: 50%;\">\r\n\t\t\t<span class=\"barheading\">Autosizing elements</span> <br/>\r\n\t\t\t<div class=\"progressBar\">\r\n\t\t\t<div id=\"element4\" class=\"innerBar\"> </div>\r\n\t\t\t</div>\r\n\t\t\t<span class=\"code\" id=\"box4\"></span>\r\n\t\t\t<br/><br/>\r\n\t\t\t<span class=\"barheading\">Writing Tables</span> <br/>\r\n\t\t\t<div class=\"progressBar\">\r\n\t\t\t<div id=\"element7\" class=\"innerBar\"> </div>\r\n\t\t\t</div>\r\n\t\t\t<span class=\"code\" id=\"box7\"></span>\r\n\t\t\t</td></tr>\r\n\t\t\t<tr><td><br /><br /></td><td></td></tr>\r\n\t\t\t<tr><td style=\"width: 50%;\"> \r\n\t";
- }
- echo "\t\t\t<span class=\"barheading\">Writing PDF file</span> <br/>\r\n\t\t\t<div class=\"progressBar\">\r\n\t\t\t<div id=\"element2\" class=\"innerBar\"> </div>\r\n\t\t\t</div>\r\n\t\t\t<span class=\"code\" id=\"box2\"></span>\r\n\t ";
- if ($this->progressBar == 2) {
- echo "\r\n\t\t\t</td><td style=\"width: 50%;\">\r\n\t\t\t<span class=\"barheading\">Memory usage</span> <br/>\r\n\t\t\t<div class=\"progressBar\">\r\n\t\t\t<div id=\"element5\" class=\"innerBar\"> </div>\r\n\t\t\t</div>\r\n\t\t\t<span id=\"box5\">0</span> " . ini_get("memory_limit") . "<br />\r\n\t\t\t<br/><br/>\r\n\t\t\t<span class=\"barheading\">Memory usage (peak)</span> <br/>\r\n\t\t\t<div class=\"progressBar\">\r\n\t\t\t<div id=\"element6\" class=\"innerBar\"> </div>\r\n\t\t\t</div>\r\n\t\t\t<span id=\"box6\">0</span> " . ini_get("memory_limit") . "<br />\r\n\t\t\t</td></tr>\r\n\t\t\t</table>\r\n\t ";
- }
- echo "\t\t\t<br/><br/>\r\n\t\t<span id=\"box3\"></span>\r\n\r\n\t\t</div>\r\n\t ";
- }
- ob_flush();
- flush();
- }
- public function UpdateProgressBar($el, $val, $txt = "")
- {
- if ($this->progressBar < 2) {
- if (3 < $el) {
- return NULL;
- }
- if ($el == 1) {
- $el = 2;
- }
- }
- echo "<script type=\"text/javascript\">";
- if ($val) {
- echo " document.getElementById('element" . $el . "').style.width='" . $val . "%'; ";
- }
- if ($txt) {
- echo " document.getElementById('box" . $el . "').innerHTML='" . $txt . "'; ";
- }
- if ($this->progressBar == 2) {
- $m = round(memory_get_usage(true) / 1048576);
- $m2 = round(memory_get_peak_usage(true) / 1048576);
- $mem = ($m * 100) / (ini_get("memory_limit") + 0);
- $mem2 = ($m2 * 100) / (ini_get("memory_limit") + 0);
- echo " document.getElementById('element5').style.width='" . $mem . "%'; ";
- echo " document.getElementById('element6').style.width='" . $mem2 . "%'; ";
- echo " document.getElementById('box5').innerHTML='" . $m . "MB / '; ";
- echo " document.getElementById('box6').innerHTML='" . $m2 . "MB / '; ";
- }
- echo "</script>" . "\n";
- ob_flush();
- flush();
- }
- public function RestrictUnicodeFonts($res)
- {
- if (count($res)) {
- $this->available_unifonts = $res;
- } else {
- $this->available_unifonts = $this->default_available_fonts;
- }
- if (count($this->available_unifonts) == 0) {
- $this->available_unifonts[] = $this->default_available_fonts[0];
- }
- $this->available_unifonts = array_values($this->available_unifonts);
- }
- public function setMBencoding($enc)
- {
- if ($this->mb_enc != $enc) {
- $this->mb_enc = $enc;
- mb_internal_encoding($this->mb_enc);
- }
- }
- public function SetMargins($left, $right, $top)
- {
- $this->lMargin = $left;
- $this->rMargin = $right;
- $this->tMargin = $top;
- }
- public function ResetMargins()
- {
- if (($this->forcePortraitHeaders || $this->forcePortraitMargins) && $this->DefOrientation == "P" && $this->CurOrientation == "L") {
- if ($this->mirrorMargins && $this->page % 2 == 0) {
- $this->tMargin = $this->orig_rMargin;
- $this->bMargin = $this->orig_lMargin;
- } else {
- $this->tMargin = $this->orig_lMargin;
- $this->bMargin = $this->orig_rMargin;
- }
- $this->lMargin = $this->DeflMargin;
- $this->rMargin = $this->DefrMargin;
- $this->MarginCorrection = 0;
- $this->PageBreakTrigger = $this->h - $this->bMargin;
- } else {
- if ($this->mirrorMargins && $this->page % 2 == 0) {
- $this->lMargin = $this->DefrMargin;
- $this->rMargin = $this->DeflMargin;
- $this->MarginCorrection = $this->DefrMargin - $this->DeflMargin;
- } else {
- $this->lMargin = $this->DeflMargin;
- $this->rMargin = $this->DefrMargin;
- if ($this->mirrorMargins) {
- $this->MarginCorrection = $this->DeflMargin - $this->DefrMargin;
- }
- }
- }
- $this->x = $this->lMargin;
- }
- public function SetLeftMargin($margin)
- {
- $this->lMargin = $margin;
- if (0 < $this->page && $this->x < $margin) {
- $this->x = $margin;
- }
- }
- public function SetTopMargin($margin)
- {
- $this->tMargin = $margin;
- }
- public function SetRightMargin($margin)
- {
- $this->rMargin = $margin;
- }
- public function SetAutoPageBreak($auto, $margin = 0)
- {
- $this->autoPageBreak = $auto;
- $this->bMargin = $margin;
- $this->PageBreakTrigger = $this->h - $margin;
- }
- public function SetDisplayMode($zoom, $layout = "continuous")
- {
- if ($zoom == "fullpage" || $zoom == "fullwidth" || $zoom == "real" || $zoom == "default" || !is_string($zoom)) {
- $this->ZoomMode = $zoom;
- } else {
- $this->Error("Incorrect zoom display mode: " . $zoom);
- }
- if ($layout == "single" || $layout == "continuous" || $layout == "two" || $layout == "twoleft" || $layout == "tworight" || $layout == "default") {
- $this->LayoutMode = $layout;
- } else {
- $this->Error("Incorrect layout display mode: " . $layout);
- }
- }
- public function SetCompression($compress)
- {
- if (function_exists("gzcompress")) {
- $this->compress = $compress;
- } else {
- $this->compress = false;
- }
- }
- public function SetTitle($title)
- {
- $this->title = $title;
- }
- public function SetSubject($subject)
- {
- $this->subject = $subject;
- }
- public function SetAuthor($author)
- {
- $this->author = $author;
- }
- public function SetKeywords($keywords)
- {
- $this->keywords = $keywords;
- }
- public function SetCreator($creator)
- {
- $this->creator = $creator;
- }
- public function SetAnchor2Bookmark($x)
- {
- $this->anchor2Bookmark = $x;
- }
- public function AliasNbPages($alias = "{nb}")
- {
- $this->aliasNbPg = $alias;
- }
- public function AliasNbPageGroups($alias = "{nbpg}")
- {
- $this->aliasNbPgGp = $alias;
- }
- public function SetAlpha($alpha, $bm = "Normal", $return = false, $mode = "B")
- {
- if (($this->PDFA || $this->PDFX) && $alpha != 1) {
- if ($this->PDFA && !$this->PDFAauto || $this->PDFX && !$this->PDFXauto) {
- $this->PDFAXwarnings[] = "Image opacity must be 100% (Opacity changed to 100%)";
- }
- $alpha = 1;
- }
- $a = array(
- "BM" => "/" . $bm
- );
- if ($mode == "F" || ($mode = "B")) {
- $a["ca"] = $alpha;
- }
- if ($mode == "S" || ($mode = "B")) {
- $a["CA"] = $alpha;
- }
- $gs = $this->AddExtGState($a);
- if ($return) {
- return sprintf("/GS%d gs", $gs);
- }
- $this->_out(sprintf("/GS%d gs", $gs));
- }
- public function AddExtGState($parms)
- {
- $n = count($this->extgstates);
- for ($i = 1; $i <= $n; $i++) {
- if (count($this->extgstates[$i]["parms"]) == count($parms)) {
- $same = true;
- foreach ($this->extgstates[$i]["parms"] as $k => $v) {
- if (!isset($parms[$k]) || $parms[$k] != $v) {
- $same = false;
- break;
- }
- }
- if ($same) {
- return $i;
- }
- }
- }
- $n++;
- $this->extgstates[$n]["parms"] = $parms;
- return $n;
- }
- public function SetVisibility($v)
- {
- if (($this->PDFA || $this->PDFX) && $this->visibility != "visible") {
- $this->PDFAXwarnings[] = "Cannot set visibility to anything other than full when using PDFA or PDFX";
- return "";
- }
- if (!$this->PDFA && !$this->PDFX) {
- $this->pdf_version = "1.5";
- }
- if ($this->visibility != "visible") {
- $this->_out("EMC");
- $this->hasOC = true;
- }
- if ($v == "printonly") {
- $this->_out("/OC /OC1 BDC");
- } else {
- if ($v == "screenonly") {
- $this->_out("/OC /OC2 BDC");
- } else {
- if ($v == "hidden") {
- $this->_out("/OC /OC3 BDC");
- } else {
- if ($v != "visible") {
- $this->Error("Incorrect visibility: " . $v);
- }
- }
- }
- }
- $this->visibility = $v;
- }
- public function Error($msg)
- {
- header("Content-Type: text/html; charset=utf-8");
- exit("<B>mPDF error: </B>" . $msg);
- }
- public function Open()
- {
- if ($this->state == 0) {
- $this->_begindoc();
- }
- }
- public function Close()
- {
- if ($this->progressBar) {
- $this->UpdateProgressBar(2, "2", "Closing last page");
- }
- if ($this->state == 3) {
- return NULL;
- }
- if ($this->page == 0) {
- $this->AddPage($this->CurOrientation);
- }
- if (count($this->cellBorderBuffer)) {
- $this->printcellbuffer();
- }
- if ($this->tablebuffer) {
- $this->printtablebuffer();
- }
- if ($this->ColActive) {
- $this->SetColumns(0);
- $this->ColActive = 0;
- if (count($this->columnbuffer)) {
- $this->printcolumnbuffer();
- }
- }
- if (count($this->divbuffer)) {
- $this->printdivbuffer();
- }
- $s = "";
- $s .= $this->PrintBodyBackgrounds();
- $s .= $this->PrintPageBackgrounds();
- $this->pages[$this->page] = preg_replace("/(___BACKGROUND___PATTERNS" . date("jY") . ")/", "\n" . $s . "\n" . "\\1", $this->pages[$this->page]);
- $this->pageBackgrounds = array();
- if ($this->visibility != "visible") {
- $this->SetVisibility("visible");
- }
- if (!$this->tocontents || !$this->tocontents->TOCmark) {
- $this->InFooter = true;
- $this->Footer();
- $this->InFooter = false;
- }
- if ($this->tocontents && ($this->tocontents->TOCmark || count($this->tocontents->m_TOC))) {
- $this->tocontents->insertTOC();
- }
- $this->_endpage();
- $this->_enddoc();
- }
- public function _resizeBackgroundImage($imw, $imh, $cw, $ch, $resize = 0, $repx, $repy)
- {
- $cw = $cw * _MPDFK;
- $ch = $ch * _MPDFK;
- if (!$resize) {
- return array(
- $imw,
- $imh,
- $repx,
- $repy
- );
- }
- if ($resize == 1 && $cw < $imw) {
- $h = ($imh * $cw) / $imw;
- $repx = false;
- return array(
- $cw,
- $h,
- $repx,
- $repy
- );
- }
- if ($resize == 2 && $ch < $imh) {
- $w = ($imw * $ch) / $imh;
- $repy = false;
- return array(
- $w,
- $ch,
- $repx,
- $repy
- );
- }
- if ($resize == 3) {
- $w = $imw;
- $h = $imh;
- $saverepx = $repx;
- if ($cw < $w) {
- $h = ($h * $cw) / $w;
- $w = $cw;
- $repx = false;
- }
- if ($ch < $h) {
- $w = ($w * $ch) / $h;
- $h = $ch;
- $repy = false;
- $repx = $saverepx;
- }
- return array(
- $w,
- $h,
- $repx,
- $repy
- );
- }
- if ($resize == 4) {
- $h = ($imh * $cw) / $imw;
- $repx = false;
- return array(
- $cw,
- $h,
- $repx,
- $repy
- );
- }
- if ($resize == 5) {
- $w = ($imw * $ch) / $imh;
- $repy = false;
- return array(
- $w,
- $ch,
- $repx,
- $repy
- );
- }
- if ($resize == 6) {
- $repx = false;
- $repy = false;
- return array(
- $cw,
- $ch,
- $repx,
- $repy
- );
- }
- return array(
- $imw,
- $imh,
- $repx,
- $repy
- );
- }
- public function SetBackground(&$properties, &$maxwidth)
- {
- if (preg_match("/(-moz-)*(repeating-)*(linear|radial)-gradient/", $properties["BACKGROUND-IMAGE"])) {
- return array(
- "gradient" => $properties["BACKGROUND-IMAGE"]
- );
- }
- $file = $properties["BACKGROUND-IMAGE"];
- $sizesarray = $this->Image($file, 0, 0, 0, 0, "", "", false, false, false, false, true);
- if (isset($sizesarray["IMAGE_ID"])) {
- $image_id = $sizesarray["IMAGE_ID"];
- $orig_w = $sizesarray["WIDTH"] * _MPDFK;
- $orig_h = $sizesarray["HEIGHT"] * _MPDFK;
- if (isset($properties["BACKGROUND-IMAGE-RESOLUTION"])) {
- if (preg_match("/from-image/i", $properties["BACKGROUND-IMAGE-RESOLUTION"]) && isset($sizesarray["set-dpi"]) && 0 < $sizesarray["set-dpi"]) {
- $orig_w *= $this->img_dpi / $sizesarray["set-dpi"];
- $orig_h *= $this->img_dpi / $sizesarray["set-dpi"];
- } else {
- if (preg_match("/(\\d+)dpi/i", $properties["BACKGROUND-IMAGE-RESOLUTION"], $m)) {
- $dpi = $m[1];
- if (0 < $dpi) {
- $orig_w *= $this->img_dpi / $dpi;
- $orig_h *= $this->img_dpi / $dpi;
- }
- }
- }
- }
- $x_repeat = true;
- $y_repeat = true;
- if (isset($properties["BACKGROUND-REPEAT"])) {
- if ($properties["BACKGROUND-REPEAT"] == "no-repeat" || $properties["BACKGROUND-REPEAT"] == "repeat-x") {
- $y_repeat = false;
- }
- if ($properties["BACKGROUND-REPEAT"] == "no-repeat" || $properties["BACKGROUND-REPEAT"] == "repeat-y") {
- $x_repeat = false;
- }
- }
- $x_pos = 0;
- $y_pos = 0;
- if (isset($properties["BACKGROUND-POSITION"])) {
- $ppos = preg_split("/\\s+/", $properties["BACKGROUND-POSITION"]);
- list($x_pos, $y_pos) = $ppos;
- if (!stristr($x_pos, "%")) {
- $x_pos = $this->ConvertSize($x_pos, $maxwidth, $this->FontSize);
- }
- if (!stristr($y_pos, "%")) {
- $y_pos = $this->ConvertSize($y_pos, $maxwidth, $this->FontSize);
- }
- }
- if (isset($properties["BACKGROUND-IMAGE-RESIZE"])) {
- $resize = $properties["BACKGROUND-IMAGE-RESIZE"];
- } else {
- $resize = 0;
- }
- if (isset($properties["BACKGROUND-IMAGE-OPACITY"])) {
- $opacity = $properties["BACKGROUND-IMAGE-OPACITY"];
- } else {
- $opacity = 1;
- }
- return array(
- "image_id" => $image_id,
- "orig_w" => $orig_w,
- "orig_h" => $orig_h,
- "x_pos" => $x_pos,
- "y_pos" => $y_pos,
- "x_repeat" => $x_repeat,
- "y_repeat" => $y_repeat,
- "resize" => $resize,
- "opacity" => $opacity,
- "itype" => $sizesarray["itype"]
- );
- }
- return false;
- }
- public function PrintBodyBackgrounds()
- {
- $s = "";
- $clx = 0;
- $cly = 0;
- $clw = $this->w;
- $clh = $this->h;
- if ($this->pageDim[$this->page]["outer_width_LR"] || $this->pageDim[$this->page]["outer_width_TB"]) {
- $clx = $this->pageDim[$this->page]["outer_width_LR"] - $this->pageDim[$this->page]["bleedMargin"];
- $cly = $this->pageDim[$this->page]["outer_width_TB"] - $this->pageDim[$this->page]["bleedMargin"];
- $clw = $this->w - 2 * $clx;
- $clh = $this->h - 2 * $cly;
- }
- if ($this->bodyBackgroundColor) {
- $s .= "q " . $this->SetFColor($this->bodyBackgroundColor, true) . "\n";
- if ($this->bodyBackgroundColor[0] == 5) {
- $s .= $this->SetAlpha(ord($this->bodyBackgroundColor[4]) / 100, "Normal", true, "F") . "\n";
- } else {
- if ($this->bodyBackgroundColor[0] == 6) {
- $s .= $this->SetAlpha(ord($this->bodyBackgroundColor[5]) / 100, "Normal", true, "F") . "\n";
- }
- }
- $s .= sprintf("%.3F %.3F %.3F %.3F re f Q", $clx * _MPDFK, $cly * _MPDFK, $clw * _MPDFK, $clh * _MPDFK) . "\n";
- }
- if ($this->bodyBackgroundGradient) {
- $g = $this->grad->parseBackgroundGradient($this->bodyBackgroundGradient);
- if ($g) {
- $s .= $this->grad->Gradient($clx, $cly, $clw, $clh, (isset($g["gradtype"]) ? $g["gradtype"] : NULL), $g["stops"], $g["colorspace"], $g["coords"], $g["extend"], true);
- }
- }
- if ($this->bodyBackgroundImage) {
- if ($this->bodyBackgroundImage["gradient"] && preg_match("/(-moz-)*(repeating-)*(linear|radial)-gradient/", $this->bodyBackgroundImage["gradient"])) {
- $g = $this->grad->parseMozGradient($this->bodyBackgroundImage["gradient"]);
- if ($g) {
- $s .= $this->grad->Gradient($clx, $cly, $clw, $clh, $g["type"], $g["stops"], $g["colorspace"], $g["coords"], $g["extend"], true);
- }
- } else {
- if ($this->bodyBackgroundImage["image_id"]) {
- $n = count($this->patterns) + 1;
- list($orig_w, $orig_h, $x_repeat, $y_repeat) = $this->_resizeBackgroundImage($this->bodyBackgroundImage["orig_w"], $this->bodyBackgroundImage["orig_h"], $clw, $clh, $this->bodyBackgroundImage["resize"], $this->bodyBackgroundImage["x_repeat"], $this->bodyBackgroundImage["y_repeat"]);
- $this->patterns[$n] = array(
- "x" => $clx,
- "y" => $cly,
- "w" => $clw,
- "h" => $clh,
- "pgh" => $this->h,
- "image_id" => $this->bodyBackgroundImage["image_id"],
- "orig_w" => $orig_w,
- "orig_h" => $orig_h,
- "x_pos" => $this->bodyBackgroundImage["x_pos"],
- "y_pos" => $this->bodyBackgroundImage["y_pos"],
- "x_repeat" => $x_repeat,
- "y_repeat" => $y_repeat,
- "itype" => $this->bodyBackgroundImage["itype"]
- );
- if ((0 < $this->bodyBackgroundImage["opacity"] || $this->bodyBackgroundImage["opacity"] === "0") && $this->bodyBackgroundImage["opacity"] < 1) {
- $opac = $this->SetAlpha($this->bodyBackgroundImage["opacity"], "Normal", true);
- } else {
- $opac = "";
- }
- $s .= sprintf("q /Pattern cs /P%d scn %s %.3F %.3F %.3F %.3F re f Q", $n, $opac, $clx * _MPDFK, $cly * _MPDFK, $clw * _MPDFK, $clh * _MPDFK) . "\n";
- }
- }
- }
- return $s;
- }
- public function PrintPageBackgrounds($adjustmenty = 0)
- {
- $s = "";
- ksort($this->pageBackgrounds);
- foreach ($this->pageBackgrounds as $bl => $pbs) {
- foreach ($pbs as $pb) {
- if (!isset($pb["image_id"]) && !isset($pb["gradient"]) || isset($pb["shadowonly"])) {
- if ($pb["visibility"] != "visible") {
- if ($pb["visibility"] == "printonly") {
- $s .= "/OC /OC1 BDC" . "\n";
- } else {
- if ($pb["visibility"] == "screenonly") {
- $s .= "/OC /OC2 BDC" . "\n";
- } else {
- if ($pb["visibility"] == "hidden") {
- $s .= "/OC /OC3 BDC" . "\n";
- }
- }
- }
- }
- if (isset($pb["shadow"]) && $pb["shadow"]) {
- $s .= $pb["shadow"] . "\n";
- }
- if (isset($pb["clippath"]) && $pb["clippath"]) {
- $s .= $pb["clippath"] . "\n";
- }
- $s .= "q " . $this->SetFColor($pb["col"], true) . "\n";
- if ($pb["col"][0] == 5) {
- $s .= $this->SetAlpha(ord($pb["col"][4]) / 100, "Normal", true, "F") . "\n";
- } else {
- if ($pb["col"][0] == 6) {
- $s .= $this->SetAlpha(ord($pb["col"][5]) / 100, "Normal", true, "F") . "\n";
- }
- }
- $s .= sprintf("%.3F %.3F %.3F %.3F re f Q", $pb["x"] * _MPDFK, ($this->h - $pb["y"]) * _MPDFK, $pb["w"] * _MPDFK, (0 - $pb["h"]) * _MPDFK) . "\n";
- if (isset($pb["clippath"]) && $pb["clippath"]) {
- $s .= "Q" . "\n";
- }
- if ($pb["visibility"] != "visible") {
- $s .= "EMC" . "\n";
- }
- }
- }
- foreach ($pbs as $pb) {
- if ($pb["visibility"] != "visible") {
- if ($pb["visibility"] == "printonly") {
- $s .= "/OC /OC1 BDC" . "\n";
- } else {
- if ($pb["visibility"] == "screenonly") {
- $s .= "/OC /OC2 BDC" . "\n";
- } else {
- if ($pb["visibility"] == "hidden") {
- $s .= "/OC /OC3 BDC" . "\n";
- }
- }
- }
- }
- if (isset($pb["gradient"]) && $pb["gradient"]) {
- if (isset($pb["clippath"]) && $pb["clippath"]) {
- $s .= $pb["clippath"] . "\n";
- }
- $s .= $this->grad->Gradient($pb["x"], $pb["y"], $pb["w"], $pb["h"], $pb["gradtype"], $pb["stops"], $pb["colorspace"], $pb["coords"], $pb["extend"], true);
- if (isset($pb["clippath"]) && $pb["clippath"]) {
- $s .= "Q" . "\n";
- }
- } else {
- if (isset($pb["image_id"]) && $pb["image_id"]) {
- $pb["y"] -= $adjustmenty;
- $pb["h"] += $adjustmenty;
- $n = count($this->patterns) + 1;
- list($orig_w, $orig_h, $x_repeat, $y_repeat) = $this->_resizeBackgroundImage($pb["orig_w"], $pb["orig_h"], $pb["w"], $pb["h"], $pb["resize"], $pb["x_repeat"], $pb["y_repeat"]);
- $this->patterns[$n] = array(
- "x" => $pb["x"],
- "y" => $pb["y"],
- "w" => $pb["w"],
- "h" => $pb["h"],
- "pgh" => $this->h,
- "image_id" => $pb["image_id"],
- "orig_w" => $orig_w,
- "orig_h" => $orig_h,
- "x_pos" => $pb["x_pos"],
- "y_pos" => $pb["y_pos"],
- "x_repeat" => $x_repeat,
- "y_repeat" => $y_repeat,
- "itype" => $pb["itype"]
- );
- $x = $pb["x"] * _MPDFK;
- $y = ($this->h - $pb["y"]) * _MPDFK;
- $w = $pb["w"] * _MPDFK;
- $h = (0 - $pb["h"]) * _MPDFK;
- if (isset($pb["clippath"]) && $pb["clippath"]) {
- $s .= $pb["clippath"] . "\n";
- }
- if ($this->writingHTMLfooter || $this->writingHTMLheader) {
- $iw = $pb["orig_w"] / _MPDFK;
- $ih = $pb["orig_h"] / _MPDFK;
- $w = $pb["w"];
- $h = $pb["h"];
- $x0 = $pb["x"];
- $y0 = $pb["y"];
- if ($pb["x_repeat"]) {
- $nx = ceil($w / $iw);
- } else {
- $nx = 1;
- }
- if ($pb["y_repeat"]) {
- $ny = ceil($h / $ih);
- } else {
- $ny = 1;
- }
- $x_pos = $pb["x_pos"];
- if (stristr($x_pos, "%")) {
- $x_pos += 0;
- $x_pos /= 100;
- $x_pos = $w * $x_pos - $iw * $x_pos;
- }
- $y_pos = $pb["y_pos"];
- if (stristr($y_pos, "%")) {
- $y_pos += 0;
- $y_pos /= 100;
- $y_pos = $h * $y_pos - $ih * $y_pos;
- }
- if (1 < $nx) {
- while (0 < $x_pos) {
- $x_pos -= $iw;
- }
- }
- if (1 < $ny) {
- while (0 < $y_pos) {
- $y_pos -= $ih;
- }
- }
- for ($xi = 0; $xi < $nx; $xi++) {
- for ($yi = 0; $yi < $ny; $yi++) {
- $x = $x0 + $x_pos + $iw * $xi;
- $y = $y0 + $y_pos + $ih * $yi;
- if (0 < $pb["opacity"] && $pb["opacity"] < 1) {
- $opac = $this->SetAlpha($pb["opacity"], "Normal", true);
- } else {
- $opac = "";
- }
- $s .= sprintf("q %s %.3F 0 0 %.3F %.3F %.3F cm /I%d Do Q", $opac, $iw * _MPDFK, $ih * _MPDFK, $x * _MPDFK, ($this->h - ($y + $ih)) * _MPDFK, $pb["image_id"]) . "\n";
- }
- }
- } else {
- if ((0 < $pb["opacity"] || $pb["opacity"] === "0") && $pb["opacity"] < 1) {
- $opac = $this->SetAlpha($pb["opacity"], "Normal", true);
- } else {
- $opac = "";
- }
- $s .= sprintf("q /Pattern cs /P%d scn %s %.3F %.3F %.3F %.3F re f Q", $n, $opac, $x, $y, $w, $h) . "\n";
- }
- if (isset($pb["clippath"]) && $pb["clippath"]) {
- $s .= "Q" . "\n";
- }
- }
- }
- if ($pb["visibility"] != "visible") {
- $s .= "EMC" . "\n";
- }
- }
- }
- return $s;
- }
- public function PrintTableBackgrounds($adjustmenty = 0)
- {
- $s = "";
- ksort($this->tableBackgrounds);
- foreach ($this->tableBackgrounds as $bl => $pbs) {
- foreach ($pbs as $pb) {
- if ((!isset($pb["gradient"]) || !$pb["gradient"]) && (!isset($pb["image_id"]) || !$pb["image_id"])) {
- $s .= "q " . $this->SetFColor($pb["col"], true) . "\n";
- if ($pb["col"][0] == 5) {
- $s .= $this->SetAlpha(ord($pb["col"][4]) / 100, "Normal", true, "F") . "\n";
- } else {
- if ($pb["col"][0] == 6) {
- $s .= $this->SetAlpha(ord($pb["col"][5]) / 100, "Normal", true, "F") . "\n";
- }
- }
- $s .= sprintf("%.3F %.3F %.3F %.3F re %s Q", $pb["x"] * _MPDFK, ($this->h - $pb["y"]) * _MPDFK, $pb["w"] * _MPDFK, (0 - $pb["h"]) * _MPDFK, "f") . "\n";
- }
- if (isset($pb["gradient"]) && $pb["gradient"]) {
- if (isset($pb["clippath"]) && $pb["clippath"]) {
- $s .= $pb["clippath"] . "\n";
- }
- $s .= $this->grad->Gradient($pb["x"], $pb["y"], $pb["w"], $pb["h"], $pb["gradtype"], $pb["stops"], $pb["colorspace"], $pb["coords"], $pb["extend"], true);
- if (isset($pb["clippath"]) && $pb["clippath"]) {
- $s .= "Q" . "\n";
- }
- }
- if (isset($pb["image_id"]) && $pb["image_id"]) {
- $pb["y"] -= $adjustmenty;
- $pb["h"] += $adjustmenty;
- $n = count($this->patterns) + 1;
- list($orig_w, $orig_h, $x_repeat, $y_repeat) = $this->_resizeBackgroundImage($pb["orig_w"], $pb["orig_h"], $pb["w"], $pb["h"], $pb["resize"], $pb["x_repeat"], $pb["y_repeat"]);
- $this->patterns[$n] = array(
- "x" => $pb["x"],
- "y" => $pb["y"],
- "w" => $pb["w"],
- "h" => $pb["h"],
- "pgh" => $this->h,
- "image_id" => $pb["image_id"],
- "orig_w" => $orig_w,
- "orig_h" => $orig_h,
- "x_pos" => $pb["x_pos"],
- "y_pos" => $pb["y_pos"],
- "x_repeat" => $x_repeat,
- "y_repeat" => $y_repeat,
- "itype" => $pb["itype"]
- );
- $x = $pb["x"] * _MPDFK;
- $y = ($this->h - $pb["y"]) * _MPDFK;
- $w = $pb["w"] * _MPDFK;
- $h = (0 - $pb["h"]) * _MPDFK;
- if (isset($pb["clippath"]) && $pb["clippath"]) {
- $s .= $pb["clippath"] . "\n";
- }
- if (0 < $pb["opacity"] && $pb["opacity"] < 1) {
- $opac = $this->SetAlpha($pb["opacity"], "Normal", true);
- } else {
- $opac = "";
- }
- $s .= sprintf("q /Pattern cs /P%d scn %s %.3F %.3F %.3F %.3F re f Q", $n, $opac, $x, $y, $w, $h) . "\n";
- if (isset($pb["clippath"]) && $pb["clippath"]) {
- $s .= "Q" . "\n";
- }
- }
- }
- }
- return $s;
- }
- public function AddPages($orientation = "", $condition = "", $resetpagenum = "", $pagenumstyle = "", $suppress = "", $mgl = "", $mgr = "", $mgt = "", $mgb = "", $mgh = "", $mgf = "", $ohname = "", $ehname = "", $ofname = "", $efname = "", $ohvalue = 0, $ehvalue = 0, $ofvalue = 0, $efvalue = 0, $pagesel = "", $newformat = "")
- {
- $this->AddPage($orientation, $condition, $resetpagenum, $pagenumstyle, $suppress, $mgl, $mgr, $mgt, $mgb, $mgh, $mgf, $ohname, $ehname, $ofname, $efname, $ohvalue, $ehvalue, $ofvalue, $efvalue, $pagesel, $newformat);
- }
- public function AddPageByArray($a)
- {
- if (!is_array($a)) {
- $a = array();
- }
- $orientation = (isset($a["orientation"]) ? $a["orientation"] : "");
- $condition = (isset($a["condition"]) ? $a["condition"] : (isset($a["type"]) ? $a["type"] : ""));
- $resetpagenum = (isset($a["resetpagenum"]) ? $a["resetpagenum"] : "");
- $pagenumstyle = (isset($a["pagenumstyle"]) ? $a["pagenumstyle"] : "");
- $suppress = (isset($a["suppress"]) ? $a["suppress"] : "");
- $mgl = (isset($a["mgl"]) ? $a["mgl"] : (isset($a["margin-left"]) ? $a["margin-left"] : ""));
- $mgr = (isset($a["mgr"]) ? $a["mgr"] : (isset($a["margin-right"]) ? $a["margin-right"] : ""));
- $mgt = (isset($a["mgt"]) ? $a["mgt"] : (isset($a["margin-top"]) ? $a["margin-top"] : ""));
- $mgb = (isset($a["mgb"]) ? $a["mgb"] : (isset($a["margin-bottom"]) ? $a["margin-bottom"] : ""));
- $mgh = (isset($a["mgh"]) ? $a["mgh"] : (isset($a["margin-header"]) ? $a["margin-header"] : ""));
- $mgf = (isset($a["mgf"]) ? $a["mgf"] : (isset($a["margin-footer"]) ? $a["margin-footer"] : ""));
- $ohname = (isset($a["ohname"]) ? $a["ohname"] : (isset($a["odd-header-name"]) ? $a["odd-header-name"] : ""));
- $ehname = (isset($a["ehname"]) ? $a["ehname"] : (isset($a["even-header-name"]) ? $a["even-header-name"] : ""));
- $ofname = (isset($a["ofname"]) ? $a["ofname"] : (isset($a["odd-footer-name"]) ? $a["odd-footer-name"] : ""));
- $efname = (isset($a["efname"]) ? $a["efname"] : (isset($a["even-footer-name"]) ? $a["even-footer-name"] : ""));
- $ohvalue = (isset($a["ohvalue"]) ? $a["ohvalue"] : (isset($a["odd-header-value"]) ? $a["odd-header-value"] : 0));
- $ehvalue = (isset($a["ehvalue"]) ? $a["ehvalue"] : (isset($a["even-header-value"]) ? $a["even-header-value"] : 0));
- $ofvalue = (isset($a["ofvalue"]) ? $a["ofvalue"] : (isset($a["odd-footer-value"]) ? $a["odd-footer-value"] : 0));
- $efvalue = (isset($a["efvalue"]) ? $a["efvalue"] : (isset($a["even-footer-value"]) ? $a["even-footer-value"] : 0));
- $pagesel = (isset($a["pagesel"]) ? $a["pagesel"] : (isset($a["pageselector"]) ? $a["pageselector"] : ""));
- $newformat = (isset($a["newformat"]) ? $a["newformat"] : (isset($a["sheet-size"]) ? $a["sheet-size"] : ""));
- $this->AddPage($orientation, $condition, $resetpagenum, $pagenumstyle, $suppress, $mgl, $mgr, $mgt, $mgb, $mgh, $mgf, $ohname, $ehname, $ofname, $efname, $ohvalue, $ehvalue, $ofvalue, $efvalue, $pagesel, $newformat);
- }
- public function AddPage($orientation = "", $condition = "", $resetpagenum = "", $pagenumstyle = "", $suppress = "", $mgl = "", $mgr = "", $mgt = "", $mgb = "", $mgh = "", $mgf = "", $ohname = "", $ehname = "", $ofname = "", $efname = "", $ohvalue = 0, $ehvalue = 0, $ofvalue = 0, $efvalue = 0, $pagesel = "", $newformat = "")
- {
- if (0 < $this->state && $this->page < count($this->pages)) {
- $bak_cml = $this->cMarginL;
- $bak_cmr = $this->cMarginR;
- $bak_dw = $this->divwidth;
- if (0 < $this->blklvl) {
- $save_tr = $this->table_rotate;
- $this->table_rotate = 0;
- if ($this->y == $this->blk[$this->blklvl]["y0"]) {
- $this->blk[$this->blklvl]["startpage"]++;
- }
- if ($this->blk[$this->blklvl]["y0"] < $this->y || $this->flowingBlockAttr["is_table"]) {
- $toplvl = $this->blklvl;
- } else {
- $toplvl = $this->blklvl - 1;
- }
- $sy = $this->y;
- for ($bl = 1; $bl <= $toplvl; $bl++) {
- $this->PaintDivBB("pagebottom", 0, $bl);
- }
- $this->y = $sy;
- $this->table_rotate = $save_tr;
- }
- $s = $this->PrintPageBackgrounds();
- $this->pages[$this->page] = preg_replace("/(___BACKGROUND___PATTERNS" . date("jY") . ")/", "\\1" . "\n" . $s . "\n", $this->pages[$this->page]);
- $this->pageBackgrounds = array();
- $family = $this->FontFamily;
- $style = $this->FontStyle . (($this->U ? "U" : "")) . (($this->S ? "S" : ""));
- $size = $this->FontSizePt;
- $lw = $this->LineWidth;
- $dc = $this->DrawColor;
- $fc = $this->FillColor;
- $tc = $this->TextColor;
- $cf = $this->ColorFlag;
- $this->printfloatbuffer();
- $this->page++;
- $this->ResetMargins();
- $this->SetAutoPageBreak($this->autoPageBreak, $this->bMargin);
- $this->x = $this->lMargin;
- $this->y = $this->tMargin;
- $this->FontFamily = "";
- $this->_out("2 J");
- $this->LineWidth = $lw;
- $this->_out(sprintf("%.3F w", $lw * _MPDFK));
- if ($family) {
- $this->SetFont($family, $style, $size, true, true);
- }
- $this->DrawColor = $dc;
- if ($dc != $this->defDrawColor) {
- $this->_out($dc);
- }
- $this->FillColor = $fc;
- if ($fc != $this->defFillColor) {
- $this->_out($fc);
- }
- $this->TextColor = $tc;
- $this->ColorFlag = $cf;
- for ($bl = 1; $bl <= $this->blklvl; $bl++) {
- $this->blk[$bl]["y0"] = $this->y;
- if (!isset($this->blk[$bl]["marginCorrected"][$this->page])) {
- $this->blk[$bl]["x0"] += $this->MarginCorrection;
- }
- $this->blk[$bl]["marginCorrected"][$this->page] = true;
- }
- $this->cMarginL = $bak_cml;
- $this->cMarginR = $bak_cmr;
- $this->divwidth = $bak_dw;
- return "";
- }
- if ($this->state == 0) {
- $this->Open();
- }
- $bak_cml = $this->cMarginL;
- $bak_cmr = $this->cMarginR;
- $bak_dw = $this->divwidth;
- $bak_lh = $this->lineheight;
- $orientation = substr(strtoupper($orientation), 0, 1);
- $condition = strtoupper($condition);
- if ($condition == "NEXT-EVEN") {
- if (!$this->mirrorMargins) {
- $condition = "";
- } else {
- if ($pagesel) {
- $pbch = $pagesel;
- $pagesel = "";
- } else {
- $pbch = false;
- }
- $this->AddPage($this->CurOrientation, "O");
- if ($pbch) {
- $pagesel = $pbch;
- }
- $condition = "";
- }
- }
- if ($condition == "NEXT-ODD") {
- if (!$this->mirrorMargins) {
- $condition = "";
- } else {
- if ($pagesel) {
- $pbch = $pagesel;
- $pagesel = "";
- } else {
- $pbch = false;
- }
- $this->AddPage($this->CurOrientation, "E");
- if ($pbch) {
- $pagesel = $pbch;
- }
- $condition = "";
- }
- }
- if ($condition == "E" && (!$this->mirrorMargins || $this->page % 2 == 0)) {
- return false;
- }
- if ($condition == "O" && (!$this->mirrorMargins || $this->page % 2 == 1)) {
- return false;
- }
- if ($resetpagenum || $pagenumstyle || $suppress) {
- $this->PageNumSubstitutions[] = array(
- "from" => $this->page + 1,
- "reset" => $resetpagenum,
- "type" => $pagenumstyle,
- "suppress" => $suppress
- );
- }
- $save_tr = $this->table_rotate;
- $this->table_rotate = 0;
- $save_kwt = $this->kwt;
- $this->kwt = 0;
- if (!$this->ColActive && 0 < $this->blklvl) {
- if (isset($this->blk[$this->blklvl]["y0"]) && $this->y == $this->blk[$this->blklvl]["y0"]) {
- if (isset($this->blk[$this->blklvl]["startpage"])) {
- $this->blk[$this->blklvl]["startpage"]++;
- } else {
- $this->blk[$this->blklvl]["startpage"] = 1;
- }
- }
- if (isset($this->blk[$this->blklvl]["y0"]) && $this->blk[$this->blklvl]["y0"] < $this->y || $this->flowingBlockAttr["is_table"]) {
- $toplvl = $this->blklvl;
- } else {
- $toplvl = $this->blklvl - 1;
- }
- $sy = $this->y;
- for ($bl = 1; $bl <= $toplvl; $bl++) {
- $this->PaintDivBB("pagebottom", 0, $bl);
- }
- $this->y = $sy;
- }
- if (0 < $this->page) {
- $s = "";
- $s .= $this->PrintBodyBackgrounds();
- $s .= $this->PrintPageBackgrounds();
- $this->pages[$this->page] = preg_replace("/(___BACKGROUND___PATTERNS" . date("jY") . ")/", "\n" . $s . "\n" . "\\1", $this->pages[$this->page]);
- $this->pageBackgrounds = array();
- }
- $save_kt = $this->keep_block_together;
- $this->keep_block_together = 0;
- $save_cols = false;
- if ($this->ColActive) {
- $save_cols = true;
- $save_nbcol = $this->NbCol;
- $this->SetColumns(0);
- }
- $save_vis = $this->visibility;
- if ($this->visibility != "visible") {
- $this->SetVisibility("visible");
- }
- $family = $this->FontFamily;
- $style = $this->FontStyle . (($this->U ? "U" : "")) . (($this->S ? "S" : ""));
- $size = $this->FontSizePt;
- $this->ColumnAdjust = true;
- $lw = $this->LineWidth;
- $dc = $this->DrawColor;
- $fc = $this->FillColor;
- $tc = $this->TextColor;
- $cf = $this->ColorFlag;
- if (0 < $this->page) {
- $this->InFooter = true;
- $this->Reset();
- $this->pageoutput[$this->page] = array();
- $this->Footer();
- $this->_endpage();
- }
- $this->_beginpage($orientation, $mgl, $mgr, $mgt, $mgb, $mgh, $mgf, $ohname, $ehname, $ofname, $efname, $ohvalue, $ehvalue, $ofvalue, $efvalue, $pagesel, $newformat);
- if ($this->docTemplate) {
- $pagecount = $this->SetSourceFile($this->docTemplate);
- if ($pagecount < $this->page - $this->docTemplateStart) {
- if ($this->docTemplateContinue) {
- $tplIdx = $this->ImportPage($pagecount);
- $this->UseTemplate($tplIdx);
- }
- } else {
- $tplIdx = $this->ImportPage($this->page - $this->docTemplateStart);
- $this->UseTemplate($tplIdx);
- }
- }
- if ($this->pageTemplate) {
- $this->UseTemplate($this->pageTemplate);
- }
- $this->_out("___PAGE___START" . date("jY"));
- $this->_out("___BACKGROUND___PATTERNS" . date("jY"));
- $this->_out("___HEADER___MARKER" . date("jY"));
- $this->pageBackgrounds = array();
- $this->SetLineCap(2);
- $this->LineWidth = $lw;
- $this->_out(sprintf("%.3F w", $lw * _MPDFK));
- if ($family) {
- $this->SetFont($family, $style, $size, true, true);
- }
- $this->DrawColor = $dc;
- if ($dc != $this->defDrawColor) {
- $this->_out($dc);
- }
- $this->FillColor = $fc;
- if ($fc != $this->defFillColor) {
- $this->_out($fc);
- }
- $this->TextColor = $tc;
- $this->ColorFlag = $cf;
- $this->Header();
- if ($this->LineWidth != $lw) {
- $this->LineWidth = $lw;
- $this->_out(sprintf("%.3F w", $lw * _MPDFK));
- }
- if ($family) {
- $this->SetFont($family, $style, $size, true, true);
- }
- if ($this->DrawColor != $dc) {
- $this->DrawColor = $dc;
- $this->_out($dc);
- }
- if ($this->FillColor != $fc) {
- $this->FillColor = $fc;
- $this->_out($fc);
- }
- $this->TextColor = $tc;
- $this->ColorFlag = $cf;
- $this->InFooter = false;
- if ($save_vis != "visible") {
- $this->SetVisibility($save_vis);
- }
- if ($save_cols) {
- $this->SetColumns($save_nbcol, $this->colvAlign, $this->ColGap);
- }
- if ($this->ColActive) {
- $this->SetCol(0);
- }
- if (!$this->ColActive) {
- for ($bl = 1; $bl <= $this->blklvl; $bl++) {
- $this->blk[$bl]["y0"] = $this->y;
- if (isset($this->blk[$bl]["x0"])) {
- $this->blk[$bl]["x0"] += $this->MarginCorrection;
- } else {
- $this->blk[$bl]["x0"] = $this->MarginCorrection;
- }
- $this->blk[$bl]["marginCorrected"][$this->page] = true;
- }
- }
- $this->table_rotate = $save_tr;
- $this->kwt = $save_kwt;
- $this->keep_block_together = $save_kt;
- $this->cMarginL = $bak_cml;
- $this->cMarginR = $bak_cmr;
- $this->divwidth = $bak_dw;
- $this->lineheight = $bak_lh;
- }
- public function PageNo()
- {
- return $this->page;
- }
- public function AddSpotColorsFromFile($file)
- {
- $colors = @file($file) or exit("Cannot load spot colors file - " . $file);
- foreach ($colors as $sc) {
- list($name, $c, $m, $y, $k) = preg_split("/\t/", $sc);
- $c = intval($c);
- $m = intval($m);
- $y = intval($y);
- $k = intval($k);
- $this->AddSpotColor($name, $c, $m, $y, $k);
- }
- }
- public function AddSpotColor($name, $c, $m, $y, $k)
- {
- $name = strtoupper(trim($name));
- if (!isset($this->spotColors[$name])) {
- $i = count($this->spotColors) + 1;
- $this->spotColors[$name] = array(
- "i" => $i,
- "c" => $c,
- "m" => $m,
- "y" => $y,
- "k" => $k
- );
- $this->spotColorIDs[$i] = $name;
- }
- }
- public function SetColor($col, $type = "")
- {
- $out = "";
- if ($col[0] == 3 || $col[0] == 5) {
- $out = sprintf("%.3F %.3F %.3F rg", ord($col[1]) / 255, ord($col[2]) / 255, ord($col[3]) / 255);
- } else {
- if ($col[0] == 1) {
- $out = sprintf("%.3F g", ord($col[1]) / 255);
- } else {
- if ($col[0] == 2) {
- $out = sprintf("/CS%d cs %.3F scn", ord($col[1]), ord($col[2]) / 100);
- } else {
- if ($col[0] == 4 || $col[0] == 6) {
- $out = sprintf("%.3F %.3F %.3F %.3F k", ord($col[1]) / 100, ord($col[2]) / 100, ord($col[3]) / 100, ord($col[4]) / 100);
- }
- }
- }
- }
- if ($type == "Draw") {
- $out = strtoupper($out);
- } else {
- if ($type == "CodeOnly") {
- $out = preg_replace("/\\s(rg|g|k)/", "", $out);
- }
- }
- return $out;
- }
- public function SetDColor($col, $return = false)
- {
- $out = $this->SetColor($col, "Draw");
- if ($return) {
- return $out;
- }
- if ($out == "") {
- return "";
- }
- $this->DrawColor = $out;
- if (0 < $this->page && (isset($this->pageoutput[$this->page]["DrawColor"]) && $this->pageoutput[$this->page]["DrawColor"] != $this->DrawColor || !isset($this->pageoutput[$this->page]["DrawColor"]) || $this->keep_block_together)) {
- $this->_out($this->DrawColor);
- }
- $this->pageoutput[$this->page]["DrawColor"] = $this->DrawColor;
- }
- public function SetFColor($col, $return = false)
- {
- $out = $this->SetColor($col, "Fill");
- if ($return) {
- return $out;
- }
- if ($out == "") {
- return "";
- }
- $this->FillColor = $out;
- $this->ColorFlag = $out != $this->TextColor;
- if (0 < $this->page && (isset($this->pageoutput[$this->page]["FillColor"]) && $this->pageoutput[$this->page]["FillColor"] != $this->FillColor || !isset($this->pageoutput[$this->page]["FillColor"]) || $this->keep_block_together)) {
- $this->_out($this->FillColor);
- }
- $this->pageoutput[$this->page]["FillColor"] = $this->FillColor;
- }
- public function SetTColor($col, $return = false)
- {
- $out = $this->SetColor($col, "Text");
- if ($return) {
- return $out;
- }
- if ($out == "") {
- return "";
- }
- $this->TextColor = $out;
- $this->ColorFlag = $this->FillColor != $out;
- }
- public function SetDrawColor($r, $g = -1, $b = -1, $col4 = -1, $return = false)
- {
- $col = array();
- if ($r == 0 && $g == 0 && $b == 0 && $col4 == -1 || $g == -1) {
- $col = $this->ConvertColor($r);
- } else {
- if ($col4 == -1) {
- $col = $this->ConvertColor("rgb(" . $r . "," . $g . "," . $b . ")");
- } else {
- $col = $this->ConvertColor("cmyk(" . $r . "," . $g . "," . $b . "," . $col4 . ")");
- }
- }
- $out = $this->SetDColor($col, $return);
- return $out;
- }
- public function SetFillColor($r, $g = -1, $b = -1, $col4 = -1, $return = false)
- {
- $col = array();
- if ($r == 0 && $g == 0 && $b == 0 && $col4 == -1 || $g == -1) {
- $col = $this->ConvertColor($r);
- } else {
- if ($col4 == -1) {
- $col = $this->ConvertColor("rgb(" . $r . "," . $g . "," . $b . ")");
- } else {
- $col = $this->ConvertColor("cmyk(" . $r . "," . $g . "," . $b . "," . $col4 . ")");
- }
- }
- $out = $this->SetFColor($col, $return);
- return $out;
- }
- public function SetTextColor($r, $g = -1, $b = -1, $col4 = -1, $return = false)
- {
- $col = array();
- if ($r == 0 && $g == 0 && $b == 0 && $col4 == -1 || $g == -1) {
- $col = $this->ConvertColor($r);
- } else {
- if ($col4 == -1) {
- $col = $this->ConvertColor("rgb(" . $r . "," . $g . "," . $b . ")");
- } else {
- $col = $this->ConvertColor("cmyk(" . $r . "," . $g . "," . $b . "," . $col4 . ")");
- }
- }
- $out = $this->SetTColor($col, $return);
- return $out;
- }
- public function _getCharWidth(&$cw, $u, $isdef = true)
- {
- if ($u == 0) {
- $w = false;
- } else {
- $w = (ord($cw[$u * 2]) << 8) + ord($cw[$u * 2 + 1]);
- }
- if ($w == 65535) {
- return 0;
- }
- if ($w) {
- return $w;
- }
- if ($isdef) {
- return false;
- }
- return 0;
- }
- public function _charDefined(&$cw, $u)
- {
- if ($u == 0) {
- return false;
- }
- $w = (ord($cw[$u * 2]) << 8) + ord($cw[$u * 2 + 1]);
- if ($w) {
- return true;
- }
- return false;
- }
- public function GetCharWidthCore($c)
- {
- $c = (string) $c;
- $w = 0;
- if ($c == chr(173) && $this->FontFamily != "csymbol" && $this->FontFamily != "czapfdingbats") {
- return 0;
- }
- if ($this->S && isset($this->upperCase[ord($c)])) {
- $charw = $this->CurrentFont["cw"][chr($this->upperCase[ord($c)])];
- if ($charw !== false) {
- $charw = ($charw * $this->smCapsScale * $this->smCapsStretch) / 100;
- $w += $charw;
- }
- } else {
- if (isset($this->CurrentFont["cw"][$c])) {
- $w += $this->CurrentFont["cw"][$c];
- } else {
- if (isset($this->CurrentFont["cw"][ord($c)])) {
- $w += $this->CurrentFont["cw"][ord($c)];
- }
- }
- }
- $w *= $this->FontSize / 1000;
- if ($this->minwSpacing || $this->fixedlSpacing) {
- if ($c == " ") {
- $nb_spaces = 1;
- } else {
- $nb_spaces = 0;
- }
- $w += $this->fixedlSpacing + $nb_spaces * $this->minwSpacing;
- }
- return $w;
- }
- public function GetCharWidthNonCore($c, $addSubset = true)
- {
- $c = (string) $c;
- $w = 0;
- $unicode = $this->UTF8StringToArray($c, $addSubset);
- $char = $unicode[0];
- if ($this->CurrentFont["type"] == "Type0") {
- if ($char == 173) {
- return 0;
- }
- if (isset($this->CurrentFont["cw"][$char])) {
- $w += $this->CurrentFont["cw"][$char];
- } else {
- if (isset($this->CurrentFont["MissingWidth"])) {
- $w += $this->CurrentFont["MissingWidth"];
- } else {
- $w += 500;
- }
- }
- } else {
- if ($char == 173) {
- ....................................................................
- .........................................
- ..............
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement