����JFIFXX�����    $.' ",#(7),01444'9=82<.342  2!!22222222222222222222222222222222222222222222222222����"��4�� ���,�PG"Z_�4�˷����kjز�Z�,F+��_z�,�© �����zh6�٨�ic�fu���#ډb���_�N�?��wQ���5-�~�I���8����TK<5o�Iv-�����k�_U_�����~b�M��d����Ӝ�U�Hh��?]��E�w��Q���k�{��_}qFW7HTՑ��Y��F�?_�'ϔ��_�Ջt��=||I ��6�έ"�����D���/[�k�9���Y�8ds|\���Ҿp6�Ҵ���]��.����6�z<�v��@]�i%��$j��~�g��J>��no����pM[me�i$[����s�o�ᘨ�˸ nɜG-�ĨU�ycP�3.DB�li�;��hj���x7Z^�N�h������N3u{�:j�x�힞��#M&��jL P@_���� P��&��o8������9�����@Sz6�t7#O�ߋ �s}Yf�T���lmr����Z)'N��k�۞p����w\�Tȯ?�8`�O��i{wﭹW�[�r�� ��Q4F�׊���3m&L�=��h3����z~��#�\�l :�F,j@�� ʱ�wQT����8�"kJO���6�֚l����}���R�>ډK���]��y����&����p�}b��;N�1�m�r$�|��7�>e�@B�TM*-iH��g�D�)� E�m�|�ؘbҗ�a��Ҿ����t4���o���G��*oCN�rP���Q��@z,|?W[0�����:�n,jWiE��W��$~/�hp\��?��{(�0���+�Y8rΟ�+����>S-S����VN;�}�s?.����� w�9��˟<���Mq4�Wv'��{)0�1mB��V����W[�����8�/<� �%���wT^�5���b��)iM� pg�N�&ݝ��VO~�q���u���9� ����!��J27����$O-���! �:�%H��� ـ����y�ΠM=t{!S�� oK8������t<����è:a������[�����ա�H���~��w��Qz`�po�^ ����Q��n� �,uu�C�$ ^���,������8�#��:�6��e�|~���!�3�3.�\0��q��o�4`.|� ����y�Q�`~;�d�ׯ,��O�Zw�������`73�v�܋�<���Ȏ�� ـ4k��5�K�a�u�=9Yd��$>x�A�&�� j0� ���vF��� Y�|�y��� ~�6�@c��1vOp�Ig����4��l�OD���L����� R���c���j�_�uX6��3?nk��Wy�f;^*B� ��@�~a�`��Eu������+���6�L��.ü>��}y���}_�O�6�͐�:�YrG�X��kG�����l^w���~㒶sy��Iu�!� W ��X��N�7BV��O��!X�2����wvG�R�f�T#�����t�/?���%8�^�W�aT��G�cL�M���I��(J����1~�8�?aT ���]����AS�E��(��*E}� 2��#I/�׍qz��^t�̔���b�Yz4x���t�){ OH��+(E��A&�N�������XT��o��"�XC��'���)}�J�z�p� ��~5�}�^����+�6����w��c��Q�|Lp�d�H��}�(�.|����k��c4^�"�����Z?ȕ ��a<�L�!039C� �Eu�C�F�Ew�ç ;�n?�*o���B�8�bʝ���'#Rqf���M}7����]����s2tcS{�\icTx;�\��7K���P���ʇ Z O-��~��c>"��?�������P��E��O�8��@�8��G��Q�g�a�Վ���󁶠�䧘��_%#r�>�1�z�a��eb��qcPѵ��n���#L��� =��׀t� L�7�`��V���A{�C:�g���e@�w1 Xp3�c3�ġ����p��M"'-�@n4���fG��B3�DJ�8[Jo�ߐ���gK)ƛ��$���� ���8�3�����+���� �����6�ʻ���� ���S�kI�*KZlT _`���?��K����QK�d����B`�s}�>���`��*�>��,*@J�d�oF*����弝��O}�k��s��]��y�ߘ��c1G�V���<=�7��7����6�q�PT��tXԀ�!9*4�4Tހ3XΛex�46���Y��D ����� �BdemDa����\�_l,��G�/���֌7���Y�](�xTt^%�GE�����4�}bT���ڹ�����;Y)���B�Q��u��>J/J �⮶.�XԄ��j�ݳ�+E��d ��r�5�_D�1 ��o�� �B�x�΢�#���<��W�����8���R6�@g�M�.��� dr�D��>(otU��@x=��~v���2� ӣ�d�oBd��3�eO�6�㣷�����ݜ6��6Y��Qz`��S��{���\P�~z m5{J/L��1������<�e�ͅPu�b�]�ϔ���'������f�b� Zpw��c`"��i���BD@:)ִ�:�]��hv�E�w���T�l��P���"Ju�}��وV J��G6��. J/�Qgl߭�e�����@�z�Zev2u�)]կ�����7x���s�M�-<ɯ�c��r�v�����@��$�ޮ}lk���a���'����>x��O\�ZFu>�����ck#��&:��`�$�ai�>2Δ����l���oF[h��lE�ܺ�Πk:)���`�� $[6�����9�����kOw�\|���8}������ބ:��񶐕��I�A1/�=�2[�,�!��.}gN#�u����b��� ~��݊��}34q����d�E��Lc��$��"�[q�U�硬g^��%B �z���r�pJ�ru%v\h1Y�ne`ǥ:g���pQM~�^�Xi� ��`S�:V29.�P���V�?B�k�� AEvw%�_�9C�Q����wKekPؠ�\�;Io d�{ ߞo�c1eP����\� `����E=���@K<�Y���eڼ�J���w����{av�F�'�M�@/J��+9p���|]�����Iw &`��8���&M�hg��[�{��Xj��%��Ӓ�$��(����ʹN���<>�I���RY���K2�NPlL�ɀ)��&e����B+ь����( � �JTx���_?EZ� }@ 6�U���뙢ط�z��dWI�n` D����噥�[��uV��"�G&Ú����2g�}&m��?ċ�"����Om#��������� ��{�ON��"S�X��Ne��ysQ���@Fn��Vg���dX�~nj�]J�<�K]:��FW��b�������62�=��5f����JKw��bf�X�55��~J �%^����:�-�QIE��P��v�nZum� z � ~ə ���� ���ة����;�f��\v���g�8�1��f24;�V���ǔ�)����9���1\��c��v�/'Ƞ�w�������$�4�R-��t���� e�6�/�ġ �̕Ecy�J���u�B���<�W�ַ~�w[B1L۲�-JS΂�{���΃������A��20�c#��@ 0!1@AP"#2Q`$3V�%45a6�FRUq��� ����^7ׅ,$n�������+��F�`��2X'��0vM��p�L=������5��8������u�p~���.�`r�����\���O��,ư�0oS ��_�M�����l���4�kv\JSd���x���SW�<��Ae�IX����������$I���w�:S���y���›R��9�Q[���,�5�;�@]�%���u�@ *ro�lbI �� ��+���%m:�͇ZV�����u�̉����θau<�fc�.����{�4Ա� �Q����*�Sm��8\ujqs]{kN���)qO�y�_*dJ�b�7���yQqI&9�ԌK!�M}�R�;������S�T���1���i[U�ɵz�]��U)V�S6���3$K{�ߊ<�(� E]Զ[ǼENg�����'�\?#)Dkf��J���o��v���'�%ƞ�&K�u�!��b�35LX�Ϸ��63$K�a�;�9>,R��W��3�3� d�JeTYE.Mϧ��-�o�j3+y��y^�c�������VO�9NV\nd�1 ��!͕_)a�v;����թ�M�lWR1��)El��P;��yوÏ�u 3�k�5Pr6<�⒲l�!˞*��u־�n�!�l:����UNW ��%��Chx8vL'��X�@��*��)���̮��ˍ��� ���D-M�+J�U�kvK����+�x8��cY������?�Ԡ��~3mo��|�u@[XeY�C�\Kp�x8�oC�C�&����N�~3-H���� ��MX�s�u<`���~"WL��$8ξ��3���a�)|:@�m�\���^�`�@ҷ)�5p+��6���p�%i)P M���ngc�����#0Aruz���RL+xSS?���ʮ}()#�t��mˇ!��0}}y����<�e� �-ή�Ԩ��X������ MF���ԙ~l L.3���}�V뽺�v�����멬��Nl�)�2����^�Iq��a��M��qG��T�����c3#������3U�Ǎ���}��לS�|qa��ڃ�+���-��2�f����/��bz��ڐ�� �ݼ[2�ç����k�X�2�* �Z�d���J�G����M*9W���s{��w���T��x��y,�in�O�v��]���n����P�$�JB@=4�OTI�n��e�22a\����q�d���%�$��(���:���: /*�K[PR�fr\nڙdN���F�n�$�4�[�� U�zƶ����� �mʋ���,�ao�u 3�z� �x��Kn����\[��VFmbE;�_U��&V�Gg�]L�۪&#n%�$ɯ�dG���D�TI=�%+AB�Ru#��b4�1�»x�cs�YzڙJG��f��Il��d�eF'T� iA��T���uC�$����Y��H?����[!G`}���ͪ� �纤Hv\������j�Ex�K���!���OiƸ�Yj�+u-<���'q����uN�*�r\��+�]���<�wOZ.fp�ێ��,-*)V?j-kÊ#�`�r��dV����(�ݽBk�����G�ƛk�QmUڗe��Z���f}|����8�8��a���i��3'J�����~G_�^���d�8w������ R�`(�~�.��u���l�s+g�bv���W���lGc}��u���afE~1�Ue������Z�0�8�=e�� f@/�jqEKQQ�J��oN��J���W5~M>$6�Lt�;$ʳ{���^��6�{����v6���ķܰg�V�cnn �~z�x�«�,2�u�?cE+Ș�H؎�%�Za�)���X>uW�Tz�Nyo����s���FQƤ��$��*�&�LLXL)�1�" L��eO��ɟ�9=���:t��Z���c��Ž���Y?�ӭV�wv�~,Y��r�ۗ�|�y��GaF�����C�����.�+� ���v1���fήJ�����]�S��T��B��n5sW}y�$��~z�'�c ��8 ��� ,! �p��VN�S��N�N�q��y8z˱�A��4��*��'������2n<�s���^ǧ˭P�Jޮɏ�U�G�L�J�*#��<�V��t7�8����TĜ>��i}K%,���)[��z�21z ?�N�i�n1?T�I�R#��m-�����������������1����lA�`��fT5+��ܐ�c�q՝��ʐ��,���3�f2U�եmab��#ŠdQ�y>\��)�SLY����w#��.���ʑ�f��� ,"+�w�~�N�'�c�O�3F�������N<���)j��&��,-� �љ���֊�_�zS���TǦ����w�>��?�������n��U仆�V���e�����0���$�C�d���rP �m�׈e�Xm�Vu� �L��.�bֹ��� �[Դaզ���*��\y�8�Է:�Ez\�0�Kq�C b��̘��cө���Q��=0Y��s�N��S.���3.���O�o:���#���v7�[#߫ ��5�܎�L���Er4���9n��COWlG�^��0k�%<���ZB���aB_���������'=��{i�v�l�$�uC���mƎҝ{�c㱼�y]���W�i ��ߧc��m�H� m�"�"�����;Y�ߝ�Z�Ǔ�����:S#��|}�y�,/k�Ld� TA�(�AI$+I3��;Y*���Z��}|��ӧO��d�v��..#:n��f>�>���ȶI�TX��� 8��y����"d�R�|�)0���=���n4��6ⲑ�+��r<�O�܂~zh�z����7ܓ�HH�Ga롏���nCo�>������a ���~]���R���̲c?�6(�q�;5%� |�uj�~z8R=X��I�V=�|{v�Gj\gc��q����z�؋%M�ߍ����1y��#��@f^���^�>N�����#x#۹��6�Y~�?�dfPO��{��P�4��V��u1E1J �*|���%���JN��`eWu�zk M6���q t[�� ��g�G���v��WIG��u_ft����5�j�"�Y�:T��ɐ���*�;� e5���4����q$C��2d�}���� _S�L#m�Yp��O�.�C�;��c����Hi#֩%+) �Ӎ��ƲV���SYź��g |���tj��3�8���r|���V��1#;.SQ�A[���S������#���`n�+���$��$I �P\[�@�s��(�ED�z���P��])8�G#��0B��[ى��X�II�q<��9�~[Z멜�Z�⊔IWU&A>�P~�#��dp<�?����7���c��'~���5 ��+$���lx@�M�dm��n<=e�dyX��?{�|Aef ,|n3�<~z�ƃ�uۧ�����P��Y,�ӥQ�*g�#먙R�\���;T��i,��[9Qi歉����c>]9�� ��"�c��P�� �Md?٥��If�ت�u��k��/����F��9�c*9��Ǎ:�ØF���z�n*�@|I�ށ9����N3{'��[�'ͬ�Ҳ4��#}��!�V� Fu��,�,mTIk���v C�7v���B�6k�T9��1�*l� '~��ƞF��lU��'�M ����][ΩũJ_�{�i�I�n��$���L�� j��O�dx�����kza۪��#�E��Cl����x˘�o�����V���ɞ�ljr��)�/,�߬h�L��#��^��L�ф�,íMƁe�̩�NB�L�����iL����q�}��(��q��6IçJ$�W�E$��:������=#����(�K�B����zђ <��K(�N�۫K�w��^O{!����)�H���>x�������lx�?>Պ�+�>�W���,Ly!_�D���Ō�l���Q�!�[ �S����J��1��Ɛ�Y}��b,+�Lo�x�ɓ)����=�y�oh�@�꥟/��I��ѭ=��P�y9��� �ۍYӘ�e+�p�Jnϱ?V\SO%�(�t� ���=?MR�[Ș�����d�/ ��n�l��B�7j� ��!�;ӥ�/�[-���A�>�dN�sLj ��,ɪv��=1c�.SQ�O3�U���ƀ�ܽ�E����������̻��9G�ϷD�7(�}��Ävӌ\�y�_0[w ���<΍>����a_��[0+�L��F.�޺��f�>oN�T����q;���y\��bՃ��y�jH�<|q-eɏ�_?_9+P���Hp$�����[ux�K w�Mw��N�ی'$Y2�=��q���KB��P��~������Yul:�[<����F1�2�O���5=d����]Y�sw:���Ϯ���E��j,_Q��X��z`H1,#II ��d�wr��P˂@�ZJV����y$�\y�{}��^~���[:N����ߌ�U�������O��d�����ؾe��${p>G��3c���Ė�lʌ�� ת��[��`ϱ�-W����dg�I��ig2��� ��}s ��ؤ(%#sS@���~���3�X�nRG�~\jc3�v��ӍL��M[JB�T��s3}��j�Nʖ��W����;7��ç?=X�F=-�=����q�ߚ���#���='�c��7���ڑW�I(O+=:uxq�������������e2�zi+�kuG�R��������0�&e�n���iT^J����~\jy���p'dtG��s����O��3����9* �b#Ɋ�� p������[Bws�T�>d4�ۧs���nv�n���U���_�~,�v����ƜJ1��s�� �QIz��)�(lv8M���U=�;����56��G���s#�K���MP�=��LvyGd��}�VwWBF�'�à �?MH�U�g2�� ����!�p�7Q��j��ڴ����=��j�u��� Jn�A s���uM������e��Ɔ�Ҕ�!)'��8Ϣ�ٔ��ޝ(��Vp���צ֖d=�IC�J�Ǡ{q������kԭ�߸���i��@K����u�|�p=..�*+����x�����z[Aqġ#s2a�Ɗ���RR�)*HRsi�~�a &f��M��P����-K�L@��Z��Xy�'x�{}��Zm+���:�)�) IJ�-i�u���� ���ܒH��'�L(7�y�GӜq���� j��� 6ߌg1�g�o���,kر���tY�?W,���p���e���f�OQS��!K�۟cҒA�|ս�j�>��=⬒��˧L[�� �߿2JaB~R��u�:��Q�] �0H~���]�7��Ƽ�I���(}��cq '�ήET���q�?f�ab���ӥvr� �)o��-Q��_'����ᴎo��K������;��V���o��%���~OK ����*��b�f:���-ťIR��`B�5!RB@���ï�� �u �̯e\�_U�_������� g�ES��3�������QT��a����x����U<~�c?�*�#]�MW,[8O�a�x��]�1bC|踤�P��lw5V%�)�{t�<��d��5���0i�XSU��m:��Z�┵�i�"��1�^B�-��P�hJ��&)O��*�D��c�W��vM��)����}���P��ܗ-q����\mmζZ-l@�}��a��E�6��F�@��&Sg@���ݚ�M����� ȹ 4����#p�\H����dYDo�H���"��\��..R�B�H�z_�/5˘����6��KhJR��P�mƶi�m���3�,#c�co��q�a)*Pt����R�m�k�7x�D�E�\Y�閣_X�<���~�)���c[[�BP����6�Yq���S��0����%_����;��Àv�~�| VS؇ ��'O0��F0��\���U�-�d@�����7�SJ*z��3n��y��P����O���������m�~�P�3|Y��ʉr#�C�<�G~�.,! ���bqx���h~0=��!ǫ�jy����l�O,�[B��~��|9��ٱ����Xly�#�i�B��g%�S��������tˋ���e���ې��\[d�t)��.+u�|1 ������#�~Oj����hS�%��i.�~X���I�H�m��0n���c�1uE�q��cF�RF�o���7� �O�ꮧ� ���ۛ{��ʛi5�rw?׌#Qn�TW��~?y$��m\�\o����%W� ?=>S�N@�� �Ʈ���R����N�)�r"C�:��:����� �����#��qb��Y�. �6[��2K����2u�Ǧ�HYR��Q�MV��� �G�$��Q+.>�����nNH��q�^��� ����q��mM��V��D�+�-�#*�U�̒ ���p욳��u:�������IB���m���PV@O���r[b= �� ��1U�E��_Nm�yKbN�O���U�}�the�`�|6֮P>�\2�P�V���I�D�i�P�O;�9�r�mAHG�W�S]��J*�_�G��+kP�2����Ka�Z���H�'K�x�W�MZ%�O�YD�Rc+o��?�q��Ghm��d�S�oh�\�D�|:W������UA�Qc yT�q������~^�H��/��#p�CZ���T�I�1�ӏT����4��"�ČZ�����}��`w�#�*,ʹ�� ��0�i��課�Om�*�da��^gJ݅{���l�e9uF#T�ֲ��̲�ٞC"�q���ߍ ոޑ�o#�XZTp����@ o�8��(jd��xw�]�,f���`~�|,s��^����f�1���t��|��m�򸄭/ctr��5s��7�9Q�4�H1꠲BB@l9@���C�����+�wp�xu�£Yc�9��?`@#�o�mH�s2��)�=��2�.�l����jg�9$�Y�S�%*L������R�Y������7Z���,*=�䷘$�������arm�o�ϰ���UW.|�r�uf����IGw�t����Zwo��~5 ��YյhO+=8fF�)�W�7�L9lM�̘·Y���֘YLf�큹�pRF���99.A �"wz��=E\Z���'a� 2��Ǚ�#;�'}�G���*��l��^"q��+2FQ� hj��kŦ��${���ޮ-�T�٭cf�|�3#~�RJ����t��$b�(R��(����r���dx� >U b�&9,>���%E\� Ά�e�$��'�q't��*�א���ެ�b��-|d���SB�O�O��$�R+�H�)�܎�K��1m`;�J�2�Y~9��O�g8=vqD`K[�F)k�[���1m޼c��n���]s�k�z$@��)!I �x՝"v��9=�ZA=`Ɠi �:�E��)`7��vI��}d�YI�_ �o�:ob���o ���3Q��&D&�2=�� �Ά��;>�h����y.*ⅥS������Ӭ�+q&����j|UƧ����}���J0��WW< ۋS�)jQR�j���Ư��rN)�Gű�4Ѷ(�S)Ǣ�8��i��W52���No˓� ۍ%�5brOn�L�;�n��\G����=�^U�dI���8$�&���h��'���+�(������cȁ߫k�l��S^���cƗjԌE�ꭔ��gF���Ȓ��@���}O���*;e�v�WV���YJ\�]X'5��ղ�k�F��b 6R�o՜m��i N�i����>J����?��lPm�U��}>_Z&�KK��q�r��I�D�Չ~�q�3fL�:S�e>���E���-G���{L�6p�e,8��������QI��h��a�Xa��U�A'���ʂ���s�+טIjP�-��y�8ۈZ?J$��W�P� ��R�s�]��|�l(�ԓ��sƊi��o(��S0��Y� 8�T97.�����WiL��c�~�dxc�E|�2!�X�K�Ƙਫ਼�$((�6�~|d9u+�qd�^3�89��Y�6L�.I�����?���iI�q���9�)O/뚅����O���X��X�V��ZF[�یgQ�L��K1���RҖr@v�#��X�l��F���Нy�S�8�7�kF!A��sM���^rkp�jP�DyS$N���q��nxҍ!U�f�!eh�i�2�m���`�Y�I�9r�6� �TF���C}/�y�^���Η���5d�'��9A-��J��>{�_l+�`��A���[�'��յ�ϛ#w:݅�%��X�}�&�PSt�Q�"�-��\縵�/����$Ɨh�Xb�*�y��BS����;W�ջ_mc�����vt?2}1�;qS�d�d~u:2k5�2�R�~�z+|HE!)�Ǟl��7`��0�<�,�2*���Hl-��x�^����'_TV�gZA�'j� ^�2Ϊ��N7t�����?w�� �x1��f��Iz�C-Ȗ��K�^q�;���-W�DvT�7��8�Z�������� hK�(P:��Q- �8�n�Z���܃e貾�<�1�YT<�,�����"�6{/ �?�͟��|1�:�#g��W�>$����d��J��d�B��=��jf[��%rE^��il:��B���x���Sּ�1հ��,�=��*�7 fcG��#q� �eh?��2�7�����,�!7x��6�n�LC�4x��},Geǝ�tC.��vS �F�43��zz\��;QYC,6����~;RYS/6���|2���5���v��T��i����������mlv��������&� �nRh^ejR�LG�f���? �ۉҬܦƩ��|��Ȱ����>3����!v��i�ʯ�>�v��オ�X3e���_1z�Kȗ\<������!�8���V��]��?b�k41�Re��T�q��mz��TiOʦ�Z��Xq���L������q"+���2ۨ��8}�&N7XU7Ap�d�X��~�׿��&4e�o�F��� �H����O���č�c�� 懴�6���͉��+)��v;j��ݷ�� �UV�� i��� j���Y9GdÒJ1��詞�����V?h��l����l�cGs�ځ�������y�Ac�����\V3�? �� ܙg�>qH�S,�E�W�[�㺨�uch�⍸�O�}���a��>�q�6�n6����N6�q������N ! 1AQaq�0@����"2BRb�#Pr���3C`��Scst���$4D���%Td�� ?���N����a��3��m���C���w��������xA�m�q�m���m������$����4n淿t'��C"w��zU=D�\R+w�p+Y�T�&�պ@��ƃ��3ޯ?�Aﶂ��aŘ���@-�����Q�=���9D��ռ�ѻ@��M�V��P��܅�G5�f�Y<�u=,EC)�<�Fy'�"�&�չ�X~f��l�KԆV��?�� �W�N����=(� �;���{�r����ٌ�Y���h{�١������jW����P���Tc�����X�K�r��}���w�R��%��?���E��m�� �Y�q|����\lEE4���r���}�lsI�Y������f�$�=�d�yO����p�����yBj8jU�o�/�S��?�U��*������ˍ�0������u�q�m [�?f����a�� )Q�>����6#������� ?����0UQ����,IX���(6ڵ[�DI�MNލ�c&���υ�j\��X�R|,4��� j������T�hA�e��^���d���b<����n�� �즇�=!���3�^�`j�h�ȓr��jẕ�c�,ٞX����-����a�ﶔ���#�$��]w�O��Ӫ�1y%��L�Y<�wg#�ǝ�̗`�x�xa�t�w��»1���o7o5��>�m뭛C���Uƃߜ}�C���y1Xνm�F8�jI���]����H���ۺиE@I�i;r�8ӭ����V�F�Շ| ��&?�3|x�B�MuS�Ge�=Ӕ�#BE5G�����Y!z��_e��q�р/W>|-�Ci߇�t�1ޯќd�R3�u��g�=0 5��[?�#͏��q�cf���H��{ ?u�=?�?ǯ���}Z��z���hmΔ�BFTW�����<�q�(v� ��!��z���iW]*�J�V�z��gX֧A�q�&��/w���u�gYӘa���; �i=����g:��?2�dž6�ى�k�4�>�Pxs����}������G�9��3 ���)gG�R<>r h�$��'nc�h�P��Bj��J�ҧH� -��N1���N��?��~��}-q!=��_2hc�M��l�vY%UE�@|�v����M2�.Y[|y�"Eï��K�ZF,�ɯ?,q�?v�M 80jx�"�;�9vk�����+ ֧�� �ȺU��?�%�vcV��mA�6��Qg^M����A}�3�nl� QRN�l8�kkn�'�����(��M�7m9و�q���%ޟ���*h$Zk"��$�9��: �?U8�Sl��,,|ɒ��xH(ѷ����Gn�/Q�4�P��G�%��Ա8�N��!� �&�7�;���eKM7�4��9R/%����l�c>�x;������>��C�:�����t��h?aKX�bhe�ᜋ^�$�Iհ �hr7%F$�E��Fd���t��5���+�(M6�t����Ü�UU|zW�=a�Ts�Tg������dqP�Q����b'�m���1{|Y����X�N��b �P~��F^F:����k6�"�j!�� �I�r�`��1&�-$�Bevk:y���#yw��I0��x��=D�4��tU���P�ZH��ڠ底taP��6����b>�xa����Q�#� WeF��ŮNj�p�J* mQ�N����*I�-*�ȩ�F�g�3 �5��V�ʊ�ɮ�a��5F���O@{���NX��?����H�]3��1�Ri_u��������ѕ�� ����0��� F��~��:60�p�͈�S��qX#a�5>���`�o&+�<2�D����: �������ڝ�$�nP���*)�N�|y�Ej�F�5ټ�e���ihy�Z �>���k�bH�a�v��h�-#���!�Po=@k̆IEN��@��}Ll?j�O������߭�ʞ���Q|A07x���wt!xf���I2?Z��<ץ�T���cU�j��]��陎Ltl �}5�ϓ��$�,��O�mˊ�;�@O��jE��j(�ا,��LX���LO���Ц�90�O �.����a��nA���7������j4 ��W��_ٓ���zW�jcB������y՗+EM�)d���N�g6�y1_x��p�$Lv:��9�"z��p���ʙ$��^��JԼ*�ϭ����o���=x�Lj�6�J��u82�A�H�3$�ٕ@�=Vv�]�'�qEz�;I˼��)��=��ɯ���x �/�W(V���p�����$ �m�������u�����񶤑Oqˎ�T����r��㠚x�sr�GC��byp�G��1ߠ�w e�8�$⿄����/�M{*}��W�]˷.�CK\�ުx���/$�WPw���r� |i���&�}�{�X� �>��$-��l���?-z���g����lΆ���(F���h�vS*���b���߲ڡn,|)mrH[���a�3�ר�[1��3o_�U�3�TC�$��(�=�)0�kgP���� ��u�^=��4 �WYCҸ:��vQ�ר�X�à��tk�m,�t*��^�,�}D*� �"(�I��9R����>`�`��[~Q]�#af��i6l��8���6�:,s�s�N6�j"�A4���IuQ��6E,�GnH��zS�HO�uk�5$�I�4��ؤ�Q9�@��C����wp�BGv[]�u�Ov���0I4���\��y�����Q�Ѹ��~>Z��8�T��a��q�ޣ;z��a���/��S��I:�ܫ_�|������>=Z����8:�S��U�I�J��"IY���8%b8���H��:�QO�6�;7�I�S��J��ҌAά3��>c���E+&jf$eC+�z�;��V����� �r���ʺ������my�e���aQ�f&��6�ND��.:��NT�vm�<- u���ǝ\MvZY�N�NT��-A�>jr!S��n�O 1�3�Ns�%�3D@���`������ܟ 1�^c<���� �a�ɽ�̲�Xë#�w�|y�cW�=�9I*H8�p�^(4���՗�k��arOcW�tO�\�ƍR��8����'�K���I�Q�����?5�>[�}��yU�ײ -h��=��% q�ThG�2�)���"ו3]�!kB��*p�FDl�A���,�eEi�H�f�Ps�����5�H:�Փ~�H�0Dت�D�I����h�F3�������c��2���E��9�H��5�zԑ�ʚ�i�X�=:m�xg�hd(�v����׊�9iS��O��d@0ڽ���:�p�5�h-��t�&���X�q�ӕ,��ie�|���7A�2���O%P��E��htj��Y1��w�Ѓ!����  ���� ࢽ��My�7�\�a�@�ţ�J �4�Ȼ�F�@o�̒?4�wx��)��]�P��~�����u�����5�����7X ��9��^ܩ�U;Iꭆ 5 �������eK2�7(�{|��Y׎ �V��\"���Z�1� Z�����}��(�Ǝ"�1S���_�vE30>���p;� ΝD��%x�W�?W?v����o�^V�i�d��r[��/&>�~`�9Wh��y�;���R��� ;;ɮT��?����r$�g1�K����A��C��c��K��l:�'��3 c�ﳯ*"t8�~l��)���m��+U,z��`(�>yJ�?����h>��]��v��ЍG*�{`��;y]��I�T� ;c��NU�fo¾h���/$���|NS���1�S�"�H��V���T���4��uhǜ�]�v;���5�͠x��'C\�SBpl���h}�N����� A�Bx���%��ޭ�l��/����T��w�ʽ]D�=����K���ž�r㻠l4�S�O?=�k �M:� ��c�C�a�#ha���)�ѐxc�s���gP�iG��{+���x���Q���I= �� z��ԫ+ �8"�k�ñ�j=|����c ��y��CF��/��*9ж�h{ �?4�o� ��k�m�Q�N�x��;�Y��4膚�a�w?�6�>e]�����Q�r�:����g�,i"�����ԩA�*M�<�G��b�if��l^M��5� �Ҩ�{����6J��ZJ�����P�*�����Y���ݛu�_4�9�I8�7���������,^ToR���m4�H��?�N�S�ѕw��/S��甍�@�9H�S�T��t�ƻ���ʒU��*{Xs�@����f�����֒Li�K{H�w^���������Ϥm�tq���s� ���ք��f:��o~s��g�r��ט� �S�ѱC�e]�x���a��) ���(b-$(�j>�7q�B?ӕ�F��hV25r[7 Y� }L�R��}����*sg+��x�r�2�U=�*'WS��ZDW]�WǞ�<��叓���{�$�9Ou4��y�90-�1�'*D`�c�^o?(�9��u���ݐ��'PI&� f�Jݮ�������:wS����jfP1F:X �H�9dԯ���˝[�_54 �}*;@�ܨ�� ð�yn�T���?�ןd�#���4rG�ͨ��H�1�|-#���Mr�S3��G�3�����)�.᧏3v�z֑��r����$G"�`j �1t��x0<Ɔ�Wh6�y�6��,œ�Ga��gA����y��b��)��h�D��ß�_�m��ü �gG;��e�v��ݝ�nQ� ��C����-�*��o���y�a��M��I�>�<���]obD��"�:���G�A��-\%LT�8���c�)��+y76���o�Q�#*{�(F�⽕�y����=���rW�\p���۩�c���A���^e6��K������ʐ�cVf5$�'->���ՉN"���F�"�UQ@�f��Gb~��#�&�M=��8�ט�JNu9��D��[̤�s�o�~������ G��9T�tW^g5y$b��Y'��س�Ǵ�=��U-2 #�MC�t(�i� �lj�@Q 5�̣i�*�O����s�x�K�f��}\��M{E�V�{�υ��Ƈ�����);�H����I��fe�Lȣr�2��>��W�I�Ȃ6������i��k�� �5�YOxȺ����>��Y�f5'��|��H+��98pj�n�.O�y�������jY��~��i�w'������l�;�s�2��Y��:'lg�ꥴ)o#'Sa�a�K��Z� �m��}�`169�n���"���x��I ��*+� }F<��cГ���F�P�������ֹ*�PqX�x۩��,� ��N�� �4<-����%����:��7����W���u�`����� $�?�I��&����o��o��`v�>��P��"��l���4��5'�Z�gE���8���?��[�X�7(��.Q�-��*���ތL@̲����v��.5���[��=�t\+�CNܛ��,g�SQnH����}*F�G16���&:�t��4ُ"A��̣��$�b �|����#rs��a�����T�� ]�<�j��BS�('$�ɻ� �wP;�/�n��?�ݜ��x�F��yUn�~mL*-�������Xf�wd^�a�}��f�,=t�׵i�.2/wpN�Ep8�OР���•��R�FJ� 55TZ��T �ɭ�<��]��/�0�r�@�f��V��V����Nz�G��^���7hZi����k��3�,kN�e|�vg�1{9]_i��X5y7� 8e]�U����'�-2,���e"����]ot�I��Y_��n�(JҼ��1�O ]bXc���Nu�No��pS���Q_���_�?i�~�x h5d'�(qw52] ��'ޤ�q��o1�R!���`ywy�A4u���h<קy���\[~�4�\ X�Wt/� 6�����n�F�a8��f���z �3$�t(���q��q�x��^�XWeN'p<-v�!�{�(>ӽDP7��ո0�y)�e$ٕv�Ih'Q�EA�m*�H��RI��=:��� ���4牢) �%_iN�ݧ�l]� �Nt���G��H�L��� ɱ�g<���1V�,�J~�ٹ�"K��Q�� 9�HS�9�?@��k����r�;we݁�]I�!{ �@�G�[�"��`���J:�n]�{�cA�E����V��ʆ���#��U9�6����j�#Y�m\��q�e4h�B�7��C�������d<�?J����1g:ٳ���=Y���D�p�ц� ׈ǔ��1�]26؜oS�'��9�V�FVu�P�h�9�xc�oq�X��p�o�5��Ա5$�9W�V(�[Ak�aY錎qf;�'�[�|���b�6�Ck��)��#a#a˙��8���=äh�4��2��C��4tm^ �n'c���]GQ$[Wҿ��i���vN�{Fu ��1�gx��1┷���N�m��{j-,��x�� Ūm�ЧS�[�s���Gna���䑴�� x�p 8<������97�Q���ϴ�v�aϚG��Rt�Һ׈�f^\r��WH�JU�7Z���y)�vg=����n��4�_)y��D'y�6�]�c�5̪�\� �PF�k����&�c;��cq�$~T�7j ���nç]�<�g ":�to�t}�159�<�/�8������m�b�K#g'I'.W�����6��I/��>v��\�MN��g���m�A�yQL�4u�Lj�j9��#44�t��l^�}L����n��R��!��t��±]��r��h6ٍ>�yҏ�N��fU�� ���� Fm@�8}�/u��jb9������he:A�y�ծw��GpΧh�5����l}�3p468��)U��d��c����;Us/�֔�YX�1�O2��uq�s��`hwg�r~�{ R��mhN��؎*q 42�*th��>�#���E����#��Hv�O����q�}�����6�e��\�,Wk�#���X��b>��p}�դ��3���T5��†��6��[��@�P�y*n��|'f�֧>�lư΂�̺����SU�'*�q�p�_S�����M�� '��c�6�����m�� ySʨ;M��r���Ƌ�m�Kxo,���Gm�P��A�G�:��i��w�9�}M(�^�V��$ǒ�ѽ�9���|���� �a����J�SQ�a���r�B;����}���ٻ֢�2�%U���c�#�g���N�a�ݕ�'�v�[�OY'��3L�3�;,p�]@�S��{ls��X�'���c�jw�k'a�.��}�}&�� �dP�*�bK=ɍ!����;3n�gΊU�ߴmt�'*{,=SzfD� A��ko~�G�aoq�_mi}#�m�������P�Xhύ����mxǍ�΂���巿zf��Q���c���|kc�����?���W��Y�$���_Lv����l߶��c���`?����l�j�ݲˏ!V��6����U�Ђ(A���4y)H���p�Z_�x��>���e��R��$�/�`^'3qˏ�-&Q�=?��CFVR �D�fV�9��{�8g�������n�h�(P"��6�[�D���< E�����~0<@�`�G�6����Hг�cc�� �c�K.5��D��d�B���`?�XQ��2��ٿyqo&+�1^� DW�0�ꊩ���G�#��Q�nL3��c���������/��x ��1�1[y�x�პCW��C�c�UĨ80�m�e�4.{�m��u���I=��f�����0QRls9���f���������9���~f�����Ǩ��a�"@�8���ȁ�Q����#c�ic������G��$���G���r/$W�(��W���V�"��m�7�[m�A�m����bo��D� j����۳� l���^�k�h׽����� ��#� iXn�v��eT�k�a�^Y�4�BN��ĕ��0 !01@Q"2AaPq3BR������?���@4�Q�����T3,���㺠�W�[=JK�Ϟ���2�r^7��vc�:�9 �E�ߴ�w�S#d���Ix��u��:��Hp��9E!�� V 2;73|F��9Y���*ʬ�F��D����u&���y؟��^EA��A��(ɩ���^��GV:ݜDy�`��Jr29ܾ�㝉��[���E;Fzx��YG��U�e�Y�C���� ����v-tx����I�sם�Ę�q��Eb�+P\ :>�i�C'�;�����k|z�رn�y]�#ǿb��Q��������w�����(�r|ӹs��[�D��2v-%��@;�8<a���[\o[ϧw��I!��*0�krs)�[�J9^��ʜ��p1)� "��/_>��o��<1����A�E�y^�C��`�x1'ܣn�p��s`l���fQ��):�l����b>�Me�jH^?�kl3(�z:���1ŠK&?Q�~�{�ٺ�h�y���/�[��V�|6��}�KbX����mn[-��7�5q�94�������dm���c^���h� X��5��<�eޘ>G���-�}�دB�ޟ� ��|�rt�M��V+�]�c?�-#ڛ��^ǂ}���Lkr���O��u�>�-D�ry� D?:ޞ�U��ǜ�7�V��?瓮�"�#���r��չģVR;�n���/_� ؉v�ݶe5d�b9��/O��009�G���5n�W����JpA�*�r9�>�1��.[t���s�F���nQ� V 77R�]�ɫ8����_0<՜�IF�u(v��4��F�k�3��E)��N:��yڮe��P�`�1}�$WS��J�SQ�N�j�ٺ��޵�#l���ј(�5=��5�lǏmoW�v-�1����v,W�mn��߀$x�<����v�j(����c]��@#��1������Ǔ���o'��u+����;G�#�޸��v-lη��/(`i⣍Pm^���ԯ̾9Z��F��������n��1��� ��]�[��)�'������:�֪�W��FC����� �B9،!?���]��V��A�Վ�M��b�w��G F>_DȬ0¤�#�QR�[V��kz���m�w�"��9ZG�7'[��=�Q����j8R?�zf�\a�=��O�U����*oB�A�|G���2�54 �p��.w7� �� ��&������ξxGHp� B%��$g�����t�Џ򤵍z���HN�u�Я�-�'4��0��;_��3 !01"@AQa2Pq#3BR������?��ʩca��en��^��8���<�u#��m*08r��y�N"�<�Ѳ0��@\�p��� �����Kv�D��J8�Fҽ� �f�Y��-m�ybX�NP����}�!*8t(�OqѢ��Q�wW�K��ZD��Δ^e��!� ��B�K��p~�����e*l}z#9ң�k���q#�Ft�o��S�R����-�w�!�S���Ӥß|M�l޶V��!eˈ�8Y���c�ЮM2��tk���� ������J�fS����Ö*i/2�����n]�k�\���|4yX�8��U�P.���Ы[���l��@"�t�<������5�lF���vU�����W��W��;�b�cД^6[#7@vU�xgZv��F�6��Q,K�v��� �+Ъ��n��Ǣ��Ft���8��0��c�@�!�Zq s�v�t�;#](B��-�nῃ~���3g������5�J�%���O������n�kB�ĺ�.r��+���#�N$?�q�/�s�6��p��a����a��J/��M�8��6�ܰ"�*������ɗud"\w���aT(����[��F��U՛����RT�b���n�*��6���O��SJ�.�ij<�v�MT��R\c��5l�sZB>F��<7�;EA��{��E���Ö��1U/�#��d1�a�n.1ě����0�ʾR�h��|�R��Ao�3�m3 ��%�� ���28Q� ��y��φ���H�To�7�lW>����#i`�q���c����a��� �m,B�-j����݋�'mR1Ήt�>��V��p���s�0IbI�C.���1R�ea�����]H�6����������4B>��o��](��$B���m�����a�!=��?�B� K�Ǿ+�Ծ"�n���K��*��+��[T#�{E�J�S����Q�����s�5�:�U�\wĐ�f�3����܆&�)����I���Ԇw��E T�lrTf6Q|R�h:��[K�� �z��c֧�G�C��%\��_�a�84��HcO�bi��ؖV��7H �)*ģK~Xhչ0��4?�0��� �E<���}3���#���u�?�� ��|g�S�6ꊤ�|�I#Hڛ� �ա��w�X��9��7���Ŀ%�SL��y6č��|�F�a 8���b��$�sק�h���b9RAu7�˨p�Č�_\*w��묦��F ����4D~�f����|(�"m���NK��i�S�>�$d7SlA��/�²����SL��|6N�}���S�˯���g��]6��; �#�.��<���q'Q�1|KQ$�����񛩶"�$r�b:���N8�w@��8$�� �AjfG|~�9F ���Y��ʺ��Bwؒ������M:I岎�G��`s�YV5����6��A �b:�W���G�q%l�����F��H���7�������Fsv7��k�� 403WebShell
403Webshell
Server IP : 199.79.62.87  /  Your IP : 216.73.216.188
Web Server : Microsoft-IIS/10.0
System : Windows NT BH-PLESK-WEB4 10.0 build 20348 (Windows Server 2022) AMD64
User : IWPD_13108(aitsti.c) ( 0)
PHP Version : 8.3.14
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  D:/INETPUB/VHOSTS/aitsti.com/httpdocs/vendor/mpdf/mpdf/classes/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : D:/INETPUB/VHOSTS/aitsti.com/httpdocs/vendor/mpdf/mpdf/classes/svg.php
<?php

//	svg class modified for mPDF version 6.0 by Ian Back: based on -
//	svg2pdf fpdf class
//	sylvain briand (syb@godisaduck.com), modified by rick trevino (rtrevino1@yahoo.com)
//	http://www.godisaduck.com/svg2pdf_with_fpdf
//	http://rhodopsin.blogspot.com
//
//	cette class etendue est open source, toute modification devra cependant etre repertoriée~
// If you wish to use Automatic Font selection within SVG's. change this definition to true.
// This selects different fonts for different scripts used in text.
// This can be enabled/disabled independently of the use of Automatic Font selection within mPDF generally.
// Choice of font is determined by the config_script2lang.php and config_lang2fonts.php files, the same as for mPDF generally.
if (!defined("_SVG_AUTOFONT")) {
	define("_SVG_AUTOFONT", false);
}

// Enable a limited use of classes within SVG <text> elements by setting this to true.
// This allows recognition of a "class" attribute on a <text> element.
// The CSS style for that class should be outside the SVG, and cannot use any other selectors (i.e. only .class {} can be defined)
// <style> definitions within the SVG code will be recognised if the SVG is included as an inline item within the HTML code passed to mPDF.
// The style property should be pertinent to SVG e.g. use fill:red rather than color:red
// Only the properties currently supported for SVG text can be specified:
// fill, fill-opacity, stroke, stroke-opacity, stroke-linecap, stroke-linejoin, stroke-width, stroke-dasharray, stroke-dashoffset
// font-family, font-size, font-weight, font-variant, font-style, opacity, text-anchor
if (!defined("_SVG_CLASSES")) {
	define("_SVG_CLASSES", false);
}

// NB UNITS - Works in pixels as main units - converting to PDF units when outputing to PDF string
// and on returning size

class SVG
{

	var $svg_font;  //	array - holds content of SVG fonts defined in image	// mPDF 6

	var $svg_gradient; //	array - contient les infos sur les gradient fill du svg classé par id du svg

	var $svg_shadinglist; //	array - contient les ids des objet shading

	var $svg_info;  //	array contenant les infos du svg voulue par l'utilisateur

	var $svg_attribs;  //	array - holds all attributes of root <svg> tag

	var $svg_style;  //	array contenant les style de groupes du svg

	var $svg_string;  //	String contenant le tracage du svg en lui même.

	var $txt_data;  //    array - holds string info to write txt to image

	var $txt_style;  // 	array - current text style

	var $mpdf_ref;

	var $xbase;

	var $ybase;

	var $svg_error;

	var $subPathInit;

	var $spxstart;

	var $spystart;

	var $kp;  // convert pixels to PDF units

	var $pathBBox;

	var $script2lang;

	var $viet;

	var $pashto;

	var $urdu;

	var $persian;

	var $sindhi;

	var $textlength;  // mPDF 5.7.4

	var $texttotallength; // mPDF 5.7.4

	var $textoutput;  // mPDF 5.7.4

	var $textanchor;  // mPDF 5.7.4

	var $textXorigin;  // mPDF 5.7.4

	var $textYorigin;  // mPDF 5.7.4

	var $textjuststarted; // mPDF 5.7.4

	var $intext;  // mPDF 5.7.4

	public function __construct(mPDF $mpdf)
	{
		$this->svg_font = array(); // mPDF 6
		$this->svg_gradient = array();
		$this->svg_shadinglist = array();
		$this->txt_data = array();
		$this->svg_string = '';
		$this->svg_info = array();
		$this->svg_attribs = array();
		$this->xbase = 0;
		$this->ybase = 0;
		$this->svg_error = false;
		$this->subPathInit = false;
		$this->dashesUsed = false;
		$this->mpdf_ref = & $mpdf;

		$this->textlength = 0;  // mPDF 5.7.4
		$this->texttotallength = 0; // mPDF 5.7.4
		$this->textoutput = '';  // mPDF 5.7.4
		$this->textanchor = 'start'; // mPDF 5.7.4
		$this->textXorigin = 0;  // mPDF 5.7.4
		$this->textYorigin = 0;  // mPDF 5.7.4
		$this->textjuststarted = false; // mPDF 5.7.4
		$this->intext = false;   // mPDF 5.7.4

		$this->kp = 72 / $mpdf->img_dpi; // constant To convert pixels to pts/PDF units
		$this->kf = 1;    // constant To convert font size if re-mapped
		$this->pathBBox = array();

		$this->svg_style = array(
			array(
				'fill' => 'black',
				'fill-opacity' => 1, //	remplissage opaque par defaut
				'fill-rule' => 'nonzero', //	mode de remplissage par defaut
				'stroke' => 'none', //	pas de trait par defaut
				'stroke-linecap' => 'butt', //	style de langle par defaut
				'stroke-linejoin' => 'miter',
				'stroke-miterlimit' => 4, //	limite de langle par defaut
				'stroke-opacity' => 1, //	trait opaque par defaut
				'stroke-width' => 1,
				'stroke-dasharray' => 0,
				'stroke-dashoffset' => 0,
				'color' => ''
			)
		);

		$this->txt_style = array(
			array(
				'fill' => 'black', //	pas de remplissage par defaut
				'font-family' => $mpdf->default_font,
				'font-size' => $mpdf->default_font_size, // 	****** this is pts
				'font-weight' => 'normal', //	normal | bold
				'font-style' => 'normal', //	italic | normal
				'text-anchor' => 'start', // alignment: start, middle, end
				'fill-opacity' => 1, //	remplissage opaque par defaut
				'fill-rule' => 'nonzero', //	mode de remplissage par defaut
				'stroke' => 'none', //	pas de trait par defaut
				'stroke-opacity' => 1, //	trait opaque par defaut
				'stroke-width' => 1,
				'color' => ''
			)
		);
	}

	// mPDF 5.7.4 Embedded image
	function svgImage($attribs)
	{
		// x and y are coordinates
		$x = (isset($attribs['x']) ? $attribs['x'] : 0);
		$y = (isset($attribs['y']) ? $attribs['y'] : 0);
		// preserveAspectRatio
		$par = (isset($attribs['preserveAspectRatio']) ? $attribs['preserveAspectRatio'] : 'xMidYMid meet');
		// width and height are <lengths> - Required attributes
		$wset = (isset($attribs['width']) ? $attribs['width'] : 0);
		$hset = (isset($attribs['height']) ? $attribs['height'] : 0);
		$w = $this->mpdf_ref->ConvertSize($wset, $this->svg_info['w'] * (25.4 / $this->mpdf_ref->dpi), $this->mpdf_ref->FontSize, false);
		$h = $this->mpdf_ref->ConvertSize($hset, $this->svg_info['h'] * (25.4 / $this->mpdf_ref->dpi), $this->mpdf_ref->FontSize, false);
		if ($w == 0 || $h == 0) {
			return;
		}
		// Convert to pixels = SVG units
		$w *= 1 / (25.4 / $this->mpdf_ref->dpi);
		$h *= 1 / (25.4 / $this->mpdf_ref->dpi);

		$srcpath = $attribs['xlink:href'];
		$orig_srcpath = '';
		if (trim($srcpath) != '' && substr($srcpath, 0, 4) == 'var:') {
			$orig_srcpath = $srcpath;
			$this->mpdf_ref->GetFullPath($srcpath);
		}

		// Image file (does not allow vector images i.e. WMF/SVG)
		// mPDF 6 Added $this->mpdf_ref->interpolateImages
		$info = $this->mpdf_ref->_getImage($srcpath, true, false, $orig_srcpath, $this->mpdf_ref->interpolateImages);
		if (!$info)
			return;

		// x,y,w,h define the reference rectangle
		$img_h = $h;
		$img_w = $w;
		$img_x = $x;
		$img_y = $y;
		$meetOrSlice = 'meet';

		// preserveAspectRatio
		$ar = preg_split('/\s+/', strtolower($par));
		if ($ar[0] != 'none') { // If "none" need to do nothing
			//  Force uniform scaling
			if (isset($ar[1]) && $ar[1] == 'slice') {
				$meetOrSlice = 'slice';
			} else {
				$meetOrSlice = 'meet';
			}
			if ($info['h'] / $info['w'] > $h / $w) {
				if ($meetOrSlice == 'meet') { // the entire viewBox is visible within the viewport
					$img_w = $img_h * $info['w'] / $info['h'];
				} else { // the entire viewport is covered by the viewBox
					$img_h = $img_w * $info['h'] / $info['w'];
				}
			} else if ($info['h'] / $info['w'] < $h / $w) {
				if ($meetOrSlice == 'meet') { // the entire viewBox is visible within the viewport
					$img_h = $img_w * $info['h'] / $info['w'];
				} else { // the entire viewport is covered by the viewBox
					$img_w = $img_h * $info['w'] / $info['h'];
				}
			}
			if ($ar[0] == 'xminymin') {
				// do nothing to x
				// do nothing to y
			} else if ($ar[0] == 'xmidymin') {
				$img_x += $w / 2 - $img_w / 2; // xMid
				// do nothing to y
			} else if ($ar[0] == 'xmaxymin') {
				$img_x += $w - $img_w; // xMax
				// do nothing to y
			} else if ($ar[0] == 'xminymid') {
				// do nothing to x
				$img_y += $h / 2 - $img_h / 2; // yMid
			} else if ($ar[0] == 'xmaxymid') {
				$img_x += $w - $img_w; // xMax
				$img_y += $h / 2 - $img_h / 2; // yMid
			} else if ($ar[0] == 'xminymax') {
				// do nothing to x
				$img_y += $h - $img_h; // yMax
			} else if ($ar[0] == 'xmidymax') {
				$img_x += $w / 2 - $img_w / 2; // xMid
				$img_y += $h - $img_h; // yMax
			} else if ($ar[0] == 'xmaxymax') {
				$img_x += $w - $img_w; // xMax
				$img_y += $h - $img_h; // yMax
			} else { // xMidYMid (the default)
				$img_x += $w / 2 - $img_w / 2; // xMid
				$img_y += $h / 2 - $img_h / 2; // yMid
			}
		}

		// Output
		if ($meetOrSlice == 'slice') { // need to add a clipping path to reference rectangle
			$s = ' q 0 w '; // Line width=0
			$s .= sprintf('%.3F %.3F m ', ($x) * $this->kp, (-($y + $h)) * $this->kp); // start point TL before the arc
			$s .= sprintf('%.3F %.3F l ', ($x) * $this->kp, (-($y)) * $this->kp); // line to BL
			$s .= sprintf('%.3F %.3F l ', ($x + $w) * $this->kp, (-($y)) * $this->kp); // line to BR
			$s .= sprintf('%.3F %.3F l ', ($x + $w) * $this->kp, (-($y + $h)) * $this->kp); // line to TR
			$s .= sprintf('%.3F %.3F l ', ($x) * $this->kp, (-($y + $h)) * $this->kp); // line to TL
			$s .= ' W n '; // Ends path no-op & Sets the clipping path
			$this->svgWriteString($s);
		}

		$outstring = sprintf(" q %.3F 0 0 %.3F %.3F %.3F cm /I%d Do Q ", $img_w * $this->kp, $img_h * $this->kp, $img_x * $this->kp, -($img_y + $img_h) * $this->kp, $info['i']);
		$this->svgWriteString($outstring);

		if ($meetOrSlice == 'slice') { // need to end clipping path
			$this->svgWriteString(' Q ');
		}
	}

	function svgGradient($gradient_info, $attribs, $element)
	{
		$n = count($this->mpdf_ref->gradients) + 1;

		// Get bounding dimensions of element
		$w = 100;
		$h = 100;
		$x_offset = 0;
		$y_offset = 0;
		if ($element == 'rect') {
			$w = $attribs['width'];
			$h = $attribs['height'];
			$x_offset = $attribs['x'];
			$y_offset = $attribs['y'];
		} else if ($element == 'ellipse') {
			$w = $attribs['rx'] * 2;
			$h = $attribs['ry'] * 2;
			$x_offset = $attribs['cx'] - $attribs['rx'];
			$y_offset = $attribs['cy'] - $attribs['ry'];
		} else if ($element == 'circle') {
			$w = $attribs['r'] * 2;
			$h = $attribs['r'] * 2;
			$x_offset = $attribs['cx'] - $attribs['r'];
			$y_offset = $attribs['cy'] - $attribs['r'];
		} else if ($element == 'polygon') {
			$pts = preg_split('/[ ,]+/', trim($attribs['points']));
			$maxr = $maxb = 0;
			$minl = $mint = 999999;
			for ($i = 0; $i < count($pts); $i++) {
				if ($i % 2 == 0) { // x values
					$minl = min($minl, $pts[$i]);
					$maxr = max($maxr, $pts[$i]);
				} else { // y values
					$mint = min($mint, $pts[$i]);
					$maxb = max($maxb, $pts[$i]);
				}
			}
			$w = $maxr - $minl;
			$h = $maxb - $mint;
			$x_offset = $minl;
			$y_offset = $mint;
		} else if ($element == 'path') {
			if (is_array($this->pathBBox) && $this->pathBBox[2] > 0) {
				$w = $this->pathBBox[2];
				$h = $this->pathBBox[3];
				$x_offset = $this->pathBBox[0];
				$y_offset = $this->pathBBox[1];
			} else {
				preg_match_all('/([a-z]|[A-Z])([ ,\-.\d]+)*/', $attribs['d'], $commands, PREG_SET_ORDER);
				$maxr = $maxb = 0;
				$minl = $mint = 999999;
				foreach ($commands as $c) {
					if (count($c) == 3) {
						list($tmp, $cmd, $arg) = $c;
						if ($cmd == 'M' || $cmd == 'L' || $cmd == 'C' || $cmd == 'S' || $cmd == 'Q' || $cmd == 'T') {
							$pts = preg_split('/[ ,]+/', trim($arg));
							for ($i = 0; $i < count($pts); $i++) {
								if ($i % 2 == 0) { // x values
									$minl = min($minl, $pts[$i]);
									$maxr = max($maxr, $pts[$i]);
								} else { // y values
									$mint = min($mint, $pts[$i]);
									$maxb = max($maxb, $pts[$i]);
								}
							}
						}
						if ($cmd == 'H') { // sets new x
							$minl = min($minl, $arg);
							$maxr = max($maxr, $arg);
						}
						if ($cmd == 'V') { // sets new y
							$mint = min($mint, $arg);
							$maxb = max($maxb, $arg);
						}
					}
				}
				$w = $maxr - $minl;
				$h = $maxb - $mint;
				$x_offset = $minl;
				$y_offset = $mint;
			}
		}
		if (!$w || $w == -999999) {
			$w = 100;
		}
		if (!$h || $h == -999999) {
			$h = 100;
		}
		if ($x_offset == 999999) {
			$x_offset = 0;
		}
		if ($y_offset == 999999) {
			$y_offset = 0;
		}

		// TRANSFORMATIONS
		$transformations = '';
		if (isset($gradient_info['transform'])) {
			preg_match_all('/(matrix|translate|scale|rotate|skewX|skewY)\((.*?)\)/is', $gradient_info['transform'], $m);
			if (count($m[0])) {
				for ($i = 0; $i < count($m[0]); $i++) {
					$c = strtolower($m[1][$i]);
					$v = trim($m[2][$i]);
					$vv = preg_split('/[ ,]+/', $v);
					if ($c == 'matrix' && count($vv) == 6) {
						// Note angle of rotation is reversed (from SVG to PDF), so vv[1] and vv[2] are negated
						// cf svgDefineStyle()
						$transformations .= sprintf(' %.3F %.3F %.3F %.3F %.3F %.3F cm ', $vv[0], -$vv[1], -$vv[2], $vv[3], $vv[4] * $this->kp, -$vv[5] * $this->kp);
					} else if ($c == 'translate' && count($vv)) {
						$tm[4] = $vv[0];
						if (count($vv) == 2) {
							$t_y = -$vv[1];
						} else {
							$t_y = 0;
						}
						$tm[5] = $t_y;
						$transformations .= sprintf(' 1 0 0 1 %.3F %.3F cm ', $tm[4] * $this->kp, $tm[5] * $this->kp);
					} else if ($c == 'scale' && count($vv)) {
						if (count($vv) == 2) {
							$s_y = $vv[1];
						} else {
							$s_y = $vv[0];
						}
						$tm[0] = $vv[0];
						$tm[3] = $s_y;
						$transformations .= sprintf(' %.3F 0 0 %.3F 0 0 cm ', $tm[0], $tm[3]);
					} else if ($c == 'rotate' && count($vv)) {
						$tm[0] = cos(deg2rad(-$vv[0]));
						$tm[1] = sin(deg2rad(-$vv[0]));
						$tm[2] = -$tm[1];
						$tm[3] = $tm[0];
						if (count($vv) == 3) {
							$transformations .= sprintf(' 1 0 0 1 %.3F %.3F cm ', $vv[1] * $this->kp, -$vv[2] * $this->kp);
						}
						$transformations .= sprintf(' %.3F %.3F %.3F %.3F 0 0 cm ', $tm[0], $tm[1], $tm[2], $tm[3]);
						if (count($vv) == 3) {
							$transformations .= sprintf(' 1 0 0 1 %.3F %.3F cm ', -$vv[1] * $this->kp, $vv[2] * $this->kp);
						}
					} else if ($c == 'skewx' && count($vv)) {
						$tm[2] = tan(deg2rad(-$vv[0]));
						$transformations .= sprintf(' 1 0 %.3F 1 0 0 cm ', $tm[2]);
					} else if ($c == 'skewy' && count($vv)) {
						$tm[1] = tan(deg2rad(-$vv[0]));
						$transformations .= sprintf(' 1 %.3F 0 1 0 0 cm ', $tm[1]);
					}
				}
			}
		}


		$return = "";

		if (isset($gradient_info['units']) && strtolower($gradient_info['units']) == 'userspaceonuse') {
			if ($transformations) {
				$return .= $transformations;
			}
		}
		$spread = 'P';  // pad
		if (isset($gradient_info['spread'])) {
			if (strtolower($gradient_info['spread']) == 'reflect') {
				$spread = 'F';
			} // reflect
			else if (strtolower($gradient_info['spread']) == 'repeat') {
				$spread = 'R';
			} // repeat
		}


		for ($i = 0; $i < (count($gradient_info['color'])); $i++) {
			if (stristr($gradient_info['color'][$i]['offset'], '%') !== false) {
				$gradient_info['color'][$i]['offset'] = ($gradient_info['color'][$i]['offset'] + 0) / 100;
			}
			if (isset($gradient_info['color'][($i + 1)]['offset']) && stristr($gradient_info['color'][($i + 1)]['offset'], '%') !== false) {
				$gradient_info['color'][($i + 1)]['offset'] = ($gradient_info['color'][($i + 1)]['offset'] + 0) / 100;
			}
			if ($gradient_info['color'][$i]['offset'] < 0) {
				$gradient_info['color'][$i]['offset'] = 0;
			}
			if ($gradient_info['color'][$i]['offset'] > 1) {
				$gradient_info['color'][$i]['offset'] = 1;
			}
			if ($i > 0) {
				if ($gradient_info['color'][$i]['offset'] < $gradient_info['color'][($i - 1)]['offset']) {
					$gradient_info['color'][$i]['offset'] = $gradient_info['color'][($i - 1)]['offset'];
				}
			}
		}

		if (isset($gradient_info['color'][0]['offset']) && $gradient_info['color'][0]['offset'] > 0) {
			array_unshift($gradient_info['color'], $gradient_info['color'][0]);
			$gradient_info['color'][0]['offset'] = 0;
		}
		$ns = count($gradient_info['color']);
		if (isset($gradient_info['color'][($ns - 1)]['offset']) && $gradient_info['color'][($ns - 1)]['offset'] < 1) {
			$gradient_info['color'][] = $gradient_info['color'][($ns - 1)];
			$gradient_info['color'][($ns)]['offset'] = 1;
		}
		$ns = count($gradient_info['color']);




		if ($gradient_info['type'] == 'linear') {
			// mPDF 4.4.003
			if (isset($gradient_info['units']) && strtolower($gradient_info['units']) == 'userspaceonuse') {
				if (isset($gradient_info['info']['x1'])) {
					$gradient_info['info']['x1'] = ($gradient_info['info']['x1'] - $x_offset) / $w;
				}
				if (isset($gradient_info['info']['y1'])) {
					$gradient_info['info']['y1'] = ($gradient_info['info']['y1'] - $y_offset) / $h;
				}
				if (isset($gradient_info['info']['x2'])) {
					$gradient_info['info']['x2'] = ($gradient_info['info']['x2'] - $x_offset) / $w;
				}
				if (isset($gradient_info['info']['y2'])) {
					$gradient_info['info']['y2'] = ($gradient_info['info']['y2'] - $y_offset) / $h;
				}
			}
			if (isset($gradient_info['info']['x1'])) {
				$x1 = $gradient_info['info']['x1'];
			} else {
				$x1 = 0;
			}
			if (isset($gradient_info['info']['y1'])) {
				$y1 = $gradient_info['info']['y1'];
			} else {
				$y1 = 0;
			}
			if (isset($gradient_info['info']['x2'])) {
				$x2 = $gradient_info['info']['x2'];
			} else {
				$x2 = 1;
			}
			if (isset($gradient_info['info']['y2'])) {
				$y2 = $gradient_info['info']['y2'];
			} else {
				$y2 = 0;
			} // mPDF 6

			if (stristr($x1, '%') !== false) {
				$x1 = ($x1 + 0) / 100;
			}
			if (stristr($x2, '%') !== false) {
				$x2 = ($x2 + 0) / 100;
			}
			if (stristr($y1, '%') !== false) {
				$y1 = ($y1 + 0) / 100;
			}
			if (stristr($y2, '%') !== false) {
				$y2 = ($y2 + 0) / 100;
			}

			// mPDF 5.0.042
			$bboxw = $w;
			$bboxh = $h;
			$usex = $x_offset;
			$usey = $y_offset;
			$usew = $bboxw;
			$useh = $bboxh;
			if (isset($gradient_info['units']) && strtolower($gradient_info['units']) == 'userspaceonuse') {
				$angle = rad2deg(atan2(($gradient_info['info']['y2'] - $gradient_info['info']['y1']), ($gradient_info['info']['x2'] - $gradient_info['info']['x1'])));
				if ($angle < 0) {
					$angle += 360;
				} else if ($angle > 360) {
					$angle -= 360;
				}
				if ($angle != 0 && $angle != 360 && $angle != 90 && $angle != 180 && $angle != 270) {
					if ($w >= $h) {
						$y1 *= $h / $w;
						$y2 *= $h / $w;
						$usew = $useh = $bboxw;
					} else {
						$x1 *= $w / $h;
						$x2 *= $w / $h;
						$usew = $useh = $bboxh;
					}
				}
			}
			$a = $usew;  // width
			$d = -$useh; // height
			$e = $usex;  // x- offset
			$f = -$usey; // -y-offset

			$return .= sprintf('%.3F 0 0 %.3F %.3F %.3F cm ', $a * $this->kp, $d * $this->kp, $e * $this->kp, $f * $this->kp);

			if (isset($gradient_info['units']) && strtolower($gradient_info['units']) == 'objectboundingbox') {
				if ($transformations) {
					$return .= $transformations;
				}
			}

			$trans = false;

			if ($spread == 'R' || $spread == 'F') { // Repeat  /  Reflect
				$offs = array();
				for ($i = 0; $i < $ns; $i++) {
					$offs[$i] = $gradient_info['color'][$i]['offset'];
				}
				$gp = 0;
				$inside = true;
				while ($inside) {
					$gp++;
					for ($i = 0; $i < $ns; $i++) {
						if ($spread == 'F' && ($gp % 2) == 1) { // Reflect
							$gradient_info['color'][(($ns * $gp) + $i)] = $gradient_info['color'][(($ns * ($gp - 1)) + ($ns - $i - 1))];
							$tmp = $gp + (1 - $offs[($ns - $i - 1)]);
							$gradient_info['color'][(($ns * $gp) + $i)]['offset'] = $tmp;
						} else { // Reflect
							$gradient_info['color'][(($ns * $gp) + $i)] = $gradient_info['color'][$i];
							$tmp = $gp + $offs[$i];
							$gradient_info['color'][(($ns * $gp) + $i)]['offset'] = $tmp;
						}
						// IF STILL INSIDE BOX OR STILL VALID
						// Point on axis to test
						$px1 = $x1 + ($x2 - $x1) * $tmp;
						$py1 = $y1 + ($y2 - $y1) * $tmp;
						// Get perpendicular axis
						$alpha = atan2($y2 - $y1, $x2 - $x1);
						$alpha += M_PI / 2; // rotate 90 degrees
						// Get arbitrary point to define line perpendicular to axis
						$px2 = $px1 + cos($alpha);
						$py2 = $py1 + sin($alpha);

						$res1 = _testIntersect($px1, $py1, $px2, $py2, 0, 0, 0, 1); // $x=0 vert axis
						$res2 = _testIntersect($px1, $py1, $px2, $py2, 1, 0, 1, 1); // $x=1 vert axis
						$res3 = _testIntersect($px1, $py1, $px2, $py2, 0, 0, 1, 0); // $y=0 horiz axis
						$res4 = _testIntersect($px1, $py1, $px2, $py2, 0, 1, 1, 1); // $y=1 horiz axis
						if (!$res1 && !$res2 && !$res3 && !$res4) {
							$inside = false;
						}
					}
				}

				$inside = true;
				$gp = 0;
				while ($inside) {
					$gp++;
					$newarr = array();
					for ($i = 0; $i < $ns; $i++) {
						if ($spread == 'F') { // Reflect
							$newarr[$i] = $gradient_info['color'][($ns - $i - 1)];
							if (($gp % 2) == 1) {
								$tmp = -$gp + (1 - $offs[($ns - $i - 1)]);
								$newarr[$i]['offset'] = $tmp;
							} else {
								$tmp = -$gp + $offs[$i];
								$newarr[$i]['offset'] = $tmp;
							}
						} else { // Reflect
							$newarr[$i] = $gradient_info['color'][$i];
							$tmp = -$gp + $offs[$i];
							$newarr[$i]['offset'] = $tmp;
						}

						// IF STILL INSIDE BOX OR STILL VALID
						// Point on axis to test
						$px1 = $x1 + ($x2 - $x1) * $tmp;
						$py1 = $y1 + ($y2 - $y1) * $tmp;
						// Get perpendicular axis
						$alpha = atan2($y2 - $y1, $x2 - $x1);
						$alpha += M_PI / 2; // rotate 90 degrees
						// Get arbitrary point to define line perpendicular to axis
						$px2 = $px1 + cos($alpha);
						$py2 = $py1 + sin($alpha);

						$res1 = _testIntersect($px1, $py1, $px2, $py2, 0, 0, 0, 1); // $x=0 vert axis
						$res2 = _testIntersect($px1, $py1, $px2, $py2, 1, 0, 1, 1); // $x=1 vert axis
						$res3 = _testIntersect($px1, $py1, $px2, $py2, 0, 0, 1, 0); // $y=0 horiz axis
						$res4 = _testIntersect($px1, $py1, $px2, $py2, 0, 1, 1, 1); // $y=1 horiz axis
						if (!$res1 && !$res2 && !$res3 && !$res4) {
							$inside = false;
						}
					}
					for ($i = ($ns - 1); $i >= 0; $i--) {
						if (isset($newarr[$i]['offset']))
							array_unshift($gradient_info['color'], $newarr[$i]);
					}
				}
			}

			// Gradient STOPs
			$stops = count($gradient_info['color']);
			if ($stops < 2) {
				return '';
			}

			$range = $gradient_info['color'][count($gradient_info['color']) - 1]['offset'] - $gradient_info['color'][0]['offset'];
			$min = $gradient_info['color'][0]['offset'];

			for ($i = 0; $i < ($stops); $i++) {
				if (!$gradient_info['color'][$i]['color']) {
					if ($gradient_info['colorspace'] == 'RGB')
						$gradient_info['color'][$i]['color'] = '0 0 0';
					else if ($gradient_info['colorspace'] == 'Gray')
						$gradient_info['color'][$i]['color'] = '0';
					else if ($gradient_info['colorspace'] == 'CMYK')
						$gradient_info['color'][$i]['color'] = '1 1 1 1';
				}
				$offset = ($gradient_info['color'][$i]['offset'] - $min) / $range;
				$this->mpdf_ref->gradients[$n]['stops'][] = array(
					'col' => $gradient_info['color'][$i]['color'],
					'opacity' => $gradient_info['color'][$i]['opacity'],
					'offset' => $offset);
				if ($gradient_info['color'][$i]['opacity'] < 1) {
					$trans = true;
				}
			}
			$grx1 = $x1 + ($x2 - $x1) * $gradient_info['color'][0]['offset'];
			$gry1 = $y1 + ($y2 - $y1) * $gradient_info['color'][0]['offset'];
			$grx2 = $x1 + ($x2 - $x1) * $gradient_info['color'][count($gradient_info['color']) - 1]['offset'];
			$gry2 = $y1 + ($y2 - $y1) * $gradient_info['color'][count($gradient_info['color']) - 1]['offset'];

			$this->mpdf_ref->gradients[$n]['coords'] = array($grx1, $gry1, $grx2, $gry2);

			$this->mpdf_ref->gradients[$n]['colorspace'] = $gradient_info['colorspace'];

			$this->mpdf_ref->gradients[$n]['type'] = 2;
			$this->mpdf_ref->gradients[$n]['fo'] = true;

			$this->mpdf_ref->gradients[$n]['extend'] = array('true', 'true');
			if ($trans) {
				$this->mpdf_ref->gradients[$n]['trans'] = true;
				$return .= ' /TGS' . ($n) . ' gs ';
			}
			$return .= ' /Sh' . ($n) . ' sh ';
			$return .= " Q\n";
		} else if ($gradient_info['type'] == 'radial') {
			if (isset($gradient_info['units']) && strtolower($gradient_info['units']) == 'userspaceonuse') {
				if ($w > $h) {
					$h = $w;
				} else {
					$w = $h;
				}
				if (isset($gradient_info['info']['x0'])) {
					$gradient_info['info']['x0'] = ($gradient_info['info']['x0'] - $x_offset) / $w;
				}
				if (isset($gradient_info['info']['y0'])) {
					$gradient_info['info']['y0'] = ($gradient_info['info']['y0'] - $y_offset) / $h;
				}
				if (isset($gradient_info['info']['x1'])) {
					$gradient_info['info']['x1'] = ($gradient_info['info']['x1'] - $x_offset) / $w;
				}
				if (isset($gradient_info['info']['y1'])) {
					$gradient_info['info']['y1'] = ($gradient_info['info']['y1'] - $y_offset) / $h;
				}
				if (isset($gradient_info['info']['r'])) {
					$gradient_info['info']['rx'] = $gradient_info['info']['r'] / $w;
				}
				if (isset($gradient_info['info']['r'])) {
					$gradient_info['info']['ry'] = $gradient_info['info']['r'] / $h;
				}
			}

			if (isset($gradient_info['info']['x0'])) {
				$x0 = $gradient_info['info']['x0'];
			} else {
				$x0 = 0.5;
			}
			if (isset($gradient_info['info']['y0'])) {
				$y0 = $gradient_info['info']['y0'];
			} else {
				$y0 = 0.5;
			}
			if (isset($gradient_info['info']['rx'])) {
				$rx = $gradient_info['info']['rx'];
			} else if (isset($gradient_info['info']['r'])) {
				$rx = $gradient_info['info']['r'];
			} else {
				$rx = 0.5;
			}
			if (isset($gradient_info['info']['ry'])) {
				$ry = $gradient_info['info']['ry'];
			} else if (isset($gradient_info['info']['r'])) {
				$ry = $gradient_info['info']['r'];
			} else {
				$ry = 0.5;
			}
			if (isset($gradient_info['info']['x1'])) {
				$x1 = $gradient_info['info']['x1'];
			} else {
				$x1 = $x0;
			}
			if (isset($gradient_info['info']['y1'])) {
				$y1 = $gradient_info['info']['y1'];
			} else {
				$y1 = $y0;
			}

			if (stristr($x1, '%') !== false) {
				$x1 = ($x1 + 0) / 100;
			}
			if (stristr($x0, '%') !== false) {
				$x0 = ($x0 + 0) / 100;
			}
			if (stristr($y1, '%') !== false) {
				$y1 = ($y1 + 0) / 100;
			}
			if (stristr($y0, '%') !== false) {
				$y0 = ($y0 + 0) / 100;
			}
			if (stristr($rx, '%') !== false) {
				$rx = ($rx + 0) / 100;
			}
			if (stristr($ry, '%') !== false) {
				$ry = ($ry + 0) / 100;
			}

			$bboxw = $w;
			$bboxh = $h;
			$usex = $x_offset;
			$usey = $y_offset;
			$usew = $bboxw;
			$useh = $bboxh;
			if (isset($gradient_info['units']) && strtolower($gradient_info['units']) == 'userspaceonuse') {
				$angle = rad2deg(atan2(($gradient_info['info']['y0'] - $gradient_info['info']['y1']), ($gradient_info['info']['x0'] - $gradient_info['info']['x1'])));
				if ($angle < 0) {
					$angle += 360;
				} else if ($angle > 360) {
					$angle -= 360;
				}
				if ($angle != 0 && $angle != 360 && $angle != 90 && $angle != 180 && $angle != 270) {
					if ($w >= $h) {
						$y1 *= $h / $w;
						$y0 *= $h / $w;
						$rx *= $h / $w;
						$ry *= $h / $w;
						$usew = $useh = $bboxw;
					} else {
						$x1 *= $w / $h;
						$x0 *= $w / $h;
						$rx *= $w / $h;
						$ry *= $w / $h;
						$usew = $useh = $bboxh;
					}
				}
			}
			$a = $usew;  // width
			$d = -$useh; // height
			$e = $usex;  // x- offset
			$f = -$usey; // -y-offset

			$r = $rx;


			$return .= sprintf('%.3F 0 0 %.3F %.3F %.3F cm ', $a * $this->kp, $d * $this->kp, $e * $this->kp, $f * $this->kp);

			// mPDF 5.0.039
			if (isset($gradient_info['units']) && strtolower($gradient_info['units']) == 'objectboundingbox') {
				if ($transformations) {
					$return .= $transformations;
				}
			}

			// mPDF 5.7.4
			// x1 and y1 (fx, fy) should be inside the circle defined by x0 y0 (cx, cy)
			// "If the point defined by fx and fy lies outside the circle defined by cx, cy and r, then the user agent shall set
			// the focal point to the intersection of the line from (cx, cy) to (fx, fy) with the circle defined by cx, cy and r."
			while (pow(($x1 - $x0), 2) + pow(($y1 - $y0), 2) >= pow($r, 2)) {
				// Gradually move along fx,fy towards cx,cy in 100'ths until meets criteria
				$x1 -= ($x1 - $x0) / 100;
				$y1 -= ($y1 - $y0) / 100;
			}


			if ($spread == 'R' || $spread == 'F') { // Repeat  /  Reflect
				$offs = array();
				for ($i = 0; $i < $ns; $i++) {
					$offs[$i] = $gradient_info['color'][$i]['offset'];
				}
				$gp = 0;
				$inside = true;
				while ($inside) {
					$gp++;
					for ($i = 0; $i < $ns; $i++) {
						if ($spread == 'F' && ($gp % 2) == 1) { // Reflect
							$gradient_info['color'][(($ns * $gp) + $i)] = $gradient_info['color'][(($ns * ($gp - 1)) + ($ns - $i - 1))];
							$tmp = $gp + (1 - $offs[($ns - $i - 1)]);
							$gradient_info['color'][(($ns * $gp) + $i)]['offset'] = $tmp;
						} else { // Reflect
							$gradient_info['color'][(($ns * $gp) + $i)] = $gradient_info['color'][$i];
							$tmp = $gp + $offs[$i];
							$gradient_info['color'][(($ns * $gp) + $i)]['offset'] = $tmp;
						}
						// IF STILL INSIDE BOX OR STILL VALID
						// TEST IF circle (perimeter) intersects with
						// or is enclosed
						// Point on axis to test
						$px = $x1 + ($x0 - $x1) * $tmp;
						$py = $y1 + ($y0 - $y1) * $tmp;
						$pr = $r * $tmp;
						$res = _testIntersectCircle($px, $py, $pr);
						if (!$res) {
							$inside = false;
						}
					}
				}
			}

			// Gradient STOPs
			$stops = count($gradient_info['color']);
			if ($stops < 2) {
				return '';
			}

			$range = $gradient_info['color'][count($gradient_info['color']) - 1]['offset'] - $gradient_info['color'][0]['offset'];
			$min = $gradient_info['color'][0]['offset'];

			for ($i = 0; $i < ($stops); $i++) {
				if (!$gradient_info['color'][$i]['color']) {
					if ($gradient_info['colorspace'] == 'RGB')
						$gradient_info['color'][$i]['color'] = '0 0 0';
					else if ($gradient_info['colorspace'] == 'Gray')
						$gradient_info['color'][$i]['color'] = '0';
					else if ($gradient_info['colorspace'] == 'CMYK')
						$gradient_info['color'][$i]['color'] = '1 1 1 1';
				}
				$offset = ($gradient_info['color'][$i]['offset'] - $min) / $range;
				$this->mpdf_ref->gradients[$n]['stops'][] = array(
					'col' => $gradient_info['color'][$i]['color'],
					'opacity' => $gradient_info['color'][$i]['opacity'],
					'offset' => $offset);
				if ($gradient_info['color'][$i]['opacity'] < 1) {
					$trans = true;
				}
			}
			$grx1 = $x1 + ($x0 - $x1) * $gradient_info['color'][0]['offset'];
			$gry1 = $y1 + ($y0 - $y1) * $gradient_info['color'][0]['offset'];
			$grx2 = $x1 + ($x0 - $x1) * $gradient_info['color'][count($gradient_info['color']) - 1]['offset'];
			$gry2 = $y1 + ($y0 - $y1) * $gradient_info['color'][count($gradient_info['color']) - 1]['offset'];
			$grir = $r * $gradient_info['color'][0]['offset'];
			$grr = $r * $gradient_info['color'][count($gradient_info['color']) - 1]['offset'];

			$this->mpdf_ref->gradients[$n]['coords'] = array($grx1, $gry1, $grx2, $gry2, abs($grr), abs($grir));

			$this->mpdf_ref->gradients[$n]['colorspace'] = $gradient_info['colorspace'];

			$this->mpdf_ref->gradients[$n]['type'] = 3;
			$this->mpdf_ref->gradients[$n]['fo'] = true;

			$this->mpdf_ref->gradients[$n]['extend'] = array('true', 'true');
			if (isset($trans) && $trans) {
				$this->mpdf_ref->gradients[$n]['trans'] = true;
				$return .= ' /TGS' . ($n) . ' gs ';
			}
			$return .= ' /Sh' . ($n) . ' sh ';
			$return .= " Q\n";
		}

		return $return;
	}

	function svgOffset($attribs)
	{
		// save all <svg> tag attributes
		$this->svg_attribs = $attribs;
		if (isset($this->svg_attribs['viewBox'])) {
			$vb = preg_split('/\s+/is', trim($this->svg_attribs['viewBox']));
			if (count($vb) == 4) {
				$this->svg_info['x'] = $vb[0];
				$this->svg_info['y'] = $vb[1];
				$this->svg_info['w'] = $vb[2];
				$this->svg_info['h'] = $vb[3];
//				return;
			}
		}
		$svg_w = 0;
		$svg_h = 0;
		if (isset($attribs['width']) && $attribs['width'])
			$svg_w = $this->mpdf_ref->ConvertSize($attribs['width']); // mm (interprets numbers as pixels)
		if (isset($attribs['height']) && $attribs['height'])
			$svg_h = $this->mpdf_ref->ConvertSize($attribs['height']); // mm


///*
		// mPDF 5.0.005
		if (isset($this->svg_info['w']) && $this->svg_info['w']) { // if 'w' set by viewBox
			if ($svg_w) { // if width also set, use these values to determine to set size of "pixel"
				$this->kp *= ($svg_w / 0.2645) / $this->svg_info['w'];
				$this->kf = ($svg_w / 0.2645) / $this->svg_info['w'];
			} else if ($svg_h) {
				$this->kp *= ($svg_h / 0.2645) / $this->svg_info['h'];
				$this->kf = ($svg_h / 0.2645) / $this->svg_info['h'];
			}
			return;
		}
//*/
		// Added to handle file without height or width specified
		if (!$svg_w && !$svg_h) {
			$svg_w = $svg_h = $this->mpdf_ref->blk[$this->mpdf_ref->blklvl]['inner_width'];
		} // DEFAULT
		if (!$svg_w) {
			$svg_w = $svg_h;
		}
		if (!$svg_h) {
			$svg_h = $svg_w;
		}

		$this->svg_info['x'] = 0;
		$this->svg_info['y'] = 0;
		$this->svg_info['w'] = $svg_w / 0.2645; // mm->pixels
		$this->svg_info['h'] = $svg_h / 0.2645; // mm->pixels
	}

	//
	// check if points are within svg, if not, set to max
	function svg_overflow($x, $y)
	{
		$x2 = $x;
		$y2 = $y;
		if (isset($this->svg_attribs['overflow'])) {
			if ($this->svg_attribs['overflow'] == 'hidden') {
				// Not sure if this is supposed to strip off units, but since I dont use any I will omlt this step
				$svg_w = preg_replace("/([0-9\.]*)(.*)/i", "$1", $this->svg_attribs['width']);
				$svg_h = preg_replace("/([0-9\.]*)(.*)/i", "$1", $this->svg_attribs['height']);

				// $xmax = floor($this->svg_attribs['width']);
				$xmax = floor($svg_w);
				$xmin = 0;
				// $ymax = floor(($this->svg_attribs['height'] * -1));
				$ymax = floor(($svg_h * -1));
				$ymin = 0;

				if ($x > $xmax)
					$x2 = $xmax; // right edge
				if ($x < $xmin)
					$x2 = $xmin; // left edge
				if ($y < $ymax)
					$y2 = $ymax; // bottom
				if ($y > $ymin)
					$y2 = $ymin; // top
			}
		}


		return array('x' => $x2, 'y' => $y2);
	}

	function svgDefineStyle($critere_style)
	{

		$tmp = count($this->svg_style) - 1;
		$current_style = $this->svg_style[$tmp];

		unset($current_style['transformations']);

		// TRANSFORM SCALE
		$transformations = '';
		if (isset($critere_style['transform'])) {
			preg_match_all('/(matrix|translate|scale|rotate|skewX|skewY)\((.*?)\)/is', $critere_style['transform'], $m);
			if (count($m[0])) {
				for ($i = 0; $i < count($m[0]); $i++) {
					$c = strtolower($m[1][$i]);
					$v = trim($m[2][$i]);
					$vv = preg_split('/[ ,]+/', $v);
					if ($c == 'matrix' && count($vv) == 6) {
						// mPDF 5.0.039
						// Note angle of rotation is reversed (from SVG to PDF), so vv[1] and vv[2] are negated
						$transformations .= sprintf(' %.3F %.3F %.3F %.3F %.3F %.3F cm ', $vv[0], -$vv[1], -$vv[2], $vv[3], $vv[4] * $this->kp, -$vv[5] * $this->kp);

						/*
						  // The long way of doing this??
						  // need to reverse angle of rotation from SVG to PDF
						  $sx=sqrt(pow($vv[0],2)+pow($vv[2],2));
						  if ($vv[0] < 0) { $sx *= -1; } // change sign
						  $sy=sqrt(pow($vv[1],2)+pow($vv[3],2));
						  if ($vv[3] < 0) { $sy *= -1; } // change sign

						  // rotation angle is
						  $t=atan2($vv[1],$vv[3]);
						  $t=atan2(-$vv[2],$vv[0]);	// Should be the same value or skew has been applied

						  // Reverse angle
						  $t *= -1;

						  // Rebuild matrix
						  $ma = $sx * cos($t);
						  $mb = $sy * sin($t);
						  $mc = -$sx * sin($t);
						  $md = $sy * cos($t);

						  // $transformations .= sprintf(' %.3F %.3F %.3F %.3F %.3F %.3F cm ', $ma, $mb, $mc, $md, $vv[4]*$this->kp, -$vv[5]*$this->kp);
						 */
					} else if ($c == 'translate' && count($vv)) {
						$tm[4] = $vv[0];
						if (count($vv) == 2) {
							$t_y = -$vv[1];
						} else {
							$t_y = 0;
						}
						$tm[5] = $t_y;
						$transformations .= sprintf(' 1 0 0 1 %.3F %.3F cm ', $tm[4] * $this->kp, $tm[5] * $this->kp);
					} else if ($c == 'scale' && count($vv)) {
						if (count($vv) == 2) {
							$s_y = $vv[1];
						} else {
							$s_y = $vv[0];
						}
						$tm[0] = $vv[0];
						$tm[3] = $s_y;
						$transformations .= sprintf(' %.3F 0 0 %.3F 0 0 cm ', $tm[0], $tm[3]);
					} else if ($c == 'rotate' && count($vv)) {
						$tm[0] = cos(deg2rad(-$vv[0]));
						$tm[1] = sin(deg2rad(-$vv[0]));
						$tm[2] = -$tm[1];
						$tm[3] = $tm[0];
						if (count($vv) == 3) {
							$transformations .= sprintf(' 1 0 0 1 %.3F %.3F cm ', $vv[1] * $this->kp, -$vv[2] * $this->kp);
						}
						$transformations .= sprintf(' %.3F %.3F %.3F %.3F 0 0 cm ', $tm[0], $tm[1], $tm[2], $tm[3]);
						if (count($vv) == 3) {
							$transformations .= sprintf(' 1 0 0 1 %.3F %.3F cm ', -$vv[1] * $this->kp, $vv[2] * $this->kp);
						}
					} else if ($c == 'skewx' && count($vv)) {
						$tm[2] = tan(deg2rad(-$vv[0]));
						$transformations .= sprintf(' 1 0 %.3F 1 0 0 cm ', $tm[2]);
					} else if ($c == 'skewy' && count($vv)) {
						$tm[1] = tan(deg2rad(-$vv[0]));
						$transformations .= sprintf(' 1 %.3F 0 1 0 0 cm ', $tm[1]);
					}
				}
			}
			$current_style['transformations'] = $transformations;
		}

		if (isset($critere_style['style'])) {
			if (preg_match('/fill:\s*rgb\((\d+),\s*(\d+),\s*(\d+)\)/i', $critere_style['style'], $m)) { // mPDF 5.7.2
				$current_style['fill'] = '#' . str_pad(dechex($m[1]), 2, "0", STR_PAD_LEFT) . str_pad(dechex($m[2]), 2, "0", STR_PAD_LEFT) . str_pad(dechex($m[3]), 2, "0", STR_PAD_LEFT);
			} else {
				$tmp = preg_replace("/(.*)fill:\s*([a-z0-9#_()]*|none)(.*)/i", "$2", $critere_style['style']);
				if ($tmp && $tmp != 'inherit' && $tmp != $critere_style['style']) {
					$current_style['fill'] = $tmp;
				}
			}

			// mPDF 5.7.2
			if ((preg_match("/[^-]opacity:\s*([a-z0-9.]*|none)/i", $critere_style['style'], $m) ||
				preg_match("/^opacity:\s*([a-z0-9.]*|none)/i", $critere_style['style'], $m)) && $m[1] != 'inherit') {
				$current_style['fill-opacity'] = $m[1];
				$current_style['stroke-opacity'] = $m[1];
			}

			$tmp = preg_replace("/(.*)fill-opacity:\s*([a-z0-9.]*|none)(.*)/i", "$2", $critere_style['style']);
			if ($tmp && $tmp != 'inherit' && $tmp != $critere_style['style']) {
				$current_style['fill-opacity'] = $tmp;
			}

			$tmp = preg_replace("/(.*)fill-rule:\s*([a-z0-9#]*|none)(.*)/i", "$2", $critere_style['style']);
			if ($tmp && $tmp != 'inherit' && $tmp != $critere_style['style']) {
				$current_style['fill-rule'] = $tmp;
			}

			if (preg_match('/stroke:\s*rgb\((\d+),\s*(\d+),\s*(\d+)\)/', $critere_style['style'], $m)) {
				$current_style['stroke'] = '#' . str_pad(dechex($m[1]), 2, "0", STR_PAD_LEFT) . str_pad(dechex($m[2]), 2, "0", STR_PAD_LEFT) . str_pad(dechex($m[3]), 2, "0", STR_PAD_LEFT);
			} else {
				$tmp = preg_replace("/(.*)stroke:\s*([a-z0-9#]*|none)(.*)/i", "$2", $critere_style['style']);
				if ($tmp && $tmp != 'inherit' && $tmp != $critere_style['style']) {
					$current_style['stroke'] = $tmp;
				}
			}

			$tmp = preg_replace("/(.*)stroke-linecap:\s*([a-z0-9#]*|none)(.*)/i", "$2", $critere_style['style']);
			if ($tmp && $tmp != 'inherit' && $tmp != $critere_style['style']) {
				$current_style['stroke-linecap'] = $tmp;
			}

			$tmp = preg_replace("/(.*)stroke-linejoin:\s*([a-z0-9#]*|none)(.*)/i", "$2", $critere_style['style']);
			if ($tmp && $tmp != 'inherit' && $tmp != $critere_style['style']) {
				$current_style['stroke-linejoin'] = $tmp;
			}

			$tmp = preg_replace("/(.*)stroke-miterlimit:\s*([a-z0-9#]*|none)(.*)/i", "$2", $critere_style['style']);
			if ($tmp && $tmp != 'inherit' && $tmp != $critere_style['style']) {
				$current_style['stroke-miterlimit'] = $tmp;
			}

			$tmp = preg_replace("/(.*)stroke-opacity:\s*([a-z0-9.]*|none)(.*)/i", "$2", $critere_style['style']);
			if ($tmp && $tmp != 'inherit' && $tmp != $critere_style['style']) {
				$current_style['stroke-opacity'] = $tmp;
			}

			$tmp = preg_replace("/(.*)stroke-width:\s*([a-z0-9.]*|none)(.*)/i", "$2", $critere_style['style']);
			if ($tmp && $tmp != 'inherit' && $tmp != $critere_style['style']) {
				$current_style['stroke-width'] = $tmp;
			}

			$tmp = preg_replace("/(.*)stroke-dasharray:\s*([a-z0-9., ]*|none)(.*)/i", "$2", $critere_style['style']);
			if ($tmp && $tmp != 'inherit' && $tmp != $critere_style['style']) {
				$current_style['stroke-dasharray'] = $tmp;
			}

			$tmp = preg_replace("/(.*)stroke-dashoffset:\s*([a-z0-9.]*|none)(.*)/i", "$2", $critere_style['style']);
			if ($tmp && $tmp != 'inherit' && $tmp != $critere_style['style']) {
				$current_style['stroke-dashoffset'] = $tmp;
			}
		}
		// mPDF 5.7.2
		if (isset($critere_style['opacity']) && $critere_style['opacity'] != 'inherit') {
			$current_style['fill-opacity'] = $critere_style['opacity'];
			$current_style['stroke-opacity'] = $critere_style['opacity'];
		}

		if (isset($critere_style['fill']) && $critere_style['fill'] != 'inherit') {
			$current_style['fill'] = $critere_style['fill'];
		}

		if (isset($critere_style['fill-opacity']) && $critere_style['fill-opacity'] != 'inherit') {
			$current_style['fill-opacity'] = $critere_style['fill-opacity'];
		}

		if (isset($critere_style['fill-rule']) && $critere_style['fill-rule'] != 'inherit') {
			$current_style['fill-rule'] = $critere_style['fill-rule'];
		}

		if (isset($critere_style['stroke']) && $critere_style['stroke'] != 'inherit') {
			$current_style['stroke'] = $critere_style['stroke'];
		}

		if (isset($critere_style['stroke-linecap']) && $critere_style['stroke-linecap'] != 'inherit') {
			$current_style['stroke-linecap'] = $critere_style['stroke-linecap'];
		}

		if (isset($critere_style['stroke-linejoin']) && $critere_style['stroke-linejoin'] != 'inherit') {
			$current_style['stroke-linejoin'] = $critere_style['stroke-linejoin'];
		}

		if (isset($critere_style['stroke-miterlimit']) && $critere_style['stroke-miterlimit'] != 'inherit') {
			$current_style['stroke-miterlimit'] = $critere_style['stroke-miterlimit'];
		}

		if (isset($critere_style['stroke-opacity']) && $critere_style['stroke-opacity'] != 'inherit') {
			$current_style['stroke-opacity'] = $critere_style['stroke-opacity'];
		}

		if (isset($critere_style['stroke-width']) && $critere_style['stroke-width'] != 'inherit') {
			$current_style['stroke-width'] = $critere_style['stroke-width'];
		}

		if (isset($critere_style['stroke-dasharray']) && $critere_style['stroke-dasharray'] != 'inherit') {
			$current_style['stroke-dasharray'] = $critere_style['stroke-dasharray'];
		}
		if (isset($critere_style['stroke-dashoffset']) && $critere_style['stroke-dashoffset'] != 'inherit') {
			$current_style['stroke-dashoffset'] = $critere_style['stroke-dashoffset'];
		}

		// Used as indirect setting for currentColor
		if (isset($critere_style['color']) && $critere_style['color'] != 'inherit') {
			$current_style['color'] = $critere_style['color'];
		}

		return $current_style;
	}

	//
	//	Cette fonction ecrit le style dans le stream svg.
	function svgStyle($critere_style, $attribs, $element)
	{
		$path_style = '';
		$fill_gradient = '';
		$w = '';
		$style = '';
		if (substr_count($critere_style['fill'], 'url') > 0 && $element != 'line') {
			//
			// couleur degradé
			$id_gradient = preg_replace("/url\(#([\w_]*)\)/i", "$1", $critere_style['fill']);
			if ($id_gradient != $critere_style['fill']) {
				if (isset($this->svg_gradient[$id_gradient])) {
					$fill_gradient = $this->svgGradient($this->svg_gradient[$id_gradient], $attribs, $element);
					if ($fill_gradient) {
						$path_style = "q ";
						$w = "W";
						$style .= 'N';
					}
				}
			}
		}
		// Used as indirect setting for currentColor
		else if (strtolower($critere_style['fill']) == 'currentcolor' && $element != 'line') {
			$col = $this->mpdf_ref->ConvertColor($critere_style['color']);
			if ($col) {
				if ($col{0} == 5) {
					$critere_style['fill-opacity'] = ord($col{4} / 100);
				} // RGBa
				if ($col{0} == 6) {
					$critere_style['fill-opacity'] = ord($col{5} / 100);
				} // CMYKa
				$path_style .= $this->mpdf_ref->SetFColor($col, true) . ' ';
				$style .= 'F';
			}
		} else if ($critere_style['fill'] != 'none' && $element != 'line') {
			$col = $this->mpdf_ref->ConvertColor($critere_style['fill']);
			if ($col) {
				if ($col{0} == 5) {
					$critere_style['fill-opacity'] = ord($col{4} / 100);
				} // RGBa
				if ($col{0} == 6) {
					$critere_style['fill-opacity'] = ord($col{5} / 100);
				} // CMYKa
				$path_style .= $this->mpdf_ref->SetFColor($col, true) . ' ';
				$style .= 'F';
			}
		}
		if (substr_count($critere_style['stroke'], 'url') > 0) {
			/*
			  // Cannot put a gradient on a "stroke" in PDF?
			  $id_gradient = preg_replace("/url\(#([\w_]*)\)/i","$1",$critere_style['stroke']);
			  if ($id_gradient != $critere_style['stroke']) {
			  if (isset($this->svg_gradient[$id_gradient])) {
			  $fill_gradient = $this->svgGradient($this->svg_gradient[$id_gradient], $attribs, $element);
			  if ($fill_gradient) {
			  $path_style = "q ";
			  $w = "W";
			  $style .= 'D';
			  }
			  }
			  }
			 */
		}
		// Used as indirect setting for currentColor
		else if (strtolower($critere_style['stroke']) == 'currentcolor') {
			$col = $this->mpdf_ref->ConvertColor($critere_style['color']);
			if ($col) {
				if ($col{0} == 5) {
					$critere_style['stroke-opacity'] = ord($col{4} / 100);
				} // RGBa
				if ($col{0} == 6) {
					$critere_style['stroke-opacity'] = ord($col{5} / 100);
				} // CMYKa
				$path_style .= $this->mpdf_ref->SetDColor($col, true) . ' ';
				$style .= 'D';
				$lw = $this->ConvertSVGSizePixels($critere_style['stroke-width']);
				$path_style .= sprintf('%.3F w ', $lw * $this->kp);
			}
		} else if ($critere_style['stroke'] != 'none') {
			$col = $this->mpdf_ref->ConvertColor($critere_style['stroke']);
			if ($col) {
				// mPDF 5.0.051
				// mPDF 5.3.74
				if ($col{0} == 5) {
					$critere_style['stroke-opacity'] = ord($col{4} / 100);
				} // RGBa
				if ($col{0} == 6) {
					$critere_style['stroke-opacity'] = ord($col{5} / 100);
				} // CMYKa
				$path_style .= $this->mpdf_ref->SetDColor($col, true) . ' ';
				$style .= 'D';
				$lw = $this->ConvertSVGSizePixels($critere_style['stroke-width']);
				$path_style .= sprintf('%.3F w ', $lw * $this->kp);
			}
		}


		if ($critere_style['stroke'] != 'none') {
			if ($critere_style['stroke-linejoin'] == 'miter') {
				$path_style .= ' 0 j ';
			} else if ($critere_style['stroke-linejoin'] == 'round') {
				$path_style .= ' 1 j ';
			} else if ($critere_style['stroke-linejoin'] == 'bevel') {
				$path_style .= ' 2 j ';
			}

			if ($critere_style['stroke-linecap'] == 'butt') {
				$path_style .= ' 0 J ';
			} else if ($critere_style['stroke-linecap'] == 'round') {
				$path_style .= ' 1 J ';
			} else if ($critere_style['stroke-linecap'] == 'square') {
				$path_style .= ' 2 J ';
			}

			if (isset($critere_style['stroke-miterlimit'])) {
				if ($critere_style['stroke-miterlimit'] == 'none') {

				} else if (preg_match('/^[\d.]+$/', $critere_style['stroke-miterlimit'])) {
					$path_style .= sprintf('%.2F M ', $critere_style['stroke-miterlimit']);
				}
			}
			if (isset($critere_style['stroke-dasharray'])) {
				$off = 0;
				$d = preg_split('/[ ,]/', $critere_style['stroke-dasharray']);
				if (count($d) == 1 && $d[0] == 0) {
					$path_style .= '[] 0 d ';
				} else {
					if (count($d) % 2 == 1) {
						$d = array_merge($d, $d);
					} // 5, 3, 1 => 5,3,1,5,3,1  OR 3 => 3,3
					$arr = '';
					for ($i = 0; $i < count($d); $i+=2) {
						$arr .= sprintf('%.3F %.3F ', $d[$i] * $this->kp, $d[$i + 1] * $this->kp);
					}
					if (isset($critere_style['stroke-dashoffset'])) {
						$off = $critere_style['stroke-dashoffset'] + 0;
					}
					$path_style .= sprintf('[%s] %.3F d ', $arr, $off * $this->kp);
				}
			}
		}

		if ($critere_style['fill-rule'] == 'evenodd') {
			$fr = '*';
		} else {
			$fr = '';
		}

		if (isset($critere_style['fill-opacity'])) {
			$opacity = 1;
			if ($critere_style['fill-opacity'] == 0) {
				$opacity = 0;
			} else if ($critere_style['fill-opacity'] > 1) {
				$opacity = 1;
			} else if ($critere_style['fill-opacity'] > 0) {
				$opacity = $critere_style['fill-opacity'];
			} else if ($critere_style['fill-opacity'] < 0) {
				$opacity = 0;
			}
			$gs = $this->mpdf_ref->AddExtGState(array('ca' => $opacity, 'BM' => '/Normal'));
			$this->mpdf_ref->extgstates[$gs]['fo'] = true;
			$path_style .= sprintf(' /GS%d gs ', $gs);
		}

		if (isset($critere_style['stroke-opacity'])) {
			$opacity = 1;
			if ($critere_style['stroke-opacity'] == 0) {
				$opacity = 0;
			} else if ($critere_style['stroke-opacity'] > 1) {
				$opacity = 1;
			} else if ($critere_style['stroke-opacity'] > 0) {
				$opacity = $critere_style['stroke-opacity'];
			} else if ($critere_style['stroke-opacity'] < 0) {
				$opacity = 0;
			}
			$gs = $this->mpdf_ref->AddExtGState(array('CA' => $opacity, 'BM' => '/Normal'));
			$this->mpdf_ref->extgstates[$gs]['fo'] = true;
			$path_style .= sprintf(' /GS%d gs ', $gs);
		}

		switch ($style) {
			case 'F':
				$op = 'f';
				break;
			case 'FD':
				$op = 'B';
				break;
			case 'ND':
				$op = 'S';
				break;
			case 'D':
				$op = 'S';
				break;
			default:
				$op = 'n';
		}

		$prestyle = $path_style . ' ';
		$poststyle = $w . ' ' . $op . $fr . ' ' . $fill_gradient . "\n";
		return array($prestyle, $poststyle);
	}

	//	fonction retracant les <path />
	function svgPath($command, $arguments)
	{
		$path_cmd = '';
		$newsubpath = false;
		// mPDF 5.0.039
		$minl = $this->pathBBox[0];
		$mint = $this->pathBBox[1];
		$maxr = $this->pathBBox[2] + $this->pathBBox[0];
		$maxb = $this->pathBBox[3] + $this->pathBBox[1];

		$start = array($this->xbase, -$this->ybase);

		preg_match_all('/[\-^]?[\d.]+(e[\-]?[\d]+){0,1}/i', $arguments, $a, PREG_SET_ORDER);

		//	if the command is a capital letter, the coords go absolute, otherwise relative
		if (strtolower($command) == $command)
			$relative = true;
		else
			$relative = false;


		$ile_argumentow = count($a);

		//	each command may have different needs for arguments [1 to 8]

		switch (strtolower($command)) {
			case 'm': // move
				for ($i = 0; $i < $ile_argumentow; $i+=2) {
					$x = $a[$i][0];
					$y = $a[$i + 1][0];
					if ($relative) {
						$pdfx = ($this->xbase + $x);
						$pdfy = ($this->ybase - $y);
						$this->xbase += $x;
						$this->ybase += -$y;
					} else {
						$pdfx = $x;
						$pdfy = -$y;
						$this->xbase = $x;
						$this->ybase = -$y;
					}
					$pdf_pt = $this->svg_overflow($pdfx, $pdfy);
					$minl = min($minl, $pdf_pt['x']);
					$maxr = max($maxr, $pdf_pt['x']);
					$mint = min($mint, -$pdf_pt['y']);
					$maxb = max($maxb, -$pdf_pt['y']);
					if ($i == 0)
						$path_cmd .= sprintf('%.3F %.3F m ', $pdf_pt['x'] * $this->kp, $pdf_pt['y'] * $this->kp);
					else
						$path_cmd .= sprintf('%.3F %.3F l ', $pdf_pt['x'] * $this->kp, $pdf_pt['y'] * $this->kp);
					// mPDF 4.4.003  Save start points of subpath
					if ($this->subPathInit) {
						$this->spxstart = $this->xbase;
						$this->spystart = $this->ybase;
						$this->subPathInit = false;
					}
				}
				break;
			case 'l': // a simple line
				for ($i = 0; $i < $ile_argumentow; $i+=2) {
					$x = ($a[$i][0]);
					$y = ($a[$i + 1][0]);
					if ($relative) {
						$pdfx = ($this->xbase + $x);
						$pdfy = ($this->ybase - $y);
						$this->xbase += $x;
						$this->ybase += -$y;
					} else {
						$pdfx = $x;
						$pdfy = -$y;
						$this->xbase = $x;
						$this->ybase = -$y;
					}
					$pdf_pt = $this->svg_overflow($pdfx, $pdfy);
					$minl = min($minl, $pdf_pt['x']);
					$maxr = max($maxr, $pdf_pt['x']);
					$mint = min($mint, -$pdf_pt['y']);
					$maxb = max($maxb, -$pdf_pt['y']);
					$path_cmd .= sprintf('%.3F %.3F l ', $pdf_pt['x'] * $this->kp, $pdf_pt['y'] * $this->kp);
				}
				break;
			case 'h': // a very simple horizontal line
				for ($i = 0; $i < $ile_argumentow; $i++) {
					$x = ($a[$i][0]);
					if ($relative) {
						$y = 0;
						$pdfx = ($this->xbase + $x);
						$pdfy = ($this->ybase - $y);
						$this->xbase += $x;
						$this->ybase += -$y;
					} else {
						$y = -$this->ybase;
						$pdfx = $x;
						$pdfy = -$y;
						$this->xbase = $x;
						$this->ybase = -$y;
					}
					$pdf_pt = $this->svg_overflow($pdfx, $pdfy);
					$minl = min($minl, $pdf_pt['x']);
					$maxr = max($maxr, $pdf_pt['x']);
					$mint = min($mint, -$pdf_pt['y']);
					$maxb = max($maxb, -$pdf_pt['y']);
					$path_cmd .= sprintf('%.3F %.3F l ', $pdf_pt['x'] * $this->kp, $pdf_pt['y'] * $this->kp);
				}
				break;
			case 'v': // the simplest line, vertical
				for ($i = 0; $i < $ile_argumentow; $i++) {
					$y = ($a[$i][0]);
					if ($relative) {
						$x = 0;
						$pdfx = ($this->xbase + $x);
						$pdfy = ($this->ybase - $y);
						$this->xbase += $x;
						$this->ybase += -$y;
					} else {
						$x = $this->xbase;
						$pdfx = $x;
						$pdfy = -$y;
						$this->xbase = $x;
						$this->ybase = -$y;
					}
					$pdf_pt = $this->svg_overflow($pdfx, $pdfy);
					$minl = min($minl, $pdf_pt['x']);
					$maxr = max($maxr, $pdf_pt['x']);
					$mint = min($mint, -$pdf_pt['y']);
					$maxb = max($maxb, -$pdf_pt['y']);
					$path_cmd .= sprintf('%.3F %.3F l ', $pdf_pt['x'] * $this->kp, $pdf_pt['y'] * $this->kp);
				}
				break;
			case 's': // bezier with first vertex equal first control
				// mPDF 4.4.003
				if (!($this->lastcommand == 'C' || $this->lastcommand == 'c' || $this->lastcommand == 'S' || $this->lastcommand == 's')) {
					$this->lastcontrolpoints = array(0, 0);
				}
				for ($i = 0; $i < $ile_argumentow; $i += 4) {
					$x1 = $this->lastcontrolpoints[0];
					$y1 = $this->lastcontrolpoints[1];
					$x2 = ($a[$i][0]);
					$y2 = ($a[$i + 1][0]);
					$x = ($a[$i + 2][0]);
					$y = ($a[$i + 3][0]);
					if ($relative) {
						$pdfx1 = ($this->xbase + $x1);
						$pdfy1 = ($this->ybase - $y1);
						$pdfx2 = ($this->xbase + $x2);
						$pdfy2 = ($this->ybase - $y2);
						$pdfx = ($this->xbase + $x);
						$pdfy = ($this->ybase - $y);
						$this->xbase += $x;
						$this->ybase += -$y;
					} else {
						$pdfx1 = $this->xbase + $x1;
						$pdfy1 = $this->ybase - $y1;
						$pdfx2 = $x2;
						$pdfy2 = -$y2;
						$pdfx = $x;
						$pdfy = -$y;
						$this->xbase = $x;
						$this->ybase = -$y;
					}
					$this->lastcontrolpoints = array(($pdfx - $pdfx2), -($pdfy - $pdfy2)); // mPDF 4.4.003 always relative

					$pdf_pt = $this->svg_overflow($pdfx, $pdfy);

					$curves = array($pdfx1, -$pdfy1, $pdfx2, -$pdfy2, $pdfx, -$pdfy);
					$bx = calc_bezier_bbox($start, $curves);
					$minl = min($minl, $bx[0]);
					$maxr = max($maxr, $bx[2]);
					$mint = min($mint, $bx[1]);
					$maxb = max($maxb, $bx[3]);

					if (($pdf_pt['x'] != $pdfx) || ($pdf_pt['y'] != $pdfy)) {
						$path_cmd .= sprintf('%.3F %.3F l ', $pdf_pt['x'] * $this->kp, $pdf_pt['y'] * $this->kp);
					} else {
						$path_cmd .= sprintf('%.3F %.3F %.3F %.3F %.3F %.3F c ', $pdfx1 * $this->kp, $pdfy1 * $this->kp, $pdfx2 * $this->kp, $pdfy2 * $this->kp, $pdfx * $this->kp, $pdfy * $this->kp);
					}
				}
				break;
			case 'c': // bezier with second vertex equal second control
				for ($i = 0; $i < $ile_argumentow; $i += 6) {
					$x1 = ($a[$i][0]);
					$y1 = ($a[$i + 1][0]);
					$x2 = ($a[$i + 2][0]);
					$y2 = ($a[$i + 3][0]);
					$x = ($a[$i + 4][0]);
					$y = ($a[$i + 5][0]);


					if ($relative) {
						$pdfx1 = ($this->xbase + $x1);
						$pdfy1 = ($this->ybase - $y1);
						$pdfx2 = ($this->xbase + $x2);
						$pdfy2 = ($this->ybase - $y2);
						$pdfx = ($this->xbase + $x);
						$pdfy = ($this->ybase - $y);
						$this->xbase += $x;
						$this->ybase += -$y;
					} else {
						$pdfx1 = $x1;
						$pdfy1 = -$y1;
						$pdfx2 = $x2;
						$pdfy2 = -$y2;
						$pdfx = $x;
						$pdfy = -$y;
						$this->xbase = $x;
						$this->ybase = -$y;
					}
					$this->lastcontrolpoints = array(($pdfx - $pdfx2), -($pdfy - $pdfy2)); // mPDF 4.4.003 always relative
					// $pdf_pt2 = $this->svg_overflow($pdfx2,$pdfy2);
					// $pdf_pt1 = $this->svg_overflow($pdfx1,$pdfy1);
					$pdf_pt = $this->svg_overflow($pdfx, $pdfy);

					$curves = array($pdfx1, -$pdfy1, $pdfx2, -$pdfy2, $pdfx, -$pdfy);
					$bx = calc_bezier_bbox($start, $curves);
					$minl = min($minl, $bx[0]);
					$maxr = max($maxr, $bx[2]);
					$mint = min($mint, $bx[1]);
					$maxb = max($maxb, $bx[3]);

					if (($pdf_pt['x'] != $pdfx) || ($pdf_pt['y'] != $pdfy)) {
						$path_cmd .= sprintf('%.3F %.3F l ', $pdf_pt['x'] * $this->kp, $pdf_pt['y'] * $this->kp);
					} else {
						$path_cmd .= sprintf('%.3F %.3F %.3F %.3F %.3F %.3F c ', $pdfx1 * $this->kp, $pdfy1 * $this->kp, $pdfx2 * $this->kp, $pdfy2 * $this->kp, $pdfx * $this->kp, $pdfy * $this->kp);
					}
				}
				break;

			case 'q': // bezier quadratic avec point de control
				for ($i = 0; $i < $ile_argumentow; $i += 4) {
					$x1 = ($a[$i][0]);
					$y1 = ($a[$i + 1][0]);
					$x = ($a[$i + 2][0]);
					$y = ($a[$i + 3][0]);
					if ($relative) {
						$pdfx = ($this->xbase + $x);
						$pdfy = ($this->ybase - $y);

						$pdfx1 = ($this->xbase + ($x1 * 2 / 3));
						$pdfy1 = ($this->ybase - ($y1 * 2 / 3));
						// mPDF 4.4.003
						$pdfx2 = $pdfx1 + 1 / 3 * ($x);
						$pdfy2 = $pdfy1 + 1 / 3 * (-$y);

						$this->xbase += $x;
						$this->ybase += -$y;
					} else {
						$pdfx = $x;
						$pdfy = -$y;

						$pdfx1 = ($this->xbase + (($x1 - $this->xbase) * 2 / 3));
						$pdfy1 = ($this->ybase - (($y1 + $this->ybase) * 2 / 3));

						$pdfx2 = ($x + (($x1 - $x) * 2 / 3));
						$pdfy2 = (-$y - (($y1 - $y) * 2 / 3));

						// mPDF 4.4.003
						$pdfx2 = $pdfx1 + 1 / 3 * ($x - $this->xbase);
						$pdfy2 = $pdfy1 + 1 / 3 * (-$y - $this->ybase);

						$this->xbase = $x;
						$this->ybase = -$y;
					}
					$this->lastcontrolpoints = array(($pdfx - $pdfx2), -($pdfy - $pdfy2)); // mPDF 4.4.003 always relative

					$pdf_pt = $this->svg_overflow($pdfx, $pdfy);

					$curves = array($pdfx1, -$pdfy1, $pdfx2, -$pdfy2, $pdfx, -$pdfy);
					$bx = calc_bezier_bbox($start, $curves);
					$minl = min($minl, $bx[0]);
					$maxr = max($maxr, $bx[2]);
					$mint = min($mint, $bx[1]);
					$maxb = max($maxb, $bx[3]);

					if (($pdf_pt['x'] != $pdfx) || ($pdf_pt['y'] != $pdfy)) {
						$path_cmd .= sprintf('%.3F %.3F l ', $pdf_pt['x'] * $this->kp, $pdf_pt['y'] * $this->kp);
					} else {
						$path_cmd .= sprintf('%.3F %.3F %.3F %.3F %.3F %.3F c ', $pdfx1 * $this->kp, $pdfy1 * $this->kp, $pdfx2 * $this->kp, $pdfy2 * $this->kp, $pdfx * $this->kp, $pdfy * $this->kp);
					}
				}
				break;
			case 't': // bezier quadratic avec point de control simetrique a lancien point de control
				if (!($this->lastcommand == 'Q' || $this->lastcommand == 'q' || $this->lastcommand == 'T' || $this->lastcommand == 't')) {
					$this->lastcontrolpoints = array(0, 0);
				}
				for ($i = 0; $i < $ile_argumentow; $i += 2) {
					$x = ($a[$i][0]);
					$y = ($a[$i + 1][0]);

					$x1 = $this->lastcontrolpoints[0];
					$y1 = $this->lastcontrolpoints[1];

					if ($relative) {
						$pdfx = ($this->xbase + $x);
						$pdfy = ($this->ybase - $y);

						$pdfx1 = ($this->xbase + ($x1));
						$pdfy1 = ($this->ybase - ($y1));
						// mPDF 4.4.003
						$pdfx2 = $pdfx1 + 1 / 3 * ($x);
						$pdfy2 = $pdfy1 + 1 / 3 * (-$y);

						$this->xbase += $x;
						$this->ybase += -$y;
					} else {
						$pdfx = $x;
						$pdfy = -$y;

						$pdfx1 = ($this->xbase + ($x1));
						$pdfy1 = ($this->ybase - ($y1));
						// mPDF 4.4.003
						$pdfx2 = $pdfx1 + 1 / 3 * ($x - $this->xbase);
						$pdfy2 = $pdfy1 + 1 / 3 * (-$y - $this->ybase);

						$this->xbase = $x;
						$this->ybase = -$y;
					}

					$this->lastcontrolpoints = array(($pdfx - $pdfx2), -($pdfy - $pdfy2)); // mPDF 4.4.003 always relative

					$curves = array($pdfx1, -$pdfy1, $pdfx2, -$pdfy2, $pdfx, -$pdfy);
					$bx = calc_bezier_bbox($start, $curves);
					$minl = min($minl, $bx[0]);
					$maxr = max($maxr, $bx[2]);
					$mint = min($mint, $bx[1]);
					$maxb = max($maxb, $bx[3]);

					$path_cmd .= sprintf('%.3F %.3F %.3F %.3F %.3F %.3F c ', $pdfx1 * $this->kp, $pdfy1 * $this->kp, $pdfx2 * $this->kp, $pdfy2 * $this->kp, $pdfx * $this->kp, $pdfy * $this->kp);
				}

				break;
			case 'a': // Elliptical arc
				for ($i = 0; $i < $ile_argumentow; $i += 7) {
					$rx = ($a[$i][0]);
					$ry = ($a[$i + 1][0]);
					$angle = ($a[$i + 2][0]); //x-axis-rotation
					$largeArcFlag = ($a[$i + 3][0]);
					$sweepFlag = ($a[$i + 4][0]);
					$x2 = ($a[$i + 5][0]);
					$y2 = ($a[$i + 6][0]);
					$x1 = $this->xbase;
					$y1 = -$this->ybase;
					if ($relative) {
						$x2 = $this->xbase + $x2;
						$y2 = -$this->ybase + $y2;
						$this->xbase += ($a[$i + 5][0]);
						$this->ybase += -($a[$i + 6][0]);
					} else {
						$this->xbase = $x2;
						$this->ybase = -$y2;
					}
					list($pcmd, $bounds) = $this->Arcto($x1, $y1, $x2, $y2, $rx, $ry, $angle, $largeArcFlag, $sweepFlag);
					$minl = min($minl, $x2, min($bounds[0]));
					$maxr = max($maxr, $x2, max($bounds[0]));
					$mint = min($mint, $y2, min($bounds[1]));
					$maxb = max($maxb, $y2, max($bounds[1]));
					$path_cmd .= $pcmd;
				}
				break;
			case'z':
				$path_cmd .= 'h ';
				$this->subPathInit = true;
				$newsubpath = true;
				$this->xbase = $this->spxstart;
				$this->ybase = $this->spystart;
				break;
			default:
				break;
		}

		if (!$newsubpath) {
			$this->subPathInit = false;
		}
		$this->lastcommand = $command;
		// mPDF 5.0.039
		$this->pathBBox[0] = $minl;
		$this->pathBBox[1] = $mint;
		$this->pathBBox[2] = $maxr - $this->pathBBox[0];
		$this->pathBBox[3] = $maxb - $this->pathBBox[1];
		return $path_cmd;
	}

	function Arcto($x1, $y1, $x2, $y2, $rx, $ry, $angle, $largeArcFlag, $sweepFlag)
	{

		$bounds = array(0 => array($x1, $x2), 1 => array($y1, $y2));
		// 1. Treat out-of-range parameters as described in
		// http://www.w3.org/TR/SVG/implnote.html#ArcImplementationNotes
		// If the endpoints (x1, y1) and (x2, y2) are identical, then this
		// is equivalent to omitting the elliptical arc segment entirely
		if ($x1 == $x2 && $y1 == $y2)
			return array('', $bounds); // mPD 5.0.040


// If rX = 0 or rY = 0 then this arc is treated as a straight line
		// segment (a "lineto") joining the endpoints.
		if ($rx == 0.0 || $ry == 0.0) {
			//   return array(Lineto(x2, y2), $bounds);
		}

		// If rX or rY have negative signs, these are dropped; the absolute
		// value is used instead.
		if ($rx < 0.0)
			$rx = -$rx;
		if ($ry < 0.0)
			$ry = -$ry;

		// 2. convert to center parameterization as shown in
		// http://www.w3.org/TR/SVG/implnote.html
		$sinPhi = sin(deg2rad($angle));
		$cosPhi = cos(deg2rad($angle));

		$x1dash = $cosPhi * ($x1 - $x2) / 2.0 + $sinPhi * ($y1 - $y2) / 2.0;
		$y1dash = -$sinPhi * ($x1 - $x2) / 2.0 + $cosPhi * ($y1 - $y2) / 2.0;


		$numerator = $rx * $rx * $ry * $ry - $rx * $rx * $y1dash * $y1dash - $ry * $ry * $x1dash * $x1dash;

		if ($numerator < 0.0) {
			//  If rX , rY and are such that there is no solution (basically,
			//  the ellipse is not big enough to reach from (x1, y1) to (x2,
			//  y2)) then the ellipse is scaled up uniformly until there is
			//  exactly one solution (until the ellipse is just big enough).
			// -> find factor s, such that numerator' with rx'=s*rx and
			//    ry'=s*ry becomes 0 :
			$s = sqrt(1.0 - $numerator / ($rx * $rx * $ry * $ry));

			$rx *= $s;
			$ry *= $s;
			$root = 0.0;
		} else {
			$root = ($largeArcFlag == $sweepFlag ? -1.0 : 1.0) * sqrt($numerator / ($rx * $rx * $y1dash * $y1dash + $ry * $ry * $x1dash * $x1dash));
		}

		$cxdash = $root * $rx * $y1dash / $ry;
		$cydash = -$root * $ry * $x1dash / $rx;

		$cx = $cosPhi * $cxdash - $sinPhi * $cydash + ($x1 + $x2) / 2.0;
		$cy = $sinPhi * $cxdash + $cosPhi * $cydash + ($y1 + $y2) / 2.0;


		$theta1 = $this->CalcVectorAngle(1.0, 0.0, ($x1dash - $cxdash) / $rx, ($y1dash - $cydash) / $ry);
		$dtheta = $this->CalcVectorAngle(($x1dash - $cxdash) / $rx, ($y1dash - $cydash) / $ry, (-$x1dash - $cxdash) / $rx, (-$y1dash - $cydash) / $ry);
		if (!$sweepFlag && $dtheta > 0)
			$dtheta -= 2.0 * M_PI;
		else if ($sweepFlag && $dtheta < 0)
			$dtheta += 2.0 * M_PI;

		// 3. convert into cubic bezier segments <= 90deg
		$segments = ceil(abs($dtheta / (M_PI / 2.0)));
		$delta = $dtheta / $segments;
		$t = 8.0 / 3.0 * sin($delta / 4.0) * sin($delta / 4.0) / sin($delta / 2.0);
		$coords = array();
		for ($i = 0; $i < $segments; $i++) {
			$cosTheta1 = cos($theta1);
			$sinTheta1 = sin($theta1);
			$theta2 = $theta1 + $delta;
			$cosTheta2 = cos($theta2);
			$sinTheta2 = sin($theta2);

			// a) calculate endpoint of the segment:
			$xe = $cosPhi * $rx * $cosTheta2 - $sinPhi * $ry * $sinTheta2 + $cx;
			$ye = $sinPhi * $rx * $cosTheta2 + $cosPhi * $ry * $sinTheta2 + $cy;

			// b) calculate gradients at start/end points of segment:
			$dx1 = $t * ( - $cosPhi * $rx * $sinTheta1 - $sinPhi * $ry * $cosTheta1);
			$dy1 = $t * ( - $sinPhi * $rx * $sinTheta1 + $cosPhi * $ry * $cosTheta1);

			$dxe = $t * ( $cosPhi * $rx * $sinTheta2 + $sinPhi * $ry * $cosTheta2);
			$dye = $t * ( $sinPhi * $rx * $sinTheta2 - $cosPhi * $ry * $cosTheta2);

			// c) draw the cubic bezier:
			$coords[$i] = array(($x1 + $dx1), ($y1 + $dy1), ($xe + $dxe), ($ye + $dye), $xe, $ye);

			// do next segment
			$theta1 = $theta2;
			$x1 = $xe;
			$y1 = $ye;
		}
		$path = ' ';
		foreach ($coords AS $c) {
			$cpx1 = $c[0];
			$cpy1 = $c[1];
			$cpx2 = $c[2];
			$cpy2 = $c[3];
			$x2 = $c[4];
			$y2 = $c[5];
			$path .= sprintf('%.3F %.3F %.3F %.3F %.3F %.3F c ', $cpx1 * $this->kp, -$cpy1 * $this->kp, $cpx2 * $this->kp, -$cpy2 * $this->kp, $x2 * $this->kp, -$y2 * $this->kp) . "\n";

			// mPDF 5.0.040
			$bounds[0][] = $c[4];
			$bounds[1][] = $c[5];
		}
		return array($path, $bounds); // mPD 5.0.040
	}

	function CalcVectorAngle($ux, $uy, $vx, $vy)
	{
		$ta = atan2($uy, $ux);
		$tb = atan2($vy, $vx);
		if ($tb >= $ta)
			return ($tb - $ta);
		return (6.28318530718 - ($ta - $tb));
	}

	function ConvertSVGSizePixels($size = 5, $maxsize = 'x')
	{
		// maxsize in pixels (user units) or 'y' or 'x'
		// e.g. $w = $this->ConvertSVGSizePixels($arguments['w'],$this->svg_info['w']*(25.4/$this->mpdf_ref->dpi));
		// usefontsize - setfalse for e.g. margins - will ignore fontsize for % values
		// Depends of maxsize value to make % work properly. Usually maxsize == pagewidth
		// For text $maxsize = Fontsize
		// Setting e.g. margin % will use maxsize (pagewidth) and em will use fontsize

		if ($maxsize == 'y') {
			$maxsize = $this->svg_info['h'];
		} else if ($maxsize == 'x') {
			$maxsize = $this->svg_info['w'];
		}
		$maxsize *= (25.4 / $this->mpdf_ref->dpi); // convert pixels to mm
		$fontsize = $this->mpdf_ref->FontSize / $this->kf;
		//Return as pixels
		$size = $this->mpdf_ref->ConvertSize($size, $maxsize, $fontsize, false) * 1 / (25.4 / $this->mpdf_ref->dpi);
		return $size;
	}

	function ConvertSVGSizePts($size = 5)
	{
		// usefontsize - setfalse for e.g. margins - will ignore fontsize for % values
		// Depends of maxsize value to make % work properly. Usually maxsize == pagewidth
		// For text $maxsize = Fontsize
		// Setting e.g. margin % will use maxsize (pagewidth) and em will use fontsize
		$maxsize = $this->mpdf_ref->FontSize;
		//Return as pts
		$size = $this->mpdf_ref->ConvertSize($size, $maxsize, false, true) * 72 / 25.4;
		return $size;
	}

	//
	//	fonction retracant les <rect />
	function svgRect($arguments)
	{

		if ($arguments['h'] == 0 || $arguments['w'] == 0) {
			return '';
		}

		$x = $this->ConvertSVGSizePixels($arguments['x'], 'x'); // mPDF 4.4.003
		$y = $this->ConvertSVGSizePixels($arguments['y'], 'y'); // mPDF 4.4.003
		$h = $this->ConvertSVGSizePixels($arguments['h'], 'y'); // mPDF 4.4.003
		$w = $this->ConvertSVGSizePixels($arguments['w'], 'x'); // mPDF 4.4.003
		$rx = $this->ConvertSVGSizePixels($arguments['rx'], 'x'); // mPDF 4.4.003
		$ry = $this->ConvertSVGSizePixels($arguments['ry'], 'y'); // mPDF 4.4.003

		if ($rx > $w / 2) {
			$rx = $w / 2;
		} // mPDF 4.4.003
		if ($ry > $h / 2) {
			$ry = $h / 2;
		} // mPDF 4.4.003

		if ($rx > 0 and $ry == 0) {
			$ry = $rx;
		}
		if ($ry > 0 and $rx == 0) {
			$rx = $ry;
		}

		if ($rx == 0 and $ry == 0) {
			//	trace un rectangle sans angle arrondit
			$path_cmd = sprintf('%.3F %.3F m ', ($x * $this->kp), -($y * $this->kp));
			$path_cmd .= sprintf('%.3F %.3F l ', (($x + $w) * $this->kp), -($y * $this->kp));
			$path_cmd .= sprintf('%.3F %.3F l ', (($x + $w) * $this->kp), -(($y + $h) * $this->kp));
			$path_cmd .= sprintf('%.3F %.3F l ', ($x) * $this->kp, -(($y + $h) * $this->kp));
			$path_cmd .= sprintf('%.3F %.3F l h ', ($x * $this->kp), -($y * $this->kp));
		} else {
			//	trace un rectangle avec les arrondit
			//	les points de controle du bezier sont deduis grace a la constante kappa
			$kappa = 4 * (sqrt(2) - 1) / 3;

			$kx = $kappa * $rx;
			$ky = $kappa * $ry;

			$path_cmd = sprintf('%.3F %.3F m ', ($x + $rx) * $this->kp, -$y * $this->kp);
			$path_cmd .= sprintf('%.3F %.3F l ', ($x + ($w - $rx)) * $this->kp, -$y * $this->kp);
			$path_cmd .= sprintf('%.3F %.3F %.3F %.3F %.3F %.3F c ', ($x + ($w - $rx + $kx)) * $this->kp, -$y * $this->kp, ($x + $w) * $this->kp, (-$y + (-$ry + $ky)) * $this->kp, ($x + $w) * $this->kp, (-$y + (-$ry)) * $this->kp);
			$path_cmd .= sprintf('%.3F %.3F l ', ($x + $w) * $this->kp, (-$y + (-$h + $ry)) * $this->kp);
			$path_cmd .= sprintf('%.3F %.3F %.3F %.3F %.3F %.3F c ', ($x + $w) * $this->kp, (-$y + (-$h - $ky + $ry)) * $this->kp, ($x + ($w - $rx + $kx)) * $this->kp, (-$y + (-$h)) * $this->kp, ($x + ($w - $rx)) * $this->kp, (-$y + (-$h)) * $this->kp);

			$path_cmd .= sprintf('%.3F %.3F l ', ($x + $rx) * $this->kp, (-$y + (-$h)) * $this->kp);
			$path_cmd .= sprintf('%.3F %.3F %.3F %.3F %.3F %.3F c ', ($x + ($rx - $kx)) * $this->kp, (-$y + (-$h)) * $this->kp, $x * $this->kp, (-$y + (-$h - $ky + $ry)) * $this->kp, $x * $this->kp, (-$y + (-$h + $ry)) * $this->kp);
			$path_cmd .= sprintf('%.3F %.3F l ', $x * $this->kp, (-$y + (-$ry)) * $this->kp);
			$path_cmd .= sprintf('%.3F %.3F %.3F %.3F %.3F %.3F c h ', $x * $this->kp, (-$y + (-$ry + $ky)) * $this->kp, ($x + ($rx - $kx)) * $this->kp, -$y * $this->kp, ($x + $rx) * $this->kp, -$y * $this->kp);
		}
		return $path_cmd;
	}

	//
	//	fonction retracant les <ellipse /> et <circle />
	//	 le cercle est tracé grave a 4 bezier cubic, les poitn de controles
	//	sont deduis grace a la constante kappa * rayon
	function svgEllipse($arguments)
	{
		if ($arguments['rx'] == 0 || $arguments['ry'] == 0) {
			return '';
		}

		$kappa = 4 * (sqrt(2) - 1) / 3;

		$cx = $this->ConvertSVGSizePixels($arguments['cx'], 'x');
		$cy = $this->ConvertSVGSizePixels($arguments['cy'], 'y');
		$rx = $this->ConvertSVGSizePixels($arguments['rx'], 'x');
		$ry = $this->ConvertSVGSizePixels($arguments['ry'], 'y');

		$x1 = $cx;
		$y1 = -$cy + $ry;

		$x2 = $cx + $rx;
		$y2 = -$cy;

		$x3 = $cx;
		$y3 = -$cy - $ry;

		$x4 = $cx - $rx;
		$y4 = -$cy;

		$path_cmd = sprintf('%.3F %.3F m ', $x1 * $this->kp, $y1 * $this->kp);
		$path_cmd .= sprintf('%.3F %.3F %.3F %.3F %.3F %.3F c ', ($x1 + ($rx * $kappa)) * $this->kp, $y1 * $this->kp, $x2 * $this->kp, ($y2 + ($ry * $kappa)) * $this->kp, $x2 * $this->kp, $y2 * $this->kp);
		$path_cmd .= sprintf('%.3F %.3F %.3F %.3F %.3F %.3F c ', $x2 * $this->kp, ($y2 - ($ry * $kappa)) * $this->kp, ($x3 + ($rx * $kappa)) * $this->kp, $y3 * $this->kp, $x3 * $this->kp, $y3 * $this->kp);
		$path_cmd .= sprintf('%.3F %.3F %.3F %.3F %.3F %.3F c ', ($x3 - ($rx * $kappa)) * $this->kp, $y3 * $this->kp, $x4 * $this->kp, ($y4 - ($ry * $kappa)) * $this->kp, $x4 * $this->kp, $y4 * $this->kp);
		$path_cmd .= sprintf('%.3F %.3F %.3F %.3F %.3F %.3F c ', $x4 * $this->kp, ($y4 + ($ry * $kappa)) * $this->kp, ($x1 - ($rx * $kappa)) * $this->kp, $y1 * $this->kp, $x1 * $this->kp, $y1 * $this->kp);
		$path_cmd .= 'h ';

		return $path_cmd;
	}

	//
	//	fonction retracant les <polyline /> et les <line />
	function svgPolyline($arguments, $ispolyline = true)
	{
		if ($ispolyline) {
			$xbase = $arguments[0];
			$ybase = - $arguments[1];
		} else {
			if ($arguments[0] == $arguments[2] && $arguments[1] == $arguments[3]) {
				return '';
			} // Zero length line
			$xbase = $this->ConvertSVGSizePixels($arguments[0], 'x');
			$ybase = - $this->ConvertSVGSizePixels($arguments[1], 'y');
		}
		$path_cmd = sprintf('%.3F %.3F m ', $xbase * $this->kp, $ybase * $this->kp);
		for ($i = 2; $i < count($arguments); $i += 2) {
			if ($ispolyline) {
				$tmp_x = $arguments[$i];
				$tmp_y = - $arguments[($i + 1)];
			} else {
				$tmp_x = $this->ConvertSVGSizePixels($arguments[$i], 'x');
				$tmp_y = - $this->ConvertSVGSizePixels($arguments[($i + 1)], 'y');
			}
			$path_cmd .= sprintf('%.3F %.3F l ', $tmp_x * $this->kp, $tmp_y * $this->kp);
		}

		//	$path_cmd .= 'h '; // ?? In error - don't close subpath here
		return $path_cmd;
	}

	//
	//	fonction retracant les <polygone />
	function svgPolygon($arguments)
	{
		$xbase = $arguments[0];
		$ybase = - $arguments[1];
		$path_cmd = sprintf('%.3F %.3F m ', $xbase * $this->kp, $ybase * $this->kp);
		for ($i = 2; $i < count($arguments); $i += 2) {
			$tmp_x = $arguments[$i];
			$tmp_y = - $arguments[($i + 1)];

			$path_cmd .= sprintf('%.3F %.3F l ', $tmp_x * $this->kp, $tmp_y * $this->kp);
		}
		$path_cmd .= sprintf('%.3F %.3F l ', $xbase * $this->kp, $ybase * $this->kp);
		$path_cmd .= 'h ';
		return $path_cmd;
	}

	//
	//	write string to image
	function svgText()
	{
		// $tmp = count($this->txt_style)-1;
		$current_style = $this->txt_style[count($this->txt_style) - 1]; // mPDF 5.7.4
		$style = '';
		$op = '';
		$render = -1;
		if (isset($this->txt_data[2])) {
			// mPDF 6
			// If using SVG Font
			if (isset($this->svg_font[$current_style['font-family']])) {
				// select font
				$style = 'R';
				$style .= (isset($current_style['font-weight']) && $current_style['font-weight'] == 'bold') ? 'B' : '';
				$style .= (isset($current_style['font-style']) && $current_style['font-style'] == 'italic') ? 'I' : '';
				$style .= (isset($current_style['font-variant']) && $current_style['font-variant'] == 'small-caps') ? 'S' : '';

				$fontsize = $current_style['font-size'] * $this->mpdf_ref->dpi / 72;
				if (isset($this->svg_font[$current_style['font-family']][$style])) {
					$svg_font = $this->svg_font[$current_style['font-family']][$style];
				} else if (isset($this->svg_font[$current_style['font-family']]['R'])) {
					$svg_font = $this->svg_font[$current_style['font-family']]['R'];
				}

				if (!isset($svg_font['units-per-em']) || $svg_font['units-per-em'] < 1) {
					$svg_font['units-per-em'] = 1000;
				}
				$units_per_em = $svg_font['units-per-em'];
				$scale = $fontsize / $units_per_em;
				$stroke_width = $current_style['stroke-width'];
				$stroke_width /= $scale;

				$opacitystr = '';
				$fopacity = 1;
				if (isset($current_style['fill-opacity'])) {
					if ($current_style['fill-opacity'] == 0) {
						$fopacity = 0;
					} else if ($current_style['fill-opacity'] > 1) {
						$fopacity = 1;
					} else if ($current_style['fill-opacity'] > 0) {
						$fopacity = $current_style['fill-opacity'];
					} else if ($current_style['fill-opacity'] < 0) {
						$fopacity = 0;
					}
				}
				$sopacity = 1;
				if (isset($current_style['stroke-opacity'])) {
					if ($current_style['stroke-opacity'] == 0) {
						$sopacity = 0;
					} else if ($current_style['stroke-opacity'] > 1) {
						$sopacity = 1;
					} else if ($current_style['stroke-opacity'] > 0) {
						$sopacity = $current_style['stroke-opacity'];
					} else if ($current_style['stroke-opacity'] < 0) {
						$sopacity = 0;
					}
				}
				$gs = $this->mpdf_ref->AddExtGState(array('ca' => $fopacity, 'CA' => $sopacity, 'BM' => '/Normal'));
				$this->mpdf_ref->extgstates[$gs]['fo'] = true;
				$opacitystr = sprintf(' /GS%d gs ', $gs);

				$fillstr = '';
				if (isset($current_style['fill']) && $current_style['fill'] != 'none') {
					$col = $this->mpdf_ref->ConvertColor($current_style['fill']);
					$fillstr = $this->mpdf_ref->SetFColor($col, true);
					$render = "0"; // Fill (only)
					$op = 'f';
				}
				$strokestr = '';
				if ($stroke_width > 0 && $current_style['stroke'] != 'none') {
					$scol = $this->mpdf_ref->ConvertColor($current_style['stroke']);
					if ($scol) {
						$strokestr .= $this->mpdf_ref->SetDColor($scol, true) . ' ';
					}
					$linewidth = $this->ConvertSVGSizePixels($stroke_width);
					if ($linewidth > 0) {
						$strokestr .= sprintf('%.3F w 0 J 0 j ', $linewidth * $this->kp);
						if ($render == -1) {
							$render = "1";
						} // stroke only
						else {
							$render = "2";
						}  // fill and stroke
						$op .= 'S';
					}
				}
				if ($render == -1) {
					return '';
				}
				if ($op == 'fS') {
					$op = 'B';
				}

				$x = $this->txt_data[0]; // mPDF 5.7.4
				$y = $this->txt_data[1]; // mPDF 5.7.4
				$txt = $this->txt_data[2];

				$txt = preg_replace('/\f/', '', $txt);
				$txt = preg_replace('/\r/', '', $txt);
				$txt = preg_replace('/\n/', ' ', $txt);
				$txt = preg_replace('/\t/', ' ', $txt);
				$txt = preg_replace("/[ ]+/u", ' ', $txt);

				if ($this->textjuststarted) {
					$txt = ltrim($txt);
				}  // mPDF 5.7.4
				$this->textjuststarted = false;  // mPDF 5.7.4

				$txt = $this->mpdf_ref->purify_utf8_text($txt);
				if ($this->mpdf_ref->text_input_as_HTML) {
					$txt = $this->mpdf_ref->all_entities_to_utf8($txt);
				}

				$nb = mb_strlen($txt, 'UTF-8');
				$i = 0;
				$sw = 0;
				$subpath_cmd = '';
				while ($i < $nb) {
					//Get next character
					$char = mb_substr($txt, $i, 1, 'UTF-8');


					if (isset($svg_font['glyphs'][$char])) {
						$d = $svg_font['glyphs'][$char]['d'];
						if (isset($svg_font['glyphs'][$char]['horiz-adv-x'])) {
							$horiz_adv_x = $svg_font['glyphs'][$char]['horiz-adv-x'];
						} else {
							$horiz_adv_x = $svg_font['horiz-adv-x'];
						} // missing glyph width
					} else {
						$d = $svg_font['d'];
						$horiz_adv_x = $svg_font['horiz-adv-x']; // missing glyph width
					}
					preg_match_all('/([MZLHVCSQTAmzlhvcsqta])([eE ,\-.\d]+)*/', $d, $commands, PREG_SET_ORDER);
					$subpath_cmd .= sprintf('q %.4F 0 0 %.4F mPDF-AXS(%.4F) %.4F cm ', $scale, -$scale, ($x + $sw * $scale) * $this->kp, -$y * $this->kp);

					$this->subPathInit = true;
					$this->pathBBox = array(999999, 999999, -999999, -999999);
					foreach ($commands as $cmd) {
						if (count($cmd) == 3 || (isset($cmd[2]) && $cmd[2] == '')) {
							list($tmp, $command, $arguments) = $cmd;
						} else {
							list($tmp, $command) = $cmd;
							$arguments = '';
						}

						$subpath_cmd .= $this->svgPath($command, $arguments);
					}
					$subpath_cmd .= $op . ' Q ';
					if ($this->pathBBox[2] == -1999998) {
						$this->pathBBox[2] = 100;
					}
					if ($this->pathBBox[3] == -1999998) {
						$this->pathBBox[3] = 100;
					}
					if ($this->pathBBox[0] == 999999) {
						$this->pathBBox[0] = 0;
					}
					if ($this->pathBBox[1] == 999999) {
						$this->pathBBox[1] = 0;
					}


					$sw += $horiz_adv_x;
					$i++;
				}

				$sw *= $scale; // convert stringwidth to units
				// mPDF 5.7.4
				$this->textlength = $sw;
				$this->texttotallength += $this->textlength;

				$path_cmd = sprintf('q %s %s Tr %s %s ', $opacitystr, $render, $fillstr, $strokestr);
				$path_cmd .= $subpath_cmd;
				$path_cmd .= 'Q ';

				unset($this->txt_data[0], $this->txt_data[1], $this->txt_data[2]);
				return $path_cmd;
			}

			// select font
			$style .= ($current_style['font-weight'] == 'bold') ? 'B' : '';
			$style .= ($current_style['font-style'] == 'italic') ? 'I' : '';
			$size = $current_style['font-size'] * $this->kf;

			$current_style['font-family'] = $this->mpdf_ref->SetFont($current_style['font-family'], $style, $size, false);
			$this->mpdf_ref->CurrentFont['fo'] = true;

			$opacitystr = '';
			// mPDF 6
			$fopacity = 1;
			if (isset($current_style['fill-opacity'])) {
				if ($current_style['fill-opacity'] == 0) {
					$fopacity = 0;
				} else if ($current_style['fill-opacity'] > 1) {
					$fopacity = 1;
				} else if ($current_style['fill-opacity'] > 0) {
					$fopacity = $current_style['fill-opacity'];
				} else if ($current_style['fill-opacity'] < 0) {
					$fopacity = 0;
				}
			}
			$sopacity = 1;
			if (isset($current_style['stroke-opacity'])) {
				if ($current_style['stroke-opacity'] == 0) {
					$sopacity = 0;
				} else if ($current_style['stroke-opacity'] > 1) {
					$sopacity = 1;
				} else if ($current_style['stroke-opacity'] > 0) {
					$sopacity = $current_style['stroke-opacity'];
				} else if ($current_style['stroke-opacity'] < 0) {
					$sopacity = 0;
				}
			}
			$gs = $this->mpdf_ref->AddExtGState(array('ca' => $fopacity, 'CA' => $sopacity, 'BM' => '/Normal'));
			$this->mpdf_ref->extgstates[$gs]['fo'] = true;
			$opacitystr = sprintf(' /GS%d gs ', $gs);

			$fillstr = '';
			if (isset($current_style['fill']) && $current_style['fill'] != 'none') {
				$col = $this->mpdf_ref->ConvertColor($current_style['fill']);
				$fillstr = $this->mpdf_ref->SetFColor($col, true);
				$render = "0"; // Fill (only)
			}
			$strokestr = '';
			if (isset($current_style['stroke-width']) && $current_style['stroke-width'] > 0 && $current_style['stroke'] != 'none') {
				$scol = $this->mpdf_ref->ConvertColor($current_style['stroke']);
				if ($scol) {
					$strokestr .= $this->mpdf_ref->SetDColor($scol, true) . ' ';
				}
				$linewidth = $this->ConvertSVGSizePixels($current_style['stroke-width']);
				if ($linewidth > 0) {
					$strokestr .= sprintf('%.3F w 1 J 1 j ', $linewidth * $this->kp);
					if ($render == -1) {
						$render = "1";
					} // stroke only
					else {
						$render = "2";
					}  // fill and stroke
				}
			}
			if ($render == -1) {
				return '';
			}

			$x = $this->txt_data[0]; // mPDF 5.7.4
			$y = $this->txt_data[1]; // mPDF 5.7.4
			$txt = $this->txt_data[2];

			$txt = preg_replace('/\f/', '', $txt);
			$txt = preg_replace('/\r/', '', $txt);
			$txt = preg_replace('/\n/', ' ', $txt);
			$txt = preg_replace('/\t/', ' ', $txt);
			$txt = preg_replace("/[ ]+/u", ' ', $txt);

			if ($this->textjuststarted) {
				$txt = ltrim($txt);
			}  // mPDF 5.7.4
			$this->textjuststarted = false;  // mPDF 5.7.4

			$txt = $this->mpdf_ref->purify_utf8_text($txt);
			if ($this->mpdf_ref->text_input_as_HTML) {
				$txt = $this->mpdf_ref->all_entities_to_utf8($txt);
			}

			if ($this->mpdf_ref->usingCoreFont) {
				$txt = mb_convert_encoding($txt, $this->mpdf_ref->mb_enc, 'UTF-8');
			}
			if (preg_match("/([" . $this->mpdf_ref->pregRTLchars . "])/u", $txt)) {
				$this->mpdf_ref->biDirectional = true;
			}

			$textvar = 0;
			$save_OTLtags = $this->mpdf_ref->OTLtags;
			$this->mpdf_ref->OTLtags = array();
			if ($this->mpdf_ref->useKerning) {
				if ($this->mpdf_ref->CurrentFont['haskernGPOS']) {
					if (isset($this->mpdf_ref->OTLtags['Plus'])) {
						$this->mpdf_ref->OTLtags['Plus'] .= ' kern';
					} else {
						$this->mpdf_ref->OTLtags['Plus'] = ' kern';
					}
				} else {
					$textvar = ($textvar | FC_KERNING);
				}
			}

			// Use OTL OpenType Table Layout - GSUB & GPOS
			if (isset($this->mpdf_ref->CurrentFont['useOTL']) && $this->mpdf_ref->CurrentFont['useOTL']) {
				$txt = $this->mpdf_ref->otl->applyOTL($txt, $this->mpdf_ref->CurrentFont['useOTL']);
				$OTLdata = $this->mpdf_ref->otl->OTLdata;
			}
			$this->mpdf_ref->OTLtags = $save_OTLtags;

			$this->mpdf_ref->magic_reverse_dir($txt, $this->mpdf_ref->directionality, $OTLdata);

			$this->mpdf_ref->CurrentFont['used'] = true;

			$sw = $this->mpdf_ref->GetStringWidth($txt, true, $OTLdata, $textvar); // also adds characters to subset
			// mPDF 5.7.4
			$this->textlength = $sw * 1 / (25.4 / $this->mpdf_ref->dpi);
			$this->texttotallength += $this->textlength;

			$pdfx = $x * $this->kp;
			$pdfy = -$y * $this->kp;

			$aixextra = sprintf(' /F%d %.3F Tf %s %s Tr %s %s ', $this->mpdf_ref->CurrentFont['i'], $this->mpdf_ref->FontSizePt, $opacitystr, $render, $fillstr, $strokestr);

			$path_cmd = 'q 1 0 0 1 mPDF-AXS(0.00) 0 cm '; // Align X-shift
			$path_cmd .= $this->mpdf_ref->Text($pdfx, $pdfy, $txt, $OTLdata, $textvar, $aixextra, 'SVG', true);
			$path_cmd .= " Q\n";

			unset($this->txt_data[0], $this->txt_data[1], $this->txt_data[2]);

			if (isset($current_style['font-size-parent'])) {
				$this->mpdf_ref->SetFontSize($current_style['font-size-parent']);
			}
		} else {
			return ' ';
		}
		// Reset font	// mPDF 5.7.4
		$prev_style = $this->txt_style[count($this->txt_style) - 1];
		$style = '';
		$style .= ($prev_style['font-weight'] == 'bold') ? 'B' : '';
		$style .= ($prev_style['font-style'] == 'italic') ? 'I' : '';
		$size = $prev_style['font-size'] * $this->kf;
		$this->mpdf_ref->SetFont($prev_style['font-family'], $style, $size, false);

		return $path_cmd;
	}

	function svgDefineTxtStyle($critere_style)
	{
		// get copy of current/default txt style, and modify it with supplied attributes
		$tmp = count($this->txt_style) - 1;
		$current_style = $this->txt_style[$tmp];
		if (isset($critere_style['style'])) {
			if (preg_match('/fill:\s*rgb\((\d+),\s*(\d+),\s*(\d+)\)/', $critere_style['style'], $m)) {
				$current_style['fill'] = '#' . str_pad(dechex($m[1]), 2, "0", STR_PAD_LEFT) . str_pad(dechex($m[2]), 2, "0", STR_PAD_LEFT) . str_pad(dechex($m[3]), 2, "0", STR_PAD_LEFT);
			} else {
				$tmp = preg_replace("/(.*)fill:\s*([a-z0-9#_()]*|none)(.*)/i", "$2", $critere_style['style']);
				if ($tmp && $tmp != 'inherit' && $tmp != $critere_style['style']) {
					$current_style['fill'] = $tmp;
				}
			}

			// mPDF 6
			if (preg_match("/[^-]opacity:\s*([a-z0-9.]*|none)/i", $critere_style['style'], $m) ||
				preg_match("/^opacity:\s*([a-z0-9.]*|none)/i", $critere_style['style'], $m)) {
				$current_style['fill-opacity'] = $m[1];
				$current_style['stroke-opacity'] = $m[1];
			}

			$tmp = preg_replace("/(.*)fill-opacity:\s*([a-z0-9.]*|none)(.*)/i", "$2", $critere_style['style']);
			if ($tmp && $tmp != 'inherit' && $tmp != $critere_style['style']) {
				$current_style['fill-opacity'] = $tmp;
			}

			$tmp = preg_replace("/(.*)fill-rule:\s*([a-z0-9#]*|none)(.*)/i", "$2", $critere_style['style']);
			if ($tmp != $critere_style['style'] && $tmp != $critere_style['style']) {
				$current_style['fill-rule'] = $tmp;
			}

			if (preg_match('/stroke:\s*rgb\((\d+),\s*(\d+),\s*(\d+)\)/', $critere_style['style'], $m)) {
				$current_style['stroke'] = '#' . str_pad(dechex($m[1]), 2, "0", STR_PAD_LEFT) . str_pad(dechex($m[2]), 2, "0", STR_PAD_LEFT) . str_pad(dechex($m[3]), 2, "0", STR_PAD_LEFT);
			} else {
				$tmp = preg_replace("/(.*)stroke:\s*([a-z0-9#]*|none)(.*)/i", "$2", $critere_style['style']);
				if ($tmp && $tmp != 'inherit' && $tmp != $critere_style['style']) {
					$current_style['stroke'] = $tmp;
				}
			}

			$tmp = preg_replace("/(.*)stroke-linecap:\s*([a-z0-9#]*|none)(.*)/i", "$2", $critere_style['style']);
			if ($tmp && $tmp != 'inherit' && $tmp != $critere_style['style']) {
				$current_style['stroke-linecap'] = $tmp;
			}

			$tmp = preg_replace("/(.*)stroke-linejoin:\s*([a-z0-9#]*|none)(.*)/i", "$2", $critere_style['style']);
			if ($tmp && $tmp != 'inherit' && $tmp != $critere_style['style']) {
				$current_style['stroke-linejoin'] = $tmp;
			}

			$tmp = preg_replace("/(.*)stroke-miterlimit:\s*([a-z0-9#]*|none)(.*)/i", "$2", $critere_style['style']);
			if ($tmp && $tmp != 'inherit' && $tmp != $critere_style['style']) {
				$current_style['stroke-miterlimit'] = $tmp;
			}

			$tmp = preg_replace("/(.*)stroke-opacity:\s*([a-z0-9.]*|none)(.*)/i", "$2", $critere_style['style']);
			if ($tmp && $tmp != 'inherit' && $tmp != $critere_style['style']) {
				$current_style['stroke-opacity'] = $tmp;
			}

			$tmp = preg_replace("/(.*)stroke-width:\s*([a-z0-9.]*|none)(.*)/i", "$2", $critere_style['style']);
			if ($tmp && $tmp != 'inherit' && $tmp != $critere_style['style']) {
				$current_style['stroke-width'] = $tmp;
			}

			$tmp = preg_replace("/(.*)stroke-dasharray:\s*([a-z0-9., ]*|none)(.*)/i", "$2", $critere_style['style']);
			if ($tmp && $tmp != 'inherit' && $tmp != $critere_style['style']) {
				$current_style['stroke-dasharray'] = $tmp;
			}

			$tmp = preg_replace("/(.*)stroke-dashoffset:\s*([a-z0-9.]*|none)(.*)/i", "$2", $critere_style['style']);
			if ($tmp && $tmp != 'inherit' && $tmp != $critere_style['style']) {
				$current_style['stroke-dashoffset'] = $tmp;
			}

			$tmp = preg_replace("/(.*)font-family:\s*([a-z0-9.\"' ,\-]*|none)(.*)/i", "$2", $critere_style['style']);
			if ($tmp && $tmp != 'inherit' && $tmp != $critere_style['style']) {
				$critere_style['font-family'] = $tmp;
			}

			$tmp = preg_replace("/(.*)font-size:\s*([a-z0-9.]*|none)(.*)/i", "$2", $critere_style['style']);
			if ($tmp && $tmp != 'inherit' && $tmp != $critere_style['style']) {
				$critere_style['font-size'] = $tmp;
			}

			$tmp = preg_replace("/(.*)font-weight:\s*([a-z0-9.]*|normal)(.*)/i", "$2", $critere_style['style']);
			if ($tmp && $tmp != 'inherit' && $tmp != $critere_style['style']) {
				$critere_style['font-weight'] = $tmp;
			}

			$tmp = preg_replace("/(.*)font-style:\s*([a-z0-9.]*|normal)(.*)/i", "$2", $critere_style['style']);
			if ($tmp && $tmp != 'inherit' && $tmp != $critere_style['style']) {
				$critere_style['font-style'] = $tmp;
			}

			$tmp = preg_replace("/(.*)font-variant:\s*([a-z0-9.]*|normal)(.*)/i", "$2", $critere_style['style']);
			if ($tmp && $tmp != 'inherit' && $tmp != $critere_style['style']) {
				$critere_style['font-variant'] = $tmp;
			}

			$tmp = preg_replace("/(.*)text-anchor:\s*(start|middle|end)(.*)/i", "$2", $critere_style['style']);
			if ($tmp && $tmp != 'inherit' && $tmp != $critere_style['style']) {
				$critere_style['text-anchor'] = $tmp;
			}
		}
		if (isset($critere_style['font'])) {

			// [ [ <'font-style'> || <'font-variant'> || <'font-weight'> ]?<'font-size'> [ / <'line-height'> ]? <'font-family'> ]

			$tmp = preg_replace("/(.*)(italic|oblique)(.*)/i", "$2", $critere_style['font']);
			if ($tmp != $critere_style['font']) {
				if ($tmp == 'oblique') {
					$tmp = 'italic';
				}
				$current_style['font-style'] = $tmp;
			}
			$tmp = preg_replace("/(.*)(bold|bolder)(.*)/i", "$2", $critere_style['font']);
			if ($tmp != $critere_style['font']) {
				if ($tmp == 'bolder') {
					$tmp = 'bold';
				}
				$current_style['font-weight'] = $tmp;
			}

			$tmp = preg_replace("/(.*)(small\-caps)(.*)/i", "$2", $critere_style['font']);
			if ($tmp != $critere_style['font']) {
				$current_style['font-variant'] = $tmp;
			}

			// select digits not followed by percent sign nor preceeded by forward slash
			$tmp = preg_replace("/(.*)\b(\d+)[\b|\/](.*)/i", "$2", $critere_style['font']);
			if ($tmp != $critere_style['font']) {
				$current_style['font-size'] = $this->ConvertSVGSizePts($tmp);
				$this->mpdf_ref->SetFont('', '', $current_style['font-size'], false);
			}
		}

		// mPDF 6
		if (isset($critere_style['opacity']) && $critere_style['opacity'] != 'inherit') {
			$current_style['fill-opacity'] = $critere_style['opacity'];
			$current_style['stroke-opacity'] = $critere_style['opacity'];
		}
		// mPDF 6
		if (isset($critere_style['stroke-opacity']) && $critere_style['stroke-opacity'] != 'inherit') {
			$current_style['stroke-opacity'] = $critere_style['stroke-opacity'];
		}
		// mPDF 6
		if (isset($critere_style['fill-opacity']) && $critere_style['fill-opacity'] != 'inherit') {
			$current_style['fill-opacity'] = $critere_style['fill-opacity'];
		}
		if (isset($critere_style['fill']) && $critere_style['fill'] != 'inherit') {
			$current_style['fill'] = $critere_style['fill'];
		}
		if (isset($critere_style['stroke']) && $critere_style['stroke'] != 'inherit') {
			$current_style['stroke'] = $critere_style['stroke'];
		}
		if (isset($critere_style['stroke-width']) && $critere_style['stroke-width'] != 'inherit') {
			$current_style['stroke-width'] = $critere_style['stroke-width'];
		}

		if (isset($critere_style['font-style']) && $critere_style['font-style'] != 'inherit') {
			if (strtolower($critere_style['font-style']) == 'oblique') {
				$critere_style['font-style'] = 'italic';
			}
			$current_style['font-style'] = $critere_style['font-style'];
		}

		if (isset($critere_style['font-weight']) && $critere_style['font-weight'] != 'inherit') {
			if (strtolower($critere_style['font-weight']) == 'bolder') {
				$critere_style['font-weight'] = 'bold';
			}
			$current_style['font-weight'] = $critere_style['font-weight'];
		}

		if (isset($critere_style['font-variant']) && $critere_style['font-variant'] != 'inherit') {
			$current_style['font-variant'] = $critere_style['font-variant'];
		}

		if (isset($critere_style['font-size']) && $critere_style['font-size'] != 'inherit') {
			if (strpos($critere_style['font-size'], '%') !== false) {
				$current_style['font-size-parent'] = $current_style['font-size'];
			}
			$current_style['font-size'] = $this->ConvertSVGSizePts($critere_style['font-size']);
			$this->mpdf_ref->SetFont('', '', $current_style['font-size'], false);
		}

		if (isset($critere_style['font-family']) && $critere_style['font-family'] != 'inherit') {
			$v = $critere_style['font-family'];
			$aux_fontlist = explode(",", $v);
			$found = 0;

			$svgfontstyle = 'R';
			$svgfontstyle .= (isset($current_style['font-weight']) && $current_style['font-weight'] == 'bold') ? 'B' : '';
			$svgfontstyle .= (isset($current_style['font-style']) && $current_style['font-style'] == 'italic') ? 'I' : '';
			$svgfontstyle .= (isset($current_style['font-variant']) && $current_style['font-variant'] == 'small-caps') ? 'S' : '';

			foreach ($aux_fontlist AS $f) {
				$fonttype = trim($f);
				$fonttype = preg_replace('/["\']*(.*?)["\']*/', '\\1', $fonttype);
				$fonttype = preg_replace('/ /', '', $fonttype);
				$v = strtolower(trim($fonttype));
				if (isset($this->mpdf_ref->fonttrans[$v]) && $this->mpdf_ref->fonttrans[$v]) {
					$v = $this->mpdf_ref->fonttrans[$v];
				}
				if ((!$this->mpdf_ref->usingCoreFont && in_array($v, $this->mpdf_ref->available_unifonts)) ||
					($this->mpdf_ref->usingCoreFont && in_array($v, array('courier', 'times', 'helvetica', 'arial'))) ||
					in_array($v, array('sjis', 'uhc', 'big5', 'gb')) || isset($this->svg_font[$v][$svgfontstyle])) { // mPDF 6
					$current_style['font-family'] = $v;
					$found = 1;
					break;
				}
			}
			if (!$found) {
				foreach ($aux_fontlist AS $f) {
					$fonttype = trim($f);
					$fonttype = preg_replace('/["\']*(.*?)["\']*/', '\\1', $fonttype);
					$fonttype = preg_replace('/ /', '', $fonttype);
					$v = strtolower(trim($fonttype));
					if (isset($this->mpdf_ref->fonttrans[$v]) && $this->mpdf_ref->fonttrans[$v]) {
						$v = $this->mpdf_ref->fonttrans[$v];
					}
					if (in_array($v, $this->mpdf_ref->sans_fonts) || in_array($v, $this->mpdf_ref->serif_fonts) || in_array($v, $this->mpdf_ref->mono_fonts) || isset($this->svg_font[$v][$svgfontstyle])) {  // mPDF 6
						$current_style['font-family'] = $v;
						break;
					}
				}
			}
		}
		if (isset($critere_style['text-anchor']) && $critere_style['text-anchor'] != 'inherit') {
			$current_style['text-anchor'] = $critere_style['text-anchor'];
		}

		// add current style to text style array (will remove it later after writing text to svg_string)
		array_push($this->txt_style, $current_style);
	}

	//
	//	fonction ajoutant un gradient
	function svgAddGradient($id, $array_gradient)
	{

		$this->svg_gradient[$id] = $array_gradient;
	}

	//
	//	Ajoute une couleur dans le gradient correspondant
	//
	//	function ecrivant dans le svgstring
	function svgWriteString($content)
	{

		$this->svg_string .= $content;
	}

	//	analise le svg et renvoie aux fonctions precedente our le traitement
	function ImageSVG($data)
	{
		// Try to clean up the start of the file
		// removing DOCTYPE fails with this:
		/*
		  <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd"
		  [
		  <!ELEMENT Paragraph (#PCDATA)>
		  ]>
		 */
		//$data = preg_replace('/<!DOCTYPE.*?  >/is', '', $data);
		//$data = preg_replace('/<\?xml.*?  >/is', '', $data);

		$data = preg_replace('/^.*?<svg([> ])/is', '<svg\\1', $data); // mPDF 5.7.4

		$data = preg_replace('/<!--.*?-->/is', '', $data); // mPDF 5.7.4
		// Converts < to &lt; when not a tag
		$data = preg_replace('/<([^!?\/a-zA-Z_:])/i', '&lt;\\1', $data); // mPDF 5.7.4

		if (_SVG_AUTOFONT) {
			$data = $this->markScriptToLang($data);
		}

		$this->svg_info = array();
		$last_gradid = ''; // mPDF 6
		$last_svg_fontid = ''; // mPDF 6
		$last_svg_fontdefw = ''; // mPDF 6
		$last_svg_fontstyle = ''; // mPDF 6

		if (preg_match('/<!ENTITY/si', $data)) {
			// Get User-defined entities
			preg_match_all('/<!ENTITY\s+([a-z]+)\s+\"(.*?)\">/si', $data, $ent);
			// Replace entities
			for ($i = 0; $i < count($ent[0]); $i++) {
				$data = preg_replace('/&' . preg_quote($ent[1][$i], '/') . ';/is', $ent[2][$i], $data);
			}
		}

		if (preg_match('/xlink:href\s*=/si', $data)) {
			// GRADIENTS
			// Get links
			preg_match_all('/(<(linearGradient|radialgradient)[^>]*)xlink:href\s*=\s*["\']#(.*?)["\'](.*?)\/>/si', $data, $links);
			if (count($links[0])) {
				$links[5] = array();
			}
			// Delete links from data - keeping in $links
			for ($i = 0; $i < count($links[0]); $i++) {
				$links[5][$i] = 'tmpLink' . RAND(100000, 9999999);
				$data = preg_replace('/' . preg_quote($links[0][$i], '/') . '/is', '<MYLINKS' . $links[5][$i] . '>', $data);
			}
			// Get targets
			preg_match_all('/<(linearGradient|radialgradient)([^>]*)id\s*=\s*["\'](.*?)["\'](.*?)>(.*?)<\/(linearGradient|radialgradient)>/si', $data, $m);
			$targets = array();
			$stops = array();
			// keeping in $targets
			for ($i = 0; $i < count($m[0]); $i++) {
				$stops[$m[3][$i]] = $m[5][$i];
			}
			// Add back links this time as targets (gradients)
			for ($i = 0; $i < count($links[0]); $i++) {
				$def = $links[1][$i] . ' ' . $links[4][$i] . '>' . $stops[$links[3][$i]] . '</' . $links[2][$i] . '>';
				$data = preg_replace('/<MYLINKS' . $links[5][$i] . '>/is', $def, $data);
			}

			// mPDF 5.7.4
			// <TREF>
			preg_match_all('/<tref ([^>]*)xlink:href\s*=\s*["\']#([^>]*?)["\']([^>]*)\/>/si', $data, $links);
			for ($i = 0; $i < count($links[0]); $i++) {

				// Get the item to use from defs
				$insert = '';
				if (preg_match('/<text [^>]*id\s*=\s*["\']' . $links[2][$i] . '["\'][^>]*>(.*?)<\/text>/si', $data, $m)) {
					$insert = $m[1];
				}
				if ($insert) {
					$data = preg_replace('/' . preg_quote($links[0][$i], '/') . '/is', $insert, $data);
				}
			}

			// mPDF 5.7.2
			// <USE>
			preg_match_all('/<use ([^>]*)xlink:href\s*=\s*["\']#([^>]*?)["\']([^>]*)\/>/si', $data, $links);
			for ($i = 0; $i < count($links[0]); $i++) {

				// Get the item to use from defs
				$insert = '';
				if (preg_match('/<([a-zA-Z]*) [^>]*id\s*=\s*["\']' . $links[2][$i] . '["\'][^>]*\/>/si', $data, $m)) {
					$insert = $m[0];
				}
				if (!$insert && preg_match('/<([a-zA-Z]*) [^>]*id\s*=\s*["\']' . $links[2][$i] . '["\']/si', $data, $m)) {

					if (preg_match('/<' . $m[1] . '[^>]*id\s*=\s*["\']' . $links[2][$i] . '["\'][^>]*>.*?<\/' . $m[1] . '>/si', $data, $m)) {
						$insert = $m[0];
					}
				}

				if ($insert) {

					$inners = $links[1][$i] . ' ' . $links[3][$i];
					// Change x,y coords to translate()
					if (preg_match('/y\s*=\s*["\']([^>]*?)["\']/', $inners, $m)) {
						$y = $m[1];
					} else {
						$y = 0;
					}
					if (preg_match('/x\s*=\s*["\']([^>]*?)["\']/', $inners, $m)) {
						$x = $m[1];
					} else {
						$x = 0;
					}
					if ($x || $y) {
						$inners = preg_replace('/(y|x)\s*=\s*["\']([^>]*?)["\']/', '', $inners);
						if (preg_match('/transform\s*=\s*["\']([^>]*?)["\']/', $inners, $m)) {
							if (preg_match('/translate\(\s*([0-9\.]+)\s*,\s*([0-9\.]+)\s*\)/', $m[1], $mm)) {
								$transform = $m[1]; // transform="...."
								$x += $mm[1];
								$y += $mm[2];
								$transform = preg_replace('/' . preg_quote($mm[0], '/') . '/', '', $transform);
								$transform = 'transform="' . $transform . ' translate(' . $x . ', ' . $y . ')"';
								$inners = preg_replace('/' . preg_quote($m[0], '/') . '/is', $transform, $inners);
							} else {
								$inners = preg_replace('/' . preg_quote($m[0], '/') . '/is', 'transform="' . $m[1] . ' translate(' . $x . ', ' . $y . ')"', $inners);
							}
						} else {
							$inners .= ' transform="translate(' . $x . ', ' . $y . ')"';
						}
					}
				}
				$replacement = '<g ' . $inners . '>' . $insert . '</g>';
				$data = preg_replace('/' . preg_quote($links[0][$i], '/') . '/is', $replacement, $data);
			}
			preg_match_all('/<use ([^>]*)xlink:href\s*=\s*["\']#([^>]*?)["\']([^>]*)>\s*<\/use>/si', $data, $links);
			for ($i = 0; $i < count($links[0]); $i++) {

				// Get the item to use from defs
				$insert = '';
				if (preg_match('/<([a-zA-Z]*) [^>]*id\s*=\s*["\']' . $links[2][$i] . '["\'][^>]*\/>/si', $data, $m)) {
					$insert = $m[0];
				}
				if (!$insert && preg_match('/<([a-zA-Z]*) [^>]*id\s*=\s*["\']' . $links[2][$i] . '["\']/si', $data, $m)) {

					if (preg_match('/<' . $m[1] . '[^>]*id\s*=\s*["\']' . $links[2][$i] . '["\'][^>]*>.*?<\/' . $m[1] . '>/si', $data, $m)) {
						$insert = $m[0];
					}
				}

				if ($insert) {

					$inners = $links[1][$i] . ' ' . $links[3][$i];
					// Change x,y coords to translate()
					if (preg_match('/y\s*=\s*["\']([^>]*?)["\']/', $inners, $m)) {
						$y = $m[1];
					} else {
						$y = 0;
					}
					if (preg_match('/x\s*=\s*["\']([^>]*?)["\']/', $inners, $m)) {
						$x = $m[1];
					} else {
						$x = 0;
					}
					if ($x || $y) {
						$inners = preg_replace('/(y|x)\s*=\s*["\']([^>]*?)["\']/', '', $inners);
						if (preg_match('/transform\s*=\s*["\']([^>]*?)["\']/', $inners, $m)) {
							if (preg_match('/translate\(\s*([0-9\.]+)\s*,\s*([0-9\.]+)\s*\)/', $m[1], $mm)) {
								$transform = $m[1]; // transform="...."
								$x += $mm[1];
								$y += $mm[2];
								$transform = preg_replace('/' . preg_quote($mm[0], '/') . '/', '', $transform);
								$transform = 'transform="' . $transform . ' translate(' . $x . ', ' . $y . ')"';
								$inners = preg_replace('/' . preg_quote($m[0], '/') . '/is', $transform, $inners);
							} else {
								$inners = preg_replace('/' . preg_quote($m[0], '/') . '/is', 'transform="' . $m[1] . ' translate(' . $x . ', ' . $y . ')"', $inners);
							}
						} else {
							$inners .= ' transform="translate(' . $x . ', ' . $y . ')"';
						}
					}
					$replacement = '<g ' . $inners . '>' . $insert . '</g>';
					$data = preg_replace('/' . preg_quote($links[0][$i], '/') . '/is', $replacement, $data);
				}
			}
		}

		// Removes <pattern>
		$data = preg_replace('/<pattern.*?<\/pattern>/is', '', $data);
		// Removes <marker>
		$data = preg_replace('/<marker.*?<\/marker>/is', '', $data);

		$this->svg_info['data'] = $data;

		$this->svg_string = '';

		//
		//	chargement unique des fonctions
		if (!function_exists("xml_svg2pdf_start")) {

			function xml_svg2pdf_start($parser, $name, $attribs)
			{
				//
				//	definition
				global $svg_class, $last_gradid, $last_svg_fontid, $last_svg_fontdefw, $last_svg_fontstyle; // mPDF 6
				// mPDF 6
				if (strtolower($name) == 'font') {
					$last_svg_fontid = '';
					if (isset($attribs['horiz-adv-x']) && $attribs['horiz-adv-x']) {
						$last_svg_fontdefw = $attribs['horiz-adv-x'];
					}
					return;
				}
				// mPDF 6
				else if (strtolower($name) == 'font-face') {
					$last_svg_fontstyle = 'R';
					$last_svg_fontstyle .= (isset($attribs['font-weight']) && $attribs['font-weight'] == 'bold') ? 'B' : '';
					$last_svg_fontstyle .= (isset($attribs['font-style']) && $attribs['font-style'] == 'italic') ? 'I' : '';
					$last_svg_fontstyle .= (isset($attribs['font-variant']) && $attribs['font-variant'] == 'small-caps') ? 'S' : '';

					if (isset($attribs['font-family']) && $attribs['font-family']) {
						$tmp_svg_font = array(
							'units-per-em' => (isset($attribs['units-per-em']) ? $attribs['units-per-em'] : ''),
							'd' => '',
							'glyphs' => array()
						);
						$last_svg_fontid = strtolower($attribs['font-family']);
						if ($last_svg_fontdefw) {
							$tmp_svg_font['horiz-adv-x'] = $last_svg_fontdefw;
						} else {
							$tmp_svg_font['horiz-adv-x'] = 500;
						}
						$svg_class->svg_font[$last_svg_fontid][$last_svg_fontstyle] = $tmp_svg_font;
					}
					return;
				}
				// mPDF 6
				else if (strtolower($name) == 'missing-glyph') {
					if ($last_svg_fontid && isset($attribs['horiz-adv-x'])) {
						$svg_class->svg_font[$last_svg_fontid][$last_svg_fontstyle]['horiz-adv-x'] = (isset($attribs['horiz-adv-x']) ? $attribs['horiz-adv-x'] : '');
						$svg_class->svg_font[$last_svg_fontid][$last_svg_fontstyle]['d'] = (isset($attribs['d']) ? $attribs['d'] : '');
					}
					return;
				}
				// mPDF 6
				else if (strtolower($name) == 'glyph') {
					if ($last_svg_fontid && isset($attribs['unicode'])) {
						$svg_class->svg_font[$last_svg_fontid][$last_svg_fontstyle]['glyphs'][$attribs['unicode']] = array(
							'horiz-adv-x' => (isset($attribs['horiz-adv-x']) ? $attribs['horiz-adv-x'] : $last_svg_fontdefw),
							'd' => (isset($attribs['d']) ? $attribs['d'] : ''),
						);
					}
					return;
				}
				// mPDF 5.7.2
				else if (strtolower($name) == 'lineargradient') {
					$tmp_gradient = array(
						'type' => 'linear',
						'transform' => (isset($attribs['gradientTransform']) ? $attribs['gradientTransform'] : ''),
						'units' => (isset($attribs['gradientUnits']) ? $attribs['gradientUnits'] : ''),
						'spread' => (isset($attribs['spreadMethod']) ? $attribs['spreadMethod'] : ''),
						'color' => array()
					);
					if (isset($attribs['x1']))
						$tmp_gradient['info']['x1'] = $attribs['x1'];
					if (isset($attribs['y1']))
						$tmp_gradient['info']['y1'] = $attribs['y1'];
					if (isset($attribs['x2']))
						$tmp_gradient['info']['x2'] = $attribs['x2'];
					if (isset($attribs['y2']))
						$tmp_gradient['info']['y2'] = $attribs['y2'];
					$last_gradid = $attribs['id'];
					$svg_class->svgAddGradient($attribs['id'], $tmp_gradient);
					return;
				}
				else if (strtolower($name) == 'radialgradient') {
					$tmp_gradient = array(
						'type' => 'radial',
						'transform' => (isset($attribs['gradientTransform']) ? $attribs['gradientTransform'] : ''),
						'units' => (isset($attribs['gradientUnits']) ? $attribs['gradientUnits'] : ''),
						'spread' => (isset($attribs['spreadMethod']) ? $attribs['spreadMethod'] : ''),
						'color' => array()
					);
					if (isset($attribs['cx']))
						$tmp_gradient['info']['x0'] = $attribs['cx'];
					if (isset($attribs['cy']))
						$tmp_gradient['info']['y0'] = $attribs['cy'];
					if (isset($attribs['fx']))
						$tmp_gradient['info']['x1'] = $attribs['fx'];
					if (isset($attribs['fy']))
						$tmp_gradient['info']['y1'] = $attribs['fy'];
					if (isset($attribs['r']))
						$tmp_gradient['info']['r'] = $attribs['r'];
					$last_gradid = $attribs['id'];
					$svg_class->svgAddGradient($attribs['id'], $tmp_gradient);
					return;
				}
				else if (strtolower($name) == 'stop') {
					if (!$last_gradid)
						return;
					$color = '#000000';
					if (isset($attribs['style']) AND preg_match('/stop-color:\s*([^;]*)/i', $attribs['style'], $m)) {
						$color = trim($m[1]);
					} else if (isset($attribs['stop-color']) && $attribs['stop-color']) {
						$color = $attribs['stop-color'];
					}
					$col = $svg_class->mpdf_ref->ConvertColor($color);
					if (!$col) {
						$col = $svg_class->mpdf_ref->ConvertColor('#000000');
					} // In case "transparent" or "inherit" returned
					if ($col{0} == 3 || $col{0} == 5) { // RGB
						$color_final = sprintf('%.3F %.3F %.3F', ord($col{1}) / 255, ord($col{2}) / 255, ord($col{3}) / 255);
						$svg_class->svg_gradient[$last_gradid]['colorspace'] = 'RGB';
					} else if ($col{0} == 4 || $col{0} == 6) { // CMYK
						$color_final = sprintf('%.3F %.3F %.3F %.3F', ord($col{1}) / 100, ord($col{2}) / 100, ord($col{3}) / 100, ord($col{4}) / 100);
						$svg_class->svg_gradient[$last_gradid]['colorspace'] = 'CMYK';
					} else if ($col{0} == 1) { // Grayscale
						$color_final = sprintf('%.3F', ord($col{1}) / 255);
						$svg_class->svg_gradient[$last_gradid]['colorspace'] = 'Gray';
					}

					$stop_opacity = 1;
					if (isset($attribs['style']) AND preg_match('/stop-opacity:\s*([0-9.]*)/i', $attribs['style'], $m)) {
						$stop_opacity = $m[1];
					} else if (isset($attribs['stop-opacity'])) {
						$stop_opacity = $attribs['stop-opacity'];
					} else if ($col{0} == 5) { // RGBa
						$stop_opacity = ord($col{4} / 100);
					} else if ($col{0} == 6) { // CMYKa
						$stop_opacity = ord($col{5} / 100);
					}

					$tmp_color = array(
						'color' => $color_final,
						'offset' => (isset($attribs['offset']) ? $attribs['offset'] : ''),
						'opacity' => $stop_opacity
					);
					array_push($svg_class->svg_gradient[$last_gradid]['color'], $tmp_color);
					return;
				}
				if ($svg_class->inDefs) {
					return;
				}

				$svg_class->xbase = 0;
				$svg_class->ybase = 0;
				switch (strtolower($name)) {

					// Don't output stuff inside <defs>
					case 'defs':
						$svg_class->inDefs = true;
						return;

					case 'svg':
						$svg_class->svgOffset($attribs);
						break;

					case 'path':
						$path = $attribs['d'];
						preg_match_all('/([MZLHVCSQTAmzlhvcsqta])([eE ,\-.\d]+)*/', $path, $commands, PREG_SET_ORDER);
						$path_cmd = '';
						$svg_class->subPathInit = true;
						$svg_class->pathBBox = array(999999, 999999, -999999, -999999);
						foreach ($commands as $c) {
							if ((isset($c) && count($c) == 3) || (isset($c[2]) && $c[2] == '')) {
								list($tmp, $command, $arguments) = $c;
							} else {
								list($tmp, $command) = $c;
								$arguments = '';
							}

							$path_cmd .= $svg_class->svgPath($command, $arguments);
						}
						if ($svg_class->pathBBox[2] == -1999998) {
							$svg_class->pathBBox[2] = 100;
						}
						if ($svg_class->pathBBox[3] == -1999998) {
							$svg_class->pathBBox[3] = 100;
						}
						if ($svg_class->pathBBox[0] == 999999) {
							$svg_class->pathBBox[0] = 0;
						}
						if ($svg_class->pathBBox[1] == 999999) {
							$svg_class->pathBBox[1] = 0;
						}
						$critere_style = $attribs;
						unset($critere_style['d']);
						$path_style = $svg_class->svgDefineStyle($critere_style);
						break;

					case 'rect':
						if (!isset($attribs['x'])) {
							$attribs['x'] = 0;
						}
						if (!isset($attribs['y'])) {
							$attribs['y'] = 0;
						}
						if (!isset($attribs['rx'])) {
							$attribs['rx'] = 0;
						}
						if (!isset($attribs['ry'])) {
							$attribs['ry'] = 0;
						}
						$arguments = array();
						if (isset($attribs['x']))
							$arguments['x'] = $attribs['x'];
						if (isset($attribs['y']))
							$arguments['y'] = $attribs['y'];
						if (isset($attribs['width']))
							$arguments['w'] = $attribs['width'];
						if (isset($attribs['height']))
							$arguments['h'] = $attribs['height'];
						if (isset($attribs['rx']))
							$arguments['rx'] = $attribs['rx'];
						if (isset($attribs['ry']))
							$arguments['ry'] = $attribs['ry'];
						$path_cmd = $svg_class->svgRect($arguments);
						$critere_style = $attribs;
						unset($critere_style['x'], $critere_style['y'], $critere_style['rx'], $critere_style['ry'], $critere_style['height'], $critere_style['width']);
						$path_style = $svg_class->svgDefineStyle($critere_style);
						break;

					case 'circle':
						if (!isset($attribs['cx'])) {
							$attribs['cx'] = 0;
						}
						if (!isset($attribs['cy'])) {
							$attribs['cy'] = 0;
						}
						$arguments = array();
						if (isset($attribs['cx']))
							$arguments['cx'] = $attribs['cx'];
						if (isset($attribs['cy']))
							$arguments['cy'] = $attribs['cy'];
						if (isset($attribs['r']))
							$arguments['rx'] = $attribs['r'];
						if (isset($attribs['r']))
							$arguments['ry'] = $attribs['r'];
						$path_cmd = $svg_class->svgEllipse($arguments);
						$critere_style = $attribs;
						unset($critere_style['cx'], $critere_style['cy'], $critere_style['r']);
						$path_style = $svg_class->svgDefineStyle($critere_style);
						break;

					case 'ellipse':
						if (!isset($attribs['cx'])) {
							$attribs['cx'] = 0;
						}
						if (!isset($attribs['cy'])) {
							$attribs['cy'] = 0;
						}
						$arguments = array();
						if (isset($attribs['cx']))
							$arguments['cx'] = $attribs['cx'];
						if (isset($attribs['cy']))
							$arguments['cy'] = $attribs['cy'];
						if (isset($attribs['rx']))
							$arguments['rx'] = $attribs['rx'];
						if (isset($attribs['ry']))
							$arguments['ry'] = $attribs['ry'];
						$path_cmd = $svg_class->svgEllipse($arguments);
						$critere_style = $attribs;
						unset($critere_style['cx'], $critere_style['cy'], $critere_style['rx'], $critere_style['ry']);
						$path_style = $svg_class->svgDefineStyle($critere_style);
						break;

					case 'line':
						$arguments = array();
						$arguments[0] = (isset($attribs['x1']) ? $attribs['x1'] : '');
						$arguments[1] = (isset($attribs['y1']) ? $attribs['y1'] : '');
						$arguments[2] = (isset($attribs['x2']) ? $attribs['x2'] : '');
						$arguments[3] = (isset($attribs['y2']) ? $attribs['y2'] : '');
						$path_cmd = $svg_class->svgPolyline($arguments, false);
						$critere_style = $attribs;
						unset($critere_style['x1'], $critere_style['y1'], $critere_style['x2'], $critere_style['y2']);
						$path_style = $svg_class->svgDefineStyle($critere_style);
						break;

					case 'polyline':
						$path = $attribs['points'];
						preg_match_all('/[0-9\-\.]*/', $path, $tmp, PREG_SET_ORDER);
						$arguments = array();
						for ($i = 0; $i < count($tmp); $i++) {
							if ($tmp[$i][0] != '') {
								array_push($arguments, $tmp[$i][0]);
							}
						}
						$path_cmd = $svg_class->svgPolyline($arguments);
						$critere_style = $attribs;
						unset($critere_style['points']);
						$path_style = $svg_class->svgDefineStyle($critere_style);
						break;

					case 'polygon':
						$path = $attribs['points'];
						preg_match_all('/([\-]*[0-9\.]+)/', $path, $tmp);
						$arguments = array();
						for ($i = 0; $i < count($tmp[0]); $i++) {
							if ($tmp[0][$i] != '') {
								array_push($arguments, $tmp[0][$i]);
							}
						}
						$path_cmd = $svg_class->svgPolygon($arguments);
						//	definition du style de la forme:
						$critere_style = $attribs;
						unset($critere_style['points']);
						$path_style = $svg_class->svgDefineStyle($critere_style);
						break;

					// mPDF 5.7.4 Embedded image
					case 'image':
						if (isset($attribs['xlink:href']) && $attribs['xlink:href']) {
							$svg_class->svgImage($attribs);
						}
						break;


					case 'a':
						if (isset($attribs['xlink:href'])) {
							unset($attribs['xlink:href']); // this should be a hyperlink
							// not handled like a xlink:href in other elements
						}  // then continue like a <g>
					case 'g':
						$array_style = $svg_class->svgDefineStyle($attribs);
						if (!empty($array_style['transformations'])) {
							// If in the middle of <text> element, add to textoutput, else WriteString
							if ($svg_class->intext) {
								$svg_class->textoutput .= ' q ' . $array_style['transformations'];
							} // mPDF 5.7.4
							else {
								$svg_class->svgWriteString(' q ' . $array_style['transformations']);
							}
						}
						array_push($svg_class->svg_style, $array_style);

						$svg_class->svgDefineTxtStyle($attribs);

						break;

					case 'text':
						$svg_class->textlength = 0;  // mPDF 5.7.4
						$svg_class->texttotallength = 0; // mPDF 5.7.4
						$svg_class->textoutput = '';  // mPDF 5.7.4
						$svg_class->textanchor = 'start'; // mPDF 5.7.4
						$svg_class->textXorigin = 0;  // mPDF 5.7.4
						$svg_class->textYorigin = 0;  // mPDF 5.7.4

						$svg_class->intext = true;   // mPDF 5.7.4

						$styl = '';
						if (_SVG_CLASSES && isset($attribs['class']) && $attribs['class']) {
							$classes = preg_split('/\s+/', trim($attribs['class']));
							foreach ($classes AS $class) {
								if (isset($svg_class->mpdf_ref->cssmgr->CSS['CLASS>>' . strtoupper($class)])) {
									$c = $svg_class->mpdf_ref->cssmgr->CSS['CLASS>>' . strtoupper($class)];
									foreach ($c AS $prop => $val) {
										$styl .= strtolower($prop) . ':' . $val . ';';
									}
								}
							}
						}

						if (_SVG_AUTOFONT && isset($attribs['lang']) && $attribs['lang']) {
							if (!$svg_class->mpdf_ref->usingCoreFont) {
								if ($attribs['lang'] != $svg_class->mpdf_ref->default_lang) {
									list ($coreSuitable, $mpdf_unifont) = GetLangOpts($attribs['lang'], $svg_class->mpdf_ref->useAdobeCJK, $svg_class->mpdf_ref->fontdata);
									if ($mpdf_unifont) {
										$styl .= 'font-family:' . $mpdf_unifont . ';';
									}
								}
							}
						}

						if ($styl) {
							if (isset($attribs['style'])) {
								$attribs['style'] = $styl . $attribs['style'];
							} else {
								$attribs['style'] = $styl;
							}
						}

						$array_style = $svg_class->svgDefineStyle($attribs);
						if (!empty($array_style['transformations'])) {
							$svg_class->textoutput .= ' q ' . $array_style['transformations']; // mPDF 5.7.4
						}
						array_push($svg_class->svg_style, $array_style);

						$svg_class->txt_data = array();
						$x = isset($attribs['x']) ? $svg_class->ConvertSVGSizePixels($attribs['x'], 'x') : 0;  // mPDF 5.7.4
						$y = isset($attribs['y']) ? $svg_class->ConvertSVGSizePixels($attribs['y'], 'y') : 0;  // mPDF 5.7.4
						$x += isset($attribs['dx']) ? $svg_class->ConvertSVGSizePixels($attribs['dx'], 'x') : 0;  // mPDF 5.7.4
						$y += isset($attribs['dy']) ? $svg_class->ConvertSVGSizePixels($attribs['dy'], 'y') : 0;  // mPDF 5.7.4

						$svg_class->txt_data[0] = $x; // mPDF 5.7.4
						$svg_class->txt_data[1] = $y; // mPDF 5.7.4
						$critere_style = $attribs;
						unset($critere_style['x'], $critere_style['y']);
						$svg_class->svgDefineTxtStyle($critere_style);

						$svg_class->textanchor = $svg_class->txt_style[count($svg_class->txt_style) - 1]['text-anchor']; // mPDF 5.7.4
						$svg_class->textXorigin = $svg_class->txt_data[0];  // mPDF 5.7.4
						$svg_class->textYorigin = $svg_class->txt_data[1];  // mPDF 5.7.4
						$svg_class->textjuststarted = true;  // mPDF 5.7.4

						break;

					// mPDF 5.7.4
					case 'tspan':

						// OUTPUT CHUNK(s) UP To NOW (svgText updates $svg_class->textlength)
						$p_cmd = $svg_class->svgText();
						$svg_class->textoutput .= $p_cmd;
						$tmp = count($svg_class->svg_style) - 1;
						$current_style = $svg_class->svg_style[$tmp];

						$styl = '';
						if (_SVG_CLASSES && isset($attribs['class']) && $attribs['class']) {
							$classes = preg_split('/\s+/', trim($attribs['class']));
							foreach ($classes AS $class) {
								if (isset($svg_class->mpdf_ref->cssmgr->CSS['CLASS>>' . strtoupper($class)])) {
									$c = $svg_class->mpdf_ref->cssmgr->CSS['CLASS>>' . strtoupper($class)];
									foreach ($c AS $prop => $val) {
										$styl .= strtolower($prop) . ':' . $val . ';';
									}
								}
							}
						}

						if (_SVG_AUTOFONT && isset($attribs['lang']) && $attribs['lang']) {
							if (!$svg_class->mpdf_ref->usingCoreFont) {
								if ($attribs['lang'] != $svg_class->mpdf_ref->default_lang) {
									list ($coreSuitable, $mpdf_unifont) = GetLangOpts($attribs['lang'], $svg_class->mpdf_ref->useAdobeCJK, $svg_class->mpdf_ref->fontdata);
									if ($mpdf_unifont) {
										$styl .= 'font-family:' . $mpdf_unifont . ';';
									}
								}
							}
						}

						if ($styl) {
							if (isset($attribs['style'])) {
								$attribs['style'] = $styl . $attribs['style'];
							} else {
								$attribs['style'] = $styl;
							}
						}

						$array_style = $svg_class->svgDefineStyle($attribs);

						$svg_class->txt_data = array();


						// If absolute position adjustment (x or y), creates new block of text for text-alignment
						if (isset($attribs['x']) || isset($attribs['y'])) {
							// If text-anchor middle|end, adjust
							if ($svg_class->textanchor == 'end') {
								$tx = -$svg_class->texttotallength;
							} else if ($svg_class->textanchor == 'middle') {
								$tx = -$svg_class->texttotallength / 2;
							} else {
								$tx = 0;
							}
							while (preg_match('/mPDF-AXS\((.*?)\)/', $svg_class->textoutput, $m)) {
								if ($tx) {
									$txk = $m[1] + ($tx * $svg_class->kp);
									$svg_class->textoutput = preg_replace('/mPDF-AXS\((.*?)\)/', sprintf('%.4F', $txk), $svg_class->textoutput, 1);
								} else {
									$svg_class->textoutput = preg_replace('/mPDF-AXS\((.*?)\)/', '\\1', $svg_class->textoutput, 1);
								}
							}

							$svg_class->svgWriteString($svg_class->textoutput);

							$svg_class->textXorigin += $svg_class->textlength;
							$currentX = $svg_class->textXorigin;
							$currentY = $svg_class->textYorigin;
							$svg_class->textlength = 0;
							$svg_class->texttotallength = 0;
							$svg_class->textoutput = '';

							$x = isset($attribs['x']) ? $svg_class->ConvertSVGSizePixels($attribs['x'], 'x') : $currentX;
							$y = isset($attribs['y']) ? $svg_class->ConvertSVGSizePixels($attribs['y'], 'y') : $currentY;

							$svg_class->txt_data[0] = $x;
							$svg_class->txt_data[1] = $y;
							$critere_style = $attribs;
							unset($critere_style['x'], $critere_style['y']);
							$svg_class->svgDefineTxtStyle($critere_style);

							$svg_class->textanchor = $svg_class->txt_style[count($svg_class->txt_style) - 1]['text-anchor'];
							$svg_class->textXorigin = $x;
							$svg_class->textYorigin = $y;
						} else {

							$svg_class->textXorigin += $svg_class->textlength;
							$currentX = $svg_class->textXorigin;
							$currentY = $svg_class->textYorigin;

							$currentX += isset($attribs['dx']) ? $svg_class->ConvertSVGSizePixels($attribs['dx'], 'x') : 0;
							$currentY += isset($attribs['dy']) ? $svg_class->ConvertSVGSizePixels($attribs['dy'], 'y') : 0;

							$svg_class->txt_data[0] = $currentX;
							$svg_class->txt_data[1] = $currentY;
							$critere_style = $attribs;
							unset($critere_style['x'], $critere_style['y']);
							$svg_class->svgDefineTxtStyle($critere_style);
							$svg_class->textXorigin = $currentX;
							$svg_class->textYorigin = $currentY;
						}

						if (!empty($array_style['transformations'])) {
							$svg_class->textoutput .= ' q ' . $array_style['transformations'];
						}
						array_push($svg_class->svg_style, $array_style);

						break;
				}

				//
				//insertion des path et du style dans le flux de donné general.
				if (isset($path_cmd) && $path_cmd) {
					// mPDF 5.0
					list($prestyle, $poststyle) = $svg_class->svgStyle($path_style, $attribs, strtolower($name));
					if (isset($path_style['transformations']) && $path_style['transformations']) { // transformation on an element
						$svg_class->svgWriteString(" q " . $path_style['transformations'] . $prestyle . $path_cmd . $poststyle . " Q\n");
					} else {
						$svg_class->svgWriteString(" q " . $prestyle . $path_cmd . $poststyle . " Q\n"); // mPDF 5.7.4
					}
				}
			}

			function characterData($parser, $data)
			{
				global $svg_class;
				if ($svg_class->inDefs) {
					return;
				}  // mPDF 5.7.2
				if (isset($svg_class->txt_data[2])) {
					$svg_class->txt_data[2] .= $data;
				} else {
					$svg_class->txt_data[2] = $data;
					$svg_class->txt_data[0] = $svg_class->textXorigin;
					$svg_class->txt_data[1] = $svg_class->textYorigin;
				}
			}

			function xml_svg2pdf_end($parser, $name)
			{
				global $svg_class;
				// mPDF 5.7.2
				// Don't output stuff inside <defs>
				if ($name == 'defs') {
					$svg_class->inDefs = false;
					return;
				}
				if ($svg_class->inDefs) {
					return;
				}
				switch ($name) {

					case "g":
					case "a":
						if ($svg_class->intext) {
							$p_cmd = $svg_class->svgText();
							$svg_class->textoutput .= $p_cmd;
						}

						$tmp = count($svg_class->svg_style) - 1;
						$current_style = $svg_class->svg_style[$tmp];
						if (!empty($current_style['transformations'])) {
							// If in the middle of <text> element, add to textoutput, else WriteString
							if ($svg_class->intext) {
								$svg_class->textoutput .= " Q\n";
							} // mPDF 5.7.4
							else {
								$svg_class->svgWriteString(" Q\n");
							}
						}
						array_pop($svg_class->svg_style);
						array_pop($svg_class->txt_style);
						if ($svg_class->intext) {
							$svg_class->textXorigin += $svg_class->textlength;
							$svg_class->textlength = 0;
						}

						break;
					case 'font':
						$last_svg_fontdefw = '';
						break;
					case 'font-face':
						$last_svg_fontid = '';
						$last_svg_fontstyle = '';
						break;
					case 'radialgradient':
					case 'lineargradient':
						$last_gradid = '';
						break;
					case "text":
						$svg_class->txt_data[2] = rtrim($svg_class->txt_data[2]); // mPDF 5.7.4
						$path_cmd = $svg_class->svgText();
						$svg_class->textoutput .= $path_cmd; // mPDF 5.7.4
						$tmp = count($svg_class->svg_style) - 1;
						$current_style = $svg_class->svg_style[$tmp];
						if (!empty($current_style['transformations'])) {
							$svg_class->textoutput .= " Q\n"; // mPDF 5.7.4
						}
						array_pop($svg_class->svg_style);
						array_pop($svg_class->txt_style); // mPDF 5.7.4
						// mPDF 5.7.4
						// If text-anchor middle|end, adjust
						if ($svg_class->textanchor == 'end') {
							$tx = -$svg_class->texttotallength;
						} else if ($svg_class->textanchor == 'middle') {
							$tx = -$svg_class->texttotallength / 2;
						} else {
							$tx = 0;
						}
						while (preg_match('/mPDF-AXS\((.*?)\)/', $svg_class->textoutput, $m)) {
							if ($tx) {
								$txk = $m[1] + ($tx * $svg_class->kp);
								$svg_class->textoutput = preg_replace('/mPDF-AXS\((.*?)\)/', sprintf('%.4F', $txk), $svg_class->textoutput, 1);
							} else {
								$svg_class->textoutput = preg_replace('/mPDF-AXS\((.*?)\)/', '\\1', $svg_class->textoutput, 1);
							}
						}

						$svg_class->svgWriteString($svg_class->textoutput);
						$svg_class->textlength = 0;
						$svg_class->texttotallength = 0;
						$svg_class->textoutput = '';
						$svg_class->intext = false;   // mPDF 5.7.4

						break;
					// mPDF 5.7.4
					case "tspan":
						$p_cmd = $svg_class->svgText();
						$svg_class->textoutput .= $p_cmd;
						$tmp = count($svg_class->svg_style) - 1;
						$current_style = $svg_class->svg_style[$tmp];
						if ($current_style['transformations']) {
							$svg_class->textoutput .= " Q\n";
						}
						array_pop($svg_class->svg_style);
						array_pop($svg_class->txt_style);

						$svg_class->textXorigin += $svg_class->textlength;
						$svg_class->textlength = 0;

						break;
				}
			}

		}

		$svg2pdf_xml = '';
		global $svg_class;
		$svg_class = $this;
		// Don't output stuff inside <defs>
		$svg_class->inDefs = false;
		$svg2pdf_xml_parser = xml_parser_create("utf-8");
		xml_parser_set_option($svg2pdf_xml_parser, XML_OPTION_CASE_FOLDING, false);
		xml_set_element_handler($svg2pdf_xml_parser, "xml_svg2pdf_start", "xml_svg2pdf_end");
		xml_set_character_data_handler($svg2pdf_xml_parser, "characterData");
		xml_parse($svg2pdf_xml_parser, $data);
		if ($this->svg_error) {
			return false;
		} else {
			return array('x' => $this->svg_info['x'] * $this->kp, 'y' => -$this->svg_info['y'] * $this->kp, 'w' => $this->svg_info['w'] * $this->kp, 'h' => -$this->svg_info['h'] * $this->kp, 'data' => $svg_class->svg_string);
		}
	}

// AUTOFONT =========================
	function markScriptToLang($html)
	{
		if ($this->mpdf_ref->onlyCoreFonts) {
			return $html;
		}
		if (empty($this->script2lang)) {
			if (!empty($this->mpdf_ref->script2lang)) {
				$this->script2lang = $this->mpdf_ref->script2lang;
				$this->viet = $this->mpdf_ref->viet;
				$this->pashto = $this->mpdf_ref->pashto;
				$this->urdu = $this->mpdf_ref->urdu;
				$this->persian = $this->mpdf_ref->persian;
				$this->sindhi = $this->mpdf_ref->sindhi;
			} else {
				include(_MPDF_PATH . 'config_script2lang.php');
			}
		}

		$n = '';
		$a = preg_split('/<(.*?)>/ms', $html, -1, PREG_SPLIT_DELIM_CAPTURE);
		foreach ($a as $i => $e) {
			if ($i % 2 == 0) {
				$e = strcode2utf($e);
				$e = $this->mpdf_ref->lesser_entity_decode($e);

				$earr = $this->mpdf_ref->UTF8StringToArray($e, false);

				$scriptblock = 0;
				$scriptblocks = array();
				$scriptblocks[0] = 0;
				$chardata = array();
				$subchunk = 0;
				$charctr = 0;
				foreach ($earr as $char) {
					$ucd_record = UCDN::get_ucd_record($char);
					$sbl = $ucd_record[6];

					if ($sbl && $sbl != 40 && $sbl != 102) {
						if ($scriptblock == 0) {
							$scriptblock = $sbl;
							$scriptblocks[$subchunk] = $scriptblock;
						} else if ($scriptblock > 0 && $scriptblock != $sbl) {
							// NEW (non-common) Script encountered in this chunk.
							// Start a new subchunk
							$subchunk++;
							$scriptblock = $sbl;
							$charctr = 0;
							$scriptblocks[$subchunk] = $scriptblock;
						}
					}

					$chardata[$subchunk][$charctr]['script'] = $sbl;
					$chardata[$subchunk][$charctr]['uni'] = $char;
					$charctr++;
				}

				// If scriptblock[x] = common & non-baseScript
				// and scriptblock[x+1] = baseScript
				// Move common script from end of x to start of x+1
				for ($sch = 0; $sch < $subchunk; $sch++) {
					if ($scriptblocks[$sch] > 0 && $scriptblocks[$sch] != $this->mpdf_ref->baseScript && $scriptblocks[$sch + 1] == $this->mpdf_ref->baseScript) {
						$end = count($chardata[$sch]) - 1;
						while ($chardata[$sch][$end]['script'] == 0 && $end > 1) { // common script
							$tmp = array_pop($chardata[$sch]);
							array_unshift($chardata[$sch + 1], $tmp);
							$end--;
						}
					}
				}

				$o = '';
				for ($sch = 0; $sch <= $subchunk; $sch++) {
					if (isset($chardata[$sch])) {
						$s = '';
						for ($j = 0; $j < count($chardata[$sch]); $j++) {
							$s.=code2utf($chardata[$sch][$j]['uni']);
						}
						// ZZZ99 Undo lesser_entity_decode as above - but only for <>&
						$s = str_replace("&", "&amp;", $s);
						$s = str_replace("<", "&lt;", $s);
						$s = str_replace(">", "&gt;", $s);

						if (substr($a[$i - 1], 0, 5) != '<text' && substr($a[$i - 1], 0, 5) != '<tspa') {
							continue;
						} // <tspan> or <text> only

						$lang = '';
						// Check Vietnamese if Latin script - even if Basescript
						if ($scriptblocks[$sch] == UCDN::SCRIPT_LATIN && $this->mpdf_ref->autoVietnamese && preg_match("/([" . $this->viet . "])/u", $s)) {
							$lang = "vi";
						}
						// Check Arabic for different languages if Arabic script - even if Basescript
						else if ($scriptblocks[$sch] == UCDN::SCRIPT_ARABIC && $this->mpdf_ref->autoArabic) {
							if (preg_match("/[" . $this->sindhi . "]/u", $s)) {
								$lang = "sd";
							} else if (preg_match("/[" . $this->urdu . "]/u", $s)) {
								$lang = "ur";
							} else if (preg_match("/[" . $this->pashto . "]/u", $s)) {
								$lang = "ps";
							} else if (preg_match("/[" . $this->persian . "]/u", $s)) {
								$lang = "fa";
							} else if ($this->mpdf_ref->baseScript != UCDN::SCRIPT_ARABIC && isset($this->script2lang[$scriptblocks[$sch]])) {
								$lang = "'.$this->script2lang[$scriptblocks[$sch]].'";
							}
						}
						// Identify Script block if not Basescript, and mark up as language
						else if ($scriptblocks[$sch] > 0 && $scriptblocks[$sch] != $this->mpdf_ref->baseScript && isset($this->script2lang[$scriptblocks[$sch]])) {
							$lang = $this->script2lang[$scriptblocks[$sch]];
						}
						if ($lang) {
							$o .= '<tspan lang="' . $lang . '">' . $s . '</tspan>';
						} else {
							$o .= $s;
						}
					}
				}

				$a[$i] = $o;
			} else {
				$a[$i] = '<' . $e . '>';
			}
		}
		$n = implode('', $a);
		return $n;
	}

}

// END OF CLASS
// END OF CLASS
// END OF CLASS


function calc_bezier_bbox($start, $c)
{
	$P0 = array($start[0], $start[1]);
	$P1 = array($c[0], $c[1]);
	$P2 = array($c[2], $c[3]);
	$P3 = array($c[4], $c[5]);
	$bounds = array();
	$bounds[0][] = $P0[0];
	$bounds[1][] = $P0[1];
	$bounds[0][] = $P3[0];
	$bounds[1][] = $P3[1];
	for ($i = 0; $i <= 1; $i++) {
		$b = 6 * $P0[$i] - 12 * $P1[$i] + 6 * $P2[$i];
		$a = -3 * $P0[$i] + 9 * $P1[$i] - 9 * $P2[$i] + 3 * $P3[$i];
		$c = 3 * $P1[$i] - 3 * $P0[$i];
		if ($a == 0) {
			if ($b == 0) {
				continue;
			}
			$t = -$c / $b;
			if ($t > 0 && $t < 1) {
				$bounds[$i][] = (pow((1 - $t), 3) * $P0[$i] + 3 * pow((1 - $t), 2) * $t * $P1[$i] + 3 * (1 - $t) * pow($t, 2) * $P2[$i] + pow($t, 3) * $P3[$i]);
			}
			continue;
		}
		$b2ac = pow($b, 2) - 4 * $c * $a;
		if ($b2ac < 0) {
			continue;
		}
		$t1 = (-$b + sqrt($b2ac)) / (2 * $a);
		if ($t1 > 0 && $t1 < 1) {
			$bounds[$i][] = (pow((1 - $t1), 3) * $P0[$i] + 3 * pow((1 - $t1), 2) * $t1 * $P1[$i] + 3 * (1 - $t1) * pow($t1, 2) * $P2[$i] + pow($t1, 3) * $P3[$i]);
		}
		$t2 = (-$b - sqrt($b2ac)) / (2 * $a);
		if ($t2 > 0 && $t2 < 1) {
			$bounds[$i][] = (pow((1 - $t2), 3) * $P0[$i] + 3 * pow((1 - $t2), 2) * $t2 * $P1[$i] + 3 * (1 - $t2) * pow($t2, 2) * $P2[$i] + pow($t2, 3) * $P3[$i]);
		}
	}
	$x = min($bounds[0]);
	$x2 = max($bounds[0]);
	$y = min($bounds[1]);
	$y2 = max($bounds[1]);
	return array($x, $y, $x2, $y2);
}

function _testIntersectCircle($cx, $cy, $cr)
{
	// Tests whether a circle fully encloses a rectangle 0,0,1,1
	// to see if any further radial gradients need adding (SVG)
	// If centre of circle is inside 0,0,1,1 square
	if ($cx >= 0 && $cx <= 1 && $cy >= 0 && $cy <= 1) {
		$maxd = 1.5;
	}
	// distance to four corners
	else {
		$d1 = sqrt(pow(($cy - 0), 2) + pow(($cx - 0), 2));
		$d2 = sqrt(pow(($cy - 1), 2) + pow(($cx - 0), 2));
		$d3 = sqrt(pow(($cy - 0), 2) + pow(($cx - 1), 2));
		$d4 = sqrt(pow(($cy - 1), 2) + pow(($cx - 1), 2));
		$maxd = max($d1, $d2, $d3, $d4);
	}
	if ($cr < $maxd) {
		return true;
	} else {
		return false;
	}
}

function _testIntersect($x1, $y1, $x2, $y2, $x3, $y3, $x4, $y4)
{
	// Tests whether line (x1, y1) and (x2, y2) [a gradient axis (perpendicular)]
	// intersects with a specific line segment (x3, y3) and (x4, y4)
	$a1 = $y2 - $y1;
	$b1 = $x1 - $x2;
	$c1 = $a1 * $x1 + $b1 * $y1;
	$a2 = $y4 - $y3;
	$b2 = $x3 - $x4;
	$c2 = $a2 * $x3 + $b2 * $y3;
	$det = $a1 * $b2 - $a2 * $b1;
	if ($det == 0) { //Lines are parallel
		return false;
	} else {
		$x = ($b2 * $c1 - $b1 * $c2) / $det;
		$y = ($a1 * $c2 - $a2 * $c1) / $det;
		if ($x >= $x3 && $x <= $x4 && $y >= $y3 && $y <= $y4) {
			return true;
		}
	}
	return false;
}

Youez - 2016 - github.com/yon3zu
LinuXploit