���� JFIF  XX �� �� �     $.' ",#(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�8 ds|\���Ҿp6�Ҵ���]��.����6� z<�v��@]�i% �� $j��~ �g��J>��no����pM[me�i$[�� �� s�o�ᘨ�˸ nɜG-�ĨU�ycP� 3.DB�li�;� �hj���x 7Z^�N�h��� ���N3u{�:j �x�힞��#M &��jL P@ _���� P�� &��o8 ������9 �����@Sz 6�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*-i H��g�D�)� E�m�|�ؘbҗ�a ��Ҿ���� t4��� o���G��*oCN�rP���Q��@z,|?W[0 �����:�n,j WiE��W� �$~/�hp\��?��{(�0���+�Y8rΟ�+����>S-S�� ��VN;� }�s?.����� w �9��˟<���Mq4�Wv' ��{)0�1mB ��V����W[� ����8�/<� �%���wT^�5���b��)iM� p g�N�&ݝ� �VO~� q���u���9� ����!��J27��� �$ O-���! �: �%H��� ـ ����y�ΠM=t{!S�� oK8������ t<����è :a�� ����[���� �ա�H���~��w��Qz`�p o�^ �� ��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�_�uX 6��3?nk��Wy�f;^*B� ��@ �~a�`��Eu������ +� �� 6�L��.ü>��}y���}_�O�6�͐�:�Yr G�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�!0 39C� �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 Xp 3�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@:)ִ�:�]��h v�E� w���T�l ��P� ��"Ju�}��وV J��G6��. J/�Qgl߭�e�����@�z�Zev2u� )]կ��� ��7x�� �s�M�-<ɯ�c��r� v�����@��$�ޮ}lk���a�� �'����>x��O\�Z Fu>��� ��ck#��&:��`�$ �ai�>2Δ����l���oF[h� �lE�ܺ�Π k:)���` �� $[6�����9�����kOw�\|��� 8}������ބ:��񶐕� �I�A1/� =�2[�,�!��.}gN#�u����b ��� ~� �݊��}34q��� �d�E��L c��$ ��"�[q�U�硬g^��%B � z���r�p J�ru%v\h 1Y�ne` ǥ:g�� �pQM~�^� Xi� ��`S�:V2 9.�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& Ú����2 g�}&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��f2 4;�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)*P t����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���#y w��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���/$�WP w���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��B S�('$�ɻ� �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 : 127.0.0.1  /  Your IP : 10.100.1.254
Web Server : Apache/2.4.58 (Win64) OpenSSL/3.1.3 PHP/8.0.30
System : Windows NT WIZC-EXTRANET 10.0 build 19045 (Windows 10) AMD64
User : SYSTEM ( 0)
PHP Version : 8.0.30
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /xampp/php/pear/File/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /xampp/php/pear/File/PDF.php
<?php
/**
 * The File_PDF class provides a PHP-only implementation of a PDF library. No
 * external libs or PHP extensions are required.
 *
 * Based on the FPDF class by Olivier Plathey (http://www.fpdf.org/).
 *
 * $Horde: framework/File_PDF/PDF.php,v 1.18.10.22 2011/08/06 21:37:11 jan Exp $
 *
 * Copyright 2001-2003 Olivier Plathey <olivier@fpdf.org>
 * Copyright 2003-2009 The Horde Project (http://www.horde.org/)
 *
 * See the enclosed file COPYING for license information (LGPL). If you
 * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
 *
 * @author   Olivier Plathey <olivier@fpdf.org>
 * @author   Marko Djukic <marko@oblo.com>
 * @author   Jan Schneider <jan@horde.org>
 * @package  File_PDF
 * @category Fileformats
 */

/**
 * This hack works around Horde bug #4094
 * (http://bugs.horde.org/ticket/?id=4094)
 *
 * Once this package does not need to support PHP < 4.3.10 anymore the
 * following definiton can be removed and the ugly code can be removed
 * using
 *
 * sed -i -e 's/\' \. FILE_PDF_FLOAT \. \'/F/g' PDF.php
 */
if (version_compare(PHP_VERSION, '4.3.10', '>=')) {
    define('FILE_PDF_FLOAT', 'F');
} else {
    define('FILE_PDF_FLOAT', 'f');
}

class File_PDF {

    /**
     * Current page number.
     *
     * @var integer
     */
    var $_page = 0;

    /**
     * Current object number.
     *
     * @var integer
     */
    var $_n = 2;

    /**
     * Array of object offsets.
     *
     * @var array
     */
    var $_offsets = array();

    /**
     * Buffer holding in-memory PDF.
     *
     * @var string
     */
    var $_buffer = '';

    /**
     * Buffer length, including already flushed content.
     *
     * @var integer
     */
    var $_buflen = 0;

    /**
     * Whether the buffer has been flushed already.
     *
     * @var boolean
     */
    var $_flushed = false;

    /**
     * Array containing the pages.
     *
     * @var array
     */
    var $_pages = array();

    /**
     * Current document state.<pre>
     *   0 - initial state
     *   1 - document opened
     *   2 - page opened
     *   3 - document closed
     * </pre>
     *
     * @var integer
     */
    var $_state = 0;

    /**
     * Flag indicating if PDF file is to be compressed or not.
     *
     * @var boolean
     */
    var $_compress;

    /**
     * The default page orientation.
     *
     * @var string
     */
    var $_default_orientation;

    /**
     * The current page orientation.
     *
     * @var string
     */
    var $_current_orientation;

    /**
     * Array indicating orientation changes.
     *
     * @var array
     */
    var $_orientation_changes = array();

    /**
     * Current width of page format in points.
     *
     * @var float
     */
    var $fwPt;

    /**
     * Current height of page format in points.
     *
     * @var float
     */
    var $fhPt;

    /**
     * Current width of page format in user units.
     *
     * @var float
     */
    var $fw;

    /**
     * Current height of page format in user units.
     *
     * @var float
     */
    var $fh;

    /**
     * Current width of page in points.
     *
     * @var float
     */
    var $wPt;

    /**
     * Current height of page in points.
     *
     * @var float
     */
    var $hPt;

    /**
     * Current width of page in user units
     *
     * @var float
     */
    var $w;

    /**
     * Current height of page in user units
     *
     * @var float
     */
    var $h;

    /**
     * Scale factor (number of points in user units).
     *
     * @var float
     */
    var $_scale;

    /**
     * Left page margin size.
     *
     * @var float
     */
    var $_left_margin;

    /**
     * Top page margin size.
     *
     * @var float
     */
    var $_top_margin;

    /**
     * Right page margin size.
     *
     * @var float
     */
    var $_right_margin;

    /**
     * Break page margin size, the bottom margin which triggers a page break.
     *
     * @var float
     */
    var $_break_margin;

    /**
     * Cell margin size.
     *
     * @var float
     */
    var $_cell_margin;

    /**
     * The current horizontal position for cell positioning.
     * Value is set in user units and is calculated from the top left corner
     * as origin.
     *
     * @var float
     */
    var $x;

    /**
     * The current vertical position for cell positioning.
     * Value is set in user units and is calculated from the top left corner
     * as origin.
     *
     * @var float
     */
    var $y;

    /**
     * The height of the last cell printed.
     *
     * @var float
     */
    var $_last_height;

    /**
     * Line width in user units.
     *
     * @var float
     */
    var $_line_width;

    /**
     * An array of standard font names.
     *
     * @var array
     */
    var $_core_fonts = array('courier'      => 'Courier',
                             'courierB'     => 'Courier-Bold',
                             'courierI'     => 'Courier-Oblique',
                             'courierBI'    => 'Courier-BoldOblique',
                             'helvetica'    => 'Helvetica',
                             'helveticaB'   => 'Helvetica-Bold',
                             'helveticaI'   => 'Helvetica-Oblique',
                             'helveticaBI'  => 'Helvetica-BoldOblique',
                             'times'        => 'Times-Roman',
                             'timesB'       => 'Times-Bold',
                             'timesI'       => 'Times-Italic',
                             'timesBI'      => 'Times-BoldItalic',
                             'symbol'       => 'Symbol',
                             'zapfdingbats' => 'ZapfDingbats');

    /**
     * An array of used fonts.
     *
     * @var array
     */
    var $_fonts = array();

    /**
     * An array of font files.
     *
     * @var array
     */
    var $_font_files = array();

    /**
     * An array of encoding differences.
     *
     * @var array
     */
    var $_diffs = array();

    /**
     * An array of used images.
     *
     * @var array
     */
    var $_images = array();

    /**
     * An array of links in pages.
     *
     * @var array
     */
    var $_page_links;

    /**
     * An array of internal links.
     *
     * @var array
     */
    var $_links = array();

    /**
     * Current font family.
     *
     * @var string
     */
    var $_font_family = '';

    /**
     * Current font style.
     *
     * @var string
     */
    var $_font_style = '';

    /**
     * Underlining flag.
     *
     * @var boolean
     */
    var $_underline = false;

    /**
     * An array containing current font info.
     *
     * @var array
     */
    var $_current_font;

    /**
     * Current font size in points.
     *
     * @var float
     */
    var $_font_size_pt = 12;

    /**
     * Current font size in user units.
     *
     * @var float
     */
    var $_font_size = 12;

    /**
     * Commands for filling color.
     *
     * @var string
     */
    var $_fill_color = '0 g';

    /**
     * Commands for text color.
     *
     * @var string
     */
    var $_text_color = '0 g';

    /**
     * Whether text color is different from fill color.
     *
     * @var boolean
     */
    var $_color_flag = false;

    /**
     * Commands for drawing color.
     *
     * @var string
     */
    var $_draw_color = '0 G';

    /**
     * Word spacing.
     *
     * @var integer
     */
    var $_word_spacing = 0;

    /**
     * Automatic page breaking.
     *
     * @var boolean
     */
    var $_auto_page_break;

    /**
     * Threshold used to trigger page breaks.
     *
     * @var float
     */
    var $_page_break_trigger;

    /**
     * Flag set when processing footer.
     *
     * @var boolean
     */
    var $_in_footer = false;

    /**
     * Zoom display mode.
     *
     * @var string
     */
    var $_zoom_mode;

    /**
     * Layout display mode.
     *
     * @var string
     */
    var $_layout_mode;

    /**
     * An array containing the document info, consisting of:
     *   - title
     *   - subject
     *   - author
     *   - keywords
     *   - creator
     *
     * @var array
     */
    var $_info = array();

    /**
     * Alias for total number of pages.
     *
     * @var string
     */
    var $_alias_nb_pages = '{nb}';

    /**
     * Attempts to return a conrete PDF instance.
     *
     * It allows to set up the page format, the orientation and the units of
     * measurement used in all the methods (except for the font sizes).
     *
     * Example:
     * <code>
     * $pdf = File_PDF::factory(array('orientation' => 'P',
     *                                'unit' => 'mm',
     *                                'format' => 'A4'));
     * </code>
     *
     * @param array $params  A hash with parameters for the created PDF object.
     *                       Possible parameters are:
     *                       - orientation - Default page orientation. Possible
     *                         values are (case insensitive):
     *                         - P or Portrait (default)
     *                         - L or Landscape
     *                       - unit - User measure units. Possible values
     *                         values are:
     *                         - pt: point
     *                         - mm: millimeter (default)
     *                         - cm: centimeter
     *                         - in: inch
     *                         A point equals 1/72 of inch, that is to say
     *                         about 0.35 mm (an inch being 2.54 cm). This is a
     *                         very common unit in typography; font sizes are
     *                         expressed in that unit.
     *                       - format - The format used for pages. It can be
     *                         either one of the following values (case
     *                         insensitive):
     *                         - A3
     *                         - A4 (default)
     *                         - A5
     *                         - Letter
     *                         - Legal
     *                         or a custom format in the form of a two-element
     *                         array containing the width and the height
     *                         (expressed in the unit given by the unit
     *                         parameter).
     * @param string $class  The concrete class name to return an instance of.
     *                       Defaults to File_PDF.
     */
    function &factory($params = array(), $class = 'File_PDF')
    {
        /* Default parameters. */
        $defaults = array('orientation' => 'P',
                          'unit' => 'mm',
                          'format' => 'A4');

        /* Backward compatibility with old method signature. */
        /* Should be removed a few versions later. */
        if (!is_array($params)) {
            $class = 'File_PDF';
            $params = $defaults;
            $names = array_keys($defaults);
            for ($i = 0; $i < func_num_args(); $i++) {
                $params[$names[$i]] = func_get_arg($i);
            }
        } else {
            $params = array_merge($defaults, $params);
        }

        /* Create the PDF object. */
        $pdf = new $class($params);

        /* Scale factor. */
        if ($params['unit'] == 'pt') {
            $pdf->_scale = 1;
        } elseif ($params['unit'] == 'mm') {
            $pdf->_scale = 72 / 25.4;
        } elseif ($params['unit'] == 'cm') {
            $pdf->_scale = 72 / 2.54;
        } elseif ($params['unit'] == 'in') {
            $pdf->_scale = 72;
        } else {
            $error = File_PDF::raiseError(sprintf('Incorrect units: %s', $params['unit']));
            return $error;
        }
        /* Page format. */
        if (is_string($params['format'])) {
            $params['format'] = strtolower($params['format']);
            if ($params['format'] == 'a3') {
                $params['format'] = array(841.89, 1190.55);
            } elseif ($params['format'] == 'a4') {
                $params['format'] = array(595.28, 841.89);
            } elseif ($params['format'] == 'a5') {
                $params['format'] = array(420.94, 595.28);
            } elseif ($params['format'] == 'letter') {
                $params['format'] = array(612, 792);
            } elseif ($params['format'] == 'legal') {
                $params['format'] = array(612, 1008);
            } else {
                $error = File_PDF::raiseError(sprintf('Unknown page format: %s', $params['format']));
                return $error;
            }
            $pdf->fwPt = $params['format'][0];
            $pdf->fhPt = $params['format'][1];
        } else {
            $pdf->fwPt = $params['format'][0] * $pdf->_scale;
            $pdf->fhPt = $params['format'][1] * $pdf->_scale;
        }
        $pdf->fw = $pdf->fwPt / $pdf->_scale;
        $pdf->fh = $pdf->fhPt / $pdf->_scale;

        /* Page orientation. */
        $params['orientation'] = strtolower($params['orientation']);
        if ($params['orientation'] == 'p' || $params['orientation'] == 'portrait') {
            $pdf->_default_orientation = 'P';
            $pdf->wPt = $pdf->fwPt;
            $pdf->hPt = $pdf->fhPt;
        } elseif ($params['orientation'] == 'l' || $params['orientation'] == 'landscape') {
            $pdf->_default_orientation = 'L';
            $pdf->wPt = $pdf->fhPt;
            $pdf->hPt = $pdf->fwPt;
        } else {
            $error = File_PDF::raiseError(sprintf('Incorrect orientation: %s', $params['orientation']));
            return $error;
        }
        $pdf->_current_orientation = $pdf->_default_orientation;
        $pdf->w = $pdf->wPt / $pdf->_scale;
        $pdf->h = $pdf->hPt / $pdf->_scale;

        /* Page margins (1 cm) */
        $margin = 28.35 / $pdf->_scale;
        $pdf->setMargins($margin, $margin);

        /* Interior cell margin (1 mm) */
        $pdf->_cell_margin = $margin / 10;

        /* Line width (0.2 mm) */
        $pdf->_line_width = .567 / $pdf->_scale;

        /* Automatic page break */
        $pdf->setAutoPageBreak(true, 2 * $margin);

        /* Full width display mode */
        $pdf->setDisplayMode('fullwidth');

        /* Compression */
        $pdf->setCompression(true);

        return $pdf;
    }

    /**
     * Returns a PEAR_Error object.
     *
     * Wraps around PEAR::raiseError() to avoid having to include PEAR.php
     * unless an error occurs.
     *
     * @param mixed $error  The error message.
     *
     * @return object PEAR_Error
     */
    function raiseError($error)
    {
        require_once 'PEAR.php';
        return PEAR::raiseError($error);
    }

    /**
     * Defines the left, top and right margins.
     *
     * By default, they equal 1 cm. Call this method to change them.
     *
     * @param float $left   Left margin.
     * @param float $top    Top margin.
     * @param float $right  Right margin. If not specified default to the value
     *                      of the left one.
     *
     * @see setAutoPageBreak()
     * @see setLeftMargin()
     * @see setRightMargin()
     * @see setTopMargin()
     */
    function setMargins($left, $top, $right = null)
    {
        /* Set left and top margins. */
        $this->_left_margin  = $left;
        $this->_top_margin   = $top;
        /* If no right margin set default to same as left. */
        $this->_right_margin = (is_null($right) ? $left : $right);
    }

    /**
     * Defines the left margin.
     *
     * The method can be called before creating the first page.  If the
     * current abscissa gets out of page, it is brought back to the margin.
     *
     * @param float $margin  The margin.
     *
     * @see setAutoPageBreak()
     * @see setMargins()
     * @see setRightMargin()
     * @see setTopMargin()
     */
    function setLeftMargin($margin)
    {
        $this->_left_margin = $margin;
        /* If there is a current page and the current X position is less than
         * margin set the X position to the margin value. */
        if ($this->_page > 0 && $this->x < $margin) {
            $this->x = $margin;
        }
    }

    /**
     * Defines the top margin.
     *
     * The method can be called before creating the first page.
     *
     * @param float $margin  The margin.
     */
    function setTopMargin($margin)
    {
        $this->_top_margin = $margin;
    }

    /**
     * Defines the right margin.
     *
     * The method can be called before creating the first page.
     *
     * @param float $margin  The margin.
     */
    function setRightMargin($margin)
    {
        $this->_right_margin = $margin;
    }

    /**
     * Returns the actual page width.
     *
     * @since File_PDF 0.2.0
     * @since Horde 3.2
     *
     * @return float  The page width.
     */
    function getPageWidth()
    {
        return ($this->w - $this->_right_margin - $this->_left_margin);
    }

    /**
     * Returns the actual page height.
     *
     * @since File_PDF 0.2.0
     * @since Horde 3.2
     *
     * @return float  The page height.
     */
    function getPageHeight()
    {
        return ($this->h - $this->_top_margin - $this->_break_margin);
    }

    /**
     * Enables or disables the automatic page breaking mode.
     *
     * When enabling, the second parameter is the distance from the bottom of
     * the page that defines the triggering limit. By default, the mode is on
     * and the margin is 2 cm.
     *
     * @param boolean $auto  Boolean indicating if mode should be on or off.
     * @param float $margin  Distance from the bottom of the page.
     */
    function setAutoPageBreak($auto, $margin = 0)
    {
        $this->_auto_page_break    = $auto;
        $this->_break_margin       = $margin;
        $this->_page_break_trigger = $this->h - $margin;
    }

    /**
     * Defines the way the document is to be displayed by the viewer.
     *
     * The zoom level can be set: pages can be displayed entirely on screen,
     * occupy the full width of the window, use real size, be scaled by a
     * specific zooming factor or use viewer default (configured in the
     * Preferences menu of Acrobat). The page layout can be specified too:
     * single at once, continuous display, two columns or viewer default.  By
     * default, documents use the full width mode with continuous display.
     *
     * @param mixed $zoom    The zoom to use. It can be one of the following
     *                       string values:
     *                         - fullpage: entire page on screen
     *                         - fullwidth: maximum width of window
     *                         - real: uses real size (100% zoom)
     *                         - default: uses viewer default mode
     *                       or a number indicating the zooming factor.
     * @param string layout  The page layout. Possible values are:
     *                         - single: one page at once
     *                         - continuous: pages in continuously
     *                         - two: two pages on two columns
     *                         - default: uses viewer default mode
     *                       Default value is continuous.
     */
    function setDisplayMode($zoom, $layout = 'continuous')
    {
        $zoom = strtolower($zoom);
        if ($zoom == 'fullpage' || $zoom == 'fullwidth' || $zoom == 'real'
            || $zoom == 'default' || !is_string($zoom)) {
            $this->_zoom_mode = $zoom;
        } elseif ($zoom == 'zoom') {
            $this->_zoom_mode = $layout;
        } else {
            return $this->raiseError(sprintf('Incorrect zoom display mode: %s', $zoom));
        }

        $layout = strtolower($layout);
        if ($layout == 'single' || $layout == 'continuous' || $layout == 'two'
            || $layout == 'default') {
            $this->_layout_mode = $layout;
        } elseif ($zoom != 'zoom') {
            return $this->raiseError(sprintf('Incorrect layout display mode: %s', $layout));
        }
    }

    /**
     * Activates or deactivates page compression.
     *
     * When activated, the internal representation of each page is compressed,
     * which leads to a compression ratio of about 2 for the resulting
     * document. Compression is on by default.
     *
     * Note: the {@link http://www.php.net/zlib/ zlib extension} is required
     * for this feature. If not present, compression will be turned off.
     *
     * @param boolean $compress  Boolean indicating if compression must be
     *                           enabled or not.
     */
    function setCompression($compress)
    {
        /* If no gzcompress function is available then default to false. */
        $this->_compress = (function_exists('gzcompress') ? $compress : false);
    }

    /**
     * Set the info to a document.
     *
     * Possible info settings are:
     *   - title
     *   - subject
     *   - author
     *   - keywords
     *   - creator
     *
     * @param array|string $info  If passed as an array then the complete hash
     *                            containing the info to be inserted into the
     *                            document. Otherwise the name of setting to be
     *                            set.
     * @param string $value       The value of the setting.
     */
    function setInfo($info, $value = '')
    {
        if (is_array($info)) {
            $this->_info = $info;
        } else {
            $this->_info[$info] = $value;
        }
    }

    /**
     * Defines an alias for the total number of pages.
     *
     * It will be substituted as the document is closed.
     *
     * Example:
     * <code>
     * class My_File_PDF extends File_PDF {
     *     function footer()
     *     {
     *         // Go to 1.5 cm from bottom
     *         $this->setY(-15);
     *         // Select Arial italic 8
     *         $this->setFont('Arial', 'I', 8);
     *         // Print current and total page numbers
     *         $this->cell(0, 10, 'Page ' . $this->getPageNo() . '/{nb}', 0,
     *                     0, 'C');
     *     }
     * }
     * $pdf = My_File_PDF::factory();
     * $pdf->aliasNbPages();
     * </code>
     *
     * @param string $alias  The alias.
     *
     * @see getPageNo()
     * @see footer()
     */
    function aliasNbPages($alias = '{nb}')
    {
        $this->_alias_nb_pages = $alias;
    }

    /**
     * This method begins the generation of the PDF document; it must be
     * called before any output commands.
     *
     * No page is created by this method, therefore it is necessary to call
     * {@link addPage()}.
     *
     * @see addPage()
     * @see close()
     */
    function open()
    {
        $this->_beginDoc();
    }

    /**
     * Terminates the PDF document. It is not necessary to call this method
     * explicitly because {@link output()} does it automatically.
     *
     * If the document contains no page, {@link addPage()} is called to
     * prevent from getting an invalid document.
     *
     * @see open()
     * @see output()
     */
    function close()
    {
        /* Terminate document */
        if ($this->_page == 0) {
            $result = $this->addPage();
            if (is_a($result, 'PEAR_Error')) {
                return $result;
            }
        }
        /* Page footer */
        $this->_in_footer = true;
        $this->x = $this->_left_margin;
        $this->footer();
        $this->_in_footer = false;
        /* Close page */
        $this->_endPage();
        /* Close document */
        $this->_endDoc();
    }

    /**
     * Adds a new page to the document.
     *
     * If a page is already present, the {@link footer()} method is called
     * first to output the footer. Then the page is added, the current
     * position set to the top-left corner according to the left and top
     * margins, and {@link header()} is called to display the header.
     *
     * The font which was set before calling is automatically restored. There
     * is no need to call {@link setFont()} again if you want to continue with
     * the same font. The same is true for colors and line width.  The origin
     * of the coordinate system is at the top-left corner and increasing
     * ordinates go downwards.
     *
     * @param string $orientation  Page orientation. Possible values
     *                             are (case insensitive):
     *                               - P or Portrait
     *                               - L or Landscape
     *                             The default value is the one passed to the
     *                             constructor.
     *
     * @see header()
     * @see footer()
     * @see setMargins()
     */
    function addPage($orientation = '')
    {
        /* For good measure make sure this is called. */
        $this->_beginDoc();

        /* Save style settings so that they are not overridden by footer() or
         * header(). */
        $lw = $this->_line_width;
        $dc = $this->_draw_color;
        $fc = $this->_fill_color;
        $tc = $this->_text_color;
        $cf = $this->_color_flag;
        $font_family = $this->_font_family;
        $font_style = $this->_font_style . ($this->_underline ? 'U' : '');
        $font_size  = $this->_font_size_pt;

        /* Close old page. */
        if ($this->_page > 0) {
            /* Page footer. */
            $this->_in_footer = true;
            $this->x = $this->_left_margin;
            $this->footer();
            $this->_in_footer = false;

            /* Close page. */
            $this->_endPage();
        }

        /* Start new page. */
        $this->_beginPage($orientation);
        /* Set line cap style to square. */
        $this->_out('2 J');
        /* Set line width. */
        $this->_line_width = $lw;
        $this->_out(sprintf('%.2' . FILE_PDF_FLOAT . ' w', $lw * $this->_scale));

        /* Force the setting of the font. Each new page requires a new
         * call. */
        if ($font_family) {
            $result = $this->setFont($font_family, $font_style, $font_size, true);
            if (is_a($result, 'PEAR_Error')) {
                return $result;
            }
        }

        /* Restore styles. */
        if ($this->_fill_color != $fc) {
            $this->_fill_color = $fc;
            $this->_out($this->_fill_color);
        }
        if ($this->_draw_color != $dc) {
            $this->_draw_color = $dc;
            $this->_out($this->_draw_color);
        }
        $this->_text_color = $tc;
        $this->_color_flag = $cf;

        /* Page header. */
        $this->header();

        /* Restore styles. */
        if ($this->_line_width != $lw) {
            $this->_line_width = $lw;
            $this->_out(sprintf('%.2' . FILE_PDF_FLOAT . ' w', $lw * $this->_scale));
        }
        $result = $this->setFont($font_family, $font_style, $font_size);
        if (is_a($result, 'PEAR_Error')) {
            return $result;
        }
        if ($this->_fill_color != $fc) {
            $this->_fill_color = $fc;
            $this->_out($this->_fill_color);
        }
        if ($this->_draw_color != $dc) {
            $this->_draw_color = $dc;
            $this->_out($this->_draw_color);
        }
        $this->_text_color = $tc;
        $this->_color_flag = $cf;
    }

    /**
     * This method is used to render the page header.
     *
     * It is automatically called by {@link addPage()} and should not be
     * called directly by the application. The implementation in File_PDF:: is
     * empty, so you have to subclass it and override the method if you want a
     * specific processing.
     *
     * Example:
     * <code>
     * class My_File_PDF extends File_PDF {
     *     function header()
     *     {
     *         // Select Arial bold 15
     *         $this->setFont('Arial', 'B', 15);
     *         // Move to the right
     *         $this->cell(80);
     *         // Framed title
     *         $this->cell(30, 10, 'Title', 1, 0, 'C');
     *         // Line break
     *         $this->newLine(20);
     *     }
     * }
     * </code>
     *
     * @see footer()
     */
    function header()
    {
        /* To be implemented in your own inherited class. */
    }

    /**
     * This method is used to render the page footer.
     *
     * It is automatically called by {@link addPage()} and {@link close()} and
     * should not be called directly by the application. The implementation in
     * File_PDF:: is empty, so you have to subclass it and override the method
     * if you want a specific processing.
     *
     * Example:
     * <code>
     * class My_File_PDF extends File_PDF {
     *    function footer()
     *    {
     *        // Go to 1.5 cm from bottom
     *        $this->setY(-15);
     *        // Select Arial italic 8
     *        $this->setFont('Arial', 'I', 8);
     *        // Print centered page number
     *        $this->cell(0, 10, 'Page ' . $this->getPageNo(), 0, 0, 'C');
     *    }
     * }
     * </code>
     *
     * @see header()
     */
    function footer()
    {
        /* To be implemented in your own inherited class. */
    }

    /**
     * Returns the current page number.
     *
     * @return integer
     *
     * @see aliasNbPages()
     */
    function getPageNo()
    {
        return $this->_page;
    }

    /**
     * Sets the fill color.
     *
     * Depending on the colorspace called, the number of color component
     * parameters required can be either 1, 3 or 4. The method can be called
     * before the first page is created and the color is retained from page to
     * page.
     *
     * @param string $cs  Indicates the colorspace which can be either 'rgb',
     *                    'cmyk' or 'gray'. Defaults to 'rgb'.
     * @param float $c1   First color component, floating point value between 0
     *                    and 1. Required for gray, rgb and cmyk.
     * @param float $c2   Second color component, floating point value
     *                    between 0 and 1. Required for rgb and cmyk.
     * @param float $c3   Third color component, floating point value between 0
     *                    and 1. Required for rgb and cmyk.
     * @param float $c4   Fourth color component, floating point value
     *                    between 0 and 1. Required for cmyk.
     *
     * @see setTextColor()
     * @see setDrawColor()
     * @see rect()
     * @see cell()
     * @see multiCell()
     */
    function setFillColor($cs = 'rgb', $c1, $c2 = 0, $c3 = 0, $c4 = 0)
    {
        $cs = strtolower($cs);
        if ($cs == 'rgb') {
            $this->_fill_color = sprintf('%.3' . FILE_PDF_FLOAT . ' %.3' . FILE_PDF_FLOAT . ' %.3' . FILE_PDF_FLOAT . ' rg', $c1, $c2, $c3);
        } elseif ($cs == 'cmyk') {
            $this->_fill_color = sprintf('%.3' . FILE_PDF_FLOAT . ' %.3' . FILE_PDF_FLOAT . ' %.3' . FILE_PDF_FLOAT . ' %.3' . FILE_PDF_FLOAT . ' k', $c1, $c2, $c3, $c4);
        } else {
            $this->_fill_color = sprintf('%.3' . FILE_PDF_FLOAT . ' g', $c1);
        }
        if ($this->_page > 0) {
            $this->_out($this->_fill_color);
        }
        $this->_color_flag = $this->_fill_color != $this->_text_color;
    }

    /**
     * Sets the text color.
     *
     * Depending on the colorspace called, the number of color component
     * parameters required can be either 1, 3 or 4. The method can be called
     * before the first page is created and the color is retained from page to
     * page.
     *
     * @param string $cs  Indicates the colorspace which can be either 'rgb',
     *                    'cmyk' or 'gray'. Defaults to 'rgb'.
     * @param float $c1   First color component, floating point value between 0
     *                    and 1. Required for gray, rgb and cmyk.
     * @param float $c2   Second color component, floating point value
     *                    between 0 and 1. Required for rgb and cmyk.
     * @param float $c3   Third color component, floating point value between 0
     *                    and 1. Required for rgb and cmyk.
     * @param float $c4   Fourth color component, floating point value
     *                    between 0 and 1. Required for cmyk.
     *
     * @since File_PDF 0.2.0
     * @since Horde 3.2
     * @see setFillColor()
     * @see setDrawColor()
     * @see rect()
     * @see cell()
     * @see multiCell()
     */
    function setTextColor($cs, $c1, $c2 = 0, $c3 = 0, $c4 = 0)
    {
        $cs = strtolower($cs);
        if ($cs == 'rgb') {
            $this->_text_color = sprintf('%.3' . FILE_PDF_FLOAT . ' %.3' . FILE_PDF_FLOAT . ' %.3' . FILE_PDF_FLOAT . ' rg', $c1, $c2, $c3);
        } elseif ($cs == 'cmyk') {
            $this->_text_color = sprintf('%.3' . FILE_PDF_FLOAT . ' %.3' . FILE_PDF_FLOAT . ' %.3' . FILE_PDF_FLOAT . ' %.3' . FILE_PDF_FLOAT . ' k', $c1, $c2, $c3, $c4);
        } else {
            $this->_text_color = sprintf('%.3' . FILE_PDF_FLOAT . ' g', $c1);
        }
        $this->_color_flag = $this->_fill_color != $this->_text_color;
    }

    /**
     * Sets the draw color, used when drawing lines.
     *
     * Depending on the colorspace called, the number of color component
     * parameters required can be either 1, 3 or 4. The method can be called
     * before the first page is created and the color is retained from page to
     * page.
     *
     * @param string $cs  Indicates the colorspace which can be either 'rgb',
     *                    'cmyk' or 'gray'. Defaults to 'rgb'.
     * @param float $c1   First color component, floating point value between 0
     *                    and 1. Required for gray, rgb and cmyk.
     * @param float $c2   Second color component, floating point value
     *                    between 0 and 1. Required for rgb and cmyk.
     * @param float $c3   Third color component, floating point value between 0
     *                    and 1. Required for rgb and cmyk.
     * @param float $c4   Fourth color component, floating point value
     *                    between 0 and 1. Required for cmyk.
     *
     * @see setFillColor()
     * @see line()
     * @see rect()
     * @see cell()
     * @see multiCell()
     */
    function setDrawColor($cs = 'rgb', $c1, $c2 = 0, $c3 = 0, $c4 = 0)
    {
        $cs = strtolower($cs);
        if ($cs == 'rgb') {
            $this->_draw_color = sprintf('%.3' . FILE_PDF_FLOAT . ' %.3' . FILE_PDF_FLOAT . ' %.3' . FILE_PDF_FLOAT . ' RG', $c1, $c2, $c3);
        } elseif ($cs == 'cmyk') {
            $this->_draw_color = sprintf('%.3' . FILE_PDF_FLOAT . ' %.3' . FILE_PDF_FLOAT . ' %.3' . FILE_PDF_FLOAT . ' %.3' . FILE_PDF_FLOAT . ' K', $c1, $c2, $c3, $c4);
        } else {
            $this->_draw_color = sprintf('%.3' . FILE_PDF_FLOAT . ' G', $c1);
        }
        if ($this->_page > 0) {
            $this->_out($this->_draw_color);
        }
    }

    /**
     * Returns the length of a text string. A font must be selected.
     *
     * @param string $text  The text whose length is to be computed.
     * @param boolean $pt   Whether the width should be returned in points or
     *                      user units.
     *
     * @return float
     */
    function getStringWidth($text, $pt = false)
    {
        $text = (string)$text;
        $width = 0;
        $length = strlen($text);
        for ($i = 0; $i < $length; $i++) {
            $width += $this->_current_font['cw'][$text{$i}];
        }

        /* Adjust for word spacing. */
        $width += $this->_word_spacing * substr_count($text, ' ') * $this->_current_font['cw'][' '];

        if ($pt) {
            return $width * $this->_font_size_pt / 1000;
        } else {
            return $width * $this->_font_size / 1000;
        }
    }

    /**
     * Defines the line width.
     *
     * By default, the value equals 0.2 mm. The method can be called before
     * the first page is created and the value is retained from page to page.
     *
     * @param float $width  The width.
     *
     * @see line()
     * @see rect()
     * @see cell()
     * @see multiCell()
     */
    function setLineWidth($width)
    {
        $this->_line_width = $width;
        if ($this->_page > 0) {
            $this->_out(sprintf('%.2' . FILE_PDF_FLOAT . ' w', $width * $this->_scale));
        }
    }

    /**
     * Draws a line between two points.
     *
     * All coordinates can be negative to provide values from the right or
     * bottom edge of the page (since File_PDF 0.2.0, Horde 3.2).
     *
     * @param float $x1  Abscissa of first point.
     * @param float $y1  Ordinate of first point.
     * @param float $x2  Abscissa of second point.
     * @param float $y2  Ordinate of second point.
     *
     * @see setLineWidth()
     * @see setDrawColor()
     */
    function line($x1, $y1, $x2, $y2)
    {
        if ($x1 < 0) {
            $x1 += $this->w;
        }
        if ($y1 < 0) {
            $y1 += $this->h;
        }
        if ($x2 < 0) {
            $x2 += $this->w;
        }
        if ($y2 < 0) {
            $y2 += $this->h;
        }

        $this->_out(sprintf('%.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' m %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' l S', $x1 * $this->_scale, ($this->h - $y1) * $this->_scale, $x2 * $this->_scale, ($this->h - $y2) * $this->_scale));
    }

    /**
     * Outputs a rectangle.
     *
     * It can be drawn (border only), filled (with no border) or both.
     *
     * All coordinates can be negative to provide values from the right or
     * bottom edge of the page (since File_PDF 0.2.0, Horde 3.2).
     *
     * @param float $x       Abscissa of upper-left corner.
     * @param float $y       Ordinate of upper-left corner.
     * @param float $width   Width.
     * @param float $height  Height.
     * @param float $style   Style of rendering. Possible values are:
     *                         - D or empty string: draw (default)
     *                         - F: fill
     *                         - DF or FD: draw and fill
     *
     * @see setLineWidth()
     * @see setDrawColor()
     * @see setFillColor()
     */
    function rect($x, $y, $width, $height, $style = '')
    {
        if ($x < 0) {
            $x += $this->w;
        }
        if ($y < 0) {
            $y += $this->h;
        }

        $style = strtoupper($style);
        if ($style == 'F') {
            $op = 'f';
        } elseif ($style == 'FD' || $style == 'DF') {
            $op = 'B';
        } else {
            $op = 'S';
        }

        $x      = $this->_toPt($x);
        $y      = $this->_toPt($y);
        $width  = $this->_toPt($width);
        $height = $this->_toPt($height);

        $this->_out(sprintf('%.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' re %s', $x, $this->hPt - $y, $width, -$height, $op));
    }

    /**
     * Outputs a circle. It can be drawn (border only), filled (with no
     * border) or both.
     *
     * All coordinates can be negative to provide values from the right or
     * bottom edge of the page (since File_PDF 0.2.0, Horde 3.2).
     *
     * @param float $x       Abscissa of the center of the circle.
     * @param float $y       Ordinate of the center of the circle.
     * @param float $r       Circle radius.
     * @param string $style  Style of rendering. Possible values are:
     *                         - D or empty string: draw (default)
     *                         - F: fill
     *                         - DF or FD: draw and fill
     */
    function circle($x, $y, $r, $style = '')
    {
        if ($x < 0) {
            $x += $this->w;
        }
        if ($y < 0) {
            $y += $this->h;
        }

        $style = strtolower($style);
        if ($style == 'f') {
            $op = 'f';      // Style is fill only.
        } elseif ($style == 'fd' || $style == 'df') {
            $op = 'B';      // Style is fill and stroke.
        } else {
            $op = 'S';      // Style is stroke only.
        }

        $x = $this->_toPt($x);
        $y = $this->_toPt($y);
        $r = $this->_toPt($r);

        /* Invert the y scale. */
        $y = $this->hPt - $y;
        /* Length of the Bezier control. */
        $b = $r * 0.552;

        /* Move from the given origin and set the current point
         * to the start of the first Bezier curve. */
        $c = sprintf('%.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' m', $x - $r, $y);
        $x = $x - $r;
        /* First circle quarter. */
        $c .= sprintf(' %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' c',
                      $x, $y + $b,           // First control point.
                      $x + $r - $b, $y + $r, // Second control point.
                      $x + $r, $y + $r);     // Final point.
        /* Set x/y to the final point. */
        $x = $x + $r;
        $y = $y + $r;
        /* Second circle quarter. */
        $c .= sprintf(' %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' c',
                      $x + $b, $y,
                      $x + $r, $y - $r + $b,
                      $x + $r, $y - $r);
        /* Set x/y to the final point. */
        $x = $x + $r;
        $y = $y - $r;
        /* Third circle quarter. */
        $c .= sprintf(' %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' c',
                      $x, $y - $b,
                      $x - $r + $b, $y - $r,
                      $x - $r, $y - $r);
        /* Set x/y to the final point. */
        $x = $x - $r;
        $y = $y - $r;
        /* Fourth circle quarter. */
        $c .= sprintf(' %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' c %s',
                      $x - $b, $y,
                      $x - $r, $y + $r - $b,
                      $x - $r, $y + $r,
                      $op);
        /* Output the whole string. */
        $this->_out($c);
    }

    /**
     * Imports a TrueType or Type1 font and makes it available. It is
     * necessary to generate a font definition file first with the
     * makefont.php utility.
     * The location of the definition file (and the font file itself when
     * embedding) must be found at the full path name included.
     *
     * Example:
     * <code>
     * $pdf->addFont('Comic', 'I');
     * is equivalent to:
     * $pdf->addFont('Comic', 'I', 'comici.php');
     * </code>
     *
     * @param string $family  Font family. The name can be chosen arbitrarily.
     *                        If it is a standard family name, it will
     *                        override the corresponding font.
     * @param string $style   Font style. Possible values are (case
     *                        insensitive):
     *                          - empty string: regular (default)
     *                          - B: bold
     *                          - I: italic
     *                          - BI or IB: bold italic
     * @param string $file    The font definition file. By default, the name is
     *                        built from the family and style, in lower case
     *                        with no space.
     *
     * @see setFont()
     */
    function addFont($family, $style = '', $file = '')
    {
        $family = strtolower($family);
        if ($family == 'arial') {
            $family = 'helvetica';
        }

        $style = strtoupper($style);
        if ($style == 'IB') {
            $style = 'BI';
        }
        if (isset($this->_fonts[$family . $style])) {
            return $this->raiseError(sprintf('Font already added: %s %s', $family, $style));
        }
        if ($file == '') {
            $file = str_replace(' ', '', $family) . strtolower($style) . '.php';
        }
        include($file);
        if (!isset($name)) {
            return $this->raiseError('Could not include font definition file');
        }
        $i = count($this->_fonts) + 1;
        $this->_fonts[$family . $style] = array('i' => $i, 'type' => $type, 'name' => $name, 'desc' => $desc, 'up' => $up, 'ut' => $ut, 'cw' => $cw, 'enc' => $enc, 'file' => $file);
        if ($diff) {
            /* Search existing encodings. */
            $d = 0;
            $nb = count($this->_diffs);
            for ($i = 1; $i <= $nb; $i++) {
                if ($this->_diffs[$i] == $diff) {
                    $d = $i;
                    break;
                }
            }
            if ($d == 0) {
                $d = $nb + 1;
                $this->_diffs[$d] = $diff;
            }
            $this->_fonts[$family . $style]['diff'] = $d;
        }
        if ($file) {
            if ($type == 'TrueType') {
                $this->_font_files[$file] = array('length1' => $originalsize);
            } else {
                $this->_font_files[$file] = array('length1' => $size1, 'length2' => $size2);
            }
        }
    }

    /**
     * Sets the font used to print character strings.
     *
     * It is mandatory to call this method at least once before printing text
     * or the resulting document would not be valid. The font can be either a
     * standard one or a font added via the {@link addFont()} method. Standard
     * fonts use Windows encoding cp1252 (Western Europe).
     *
     * The method can be called before the first page is created and the font
     * is retained from page to page.
     *
     * If you just wish to change the current font size, it is simpler to call
     * {@link setFontSize()}.
     *
     * @param string $family  Family font. It can be either a name defined by
     *                        {@link addFont()} or one of the standard families
     *                        (case insensitive):
     *                          - Courier (fixed-width)
     *                          - Helvetica or Arial (sans serif)
     *                          - Times (serif)
     *                          - Symbol (symbolic)
     *                          - ZapfDingbats (symbolic)
     *                        It is also possible to pass an empty string. In
     *                        that case, the current family is retained.
     * @param string $style   Font style. Possible values are (case
     *                        insensitive):
     *                          - empty string: regular
     *                          - B: bold
     *                          - I: italic
     *                          - U: underline
     *                        or any combination. Bold and italic styles do not
     *                        apply to Symbol and ZapfDingbats.
     * @param integer $size   Font size in points. The default value is the
     *                        current size. If no size has been specified since
     *                        the beginning of the document, the value taken
     *                        is 12.
     * @param boolean $force  Force the setting of the font. Each new page will
     *                        require a new call to {@link setFont()} and
     *                        settings this to true will make sure that the
     *                        checks for same font calls will be skipped.
     *
     * @see addFont()
     * @see setFontSize()
     * @see cell()
     * @see multiCell()
     * @see write()
     */
    function setFont($family, $style = '', $size = null, $force = false)
    {
        $family = strtolower($family);
        if (empty($family)) {
            $family = $this->_font_family;
        }
        if ($family == 'arial') {
            /* Use helvetica instead of arial. */
            $family = 'helvetica';
        } elseif ($family == 'symbol' || $family == 'zapfdingbats') {
            /* These two fonts do not have styles available. */
            $style = '';
        }

        $style = strtoupper($style);

        /* Underline is handled separately, if specified in the style var
         * remove it from the style and set the underline flag. */
        if (strpos($style, 'U') !== false) {
            $this->_underline = true;
            $style = str_replace('U', '', $style);
        } else {
            $this->_underline = false;
        }

        if ($style == 'IB') {
            $style = 'BI';
        }

        /* If no size specified, use current size. */
        if (is_null($size)) {
            $size = $this->_font_size_pt;
        }

        /* If font requested is already the current font and no force setting
         * of the font is requested (eg. when adding a new page) don't bother
         * with the rest of the function and simply return. */
        if ($this->_font_family == $family && $this->_font_style == $style &&
            $this->_font_size_pt == $size && !$force) {
            return;
        }

        /* Set the font key. */
        $fontkey = $family . $style;

        /* Test if already cached. */
        if (!isset($this->_fonts[$fontkey])) {
            /* Get the character width definition file. */
            $font_widths = File_PDF::_getFontFile($fontkey);
            if (is_a($font_widths, 'PEAR_Error')) {
                return $font_widths;
            }

            $i = count($this->_fonts) + 1;
            $this->_fonts[$fontkey] = array(
                'i'    => $i,
                'type' => 'core',
                'name' => $this->_core_fonts[$fontkey],
                'up'   => -100,
                'ut'   => 50,
                'cw'   => $font_widths[$fontkey]);
        }

        /* Store font information as current font. */
        $this->_font_family  = $family;
        $this->_font_style   = $style;
        $this->_font_size_pt = $size;
        $this->_font_size    = $size / $this->_scale;
        $this->_current_font = &$this->_fonts[$fontkey];

        /* Output font information if at least one page has been defined. */
        if ($this->_page > 0) {
            $this->_out(sprintf('BT /F%d %.2' . FILE_PDF_FLOAT . ' Tf ET', $this->_current_font['i'], $this->_font_size_pt));
        }
    }

    /**
     * Defines the size of the current font.
     *
     * @param float $size  The size (in points).
     *
     * @see setFont()
     */
    function setFontSize($size)
    {
        /* If the font size is already the current font size, just return. */
        if ($this->_font_size_pt == $size) {
            return;
        }
        /* Set the current font size, both in points and scaled to user
         * units. */
        $this->_font_size_pt = $size;
        $this->_font_size = $size / $this->_scale;

        /* Output font information if at least one page has been defined. */
        if ($this->_page > 0) {
            $this->_out(sprintf('BT /F%d %.2' . FILE_PDF_FLOAT . ' Tf ET', $this->_current_font['i'], $this->_font_size_pt));
        }
    }

    /**
     * Defines the style of the current font.
     *
     * @param string $style  The font style.
     *
     * @since File_PDF 0.2.0
     * @since Horde 3.2
     * @see setFont()
     */
    function setFontStyle($style)
    {
        return $this->setFont($this->_font_family, $style);
    }

    /**
     * Creates a new internal link and returns its identifier.
     *
     * An internal link is a clickable area which directs to another place
     * within the document.
     *
     * The identifier can then be passed to {@link cell()}, {@link()} write,
     * {@link image()} or {@link link()}. The destination is defined with
     * {@link setLink()}.
     *
     * @see cell()
     * @see write()
     * @see image()
     * @see link()
     * @see setLink()
     */
    function addLink()
    {
        $n = count($this->_links) + 1;
        $this->_links[$n] = array(0, 0);
        return $n;
    }

    /**
     * Defines the page and position a link points to.
     *
     * @param integer $link  The link identifier returned by {@link addLink()}.
     * @param float $y       Ordinate of target position; -1 indicates the
     *                       current position. The default value is 0 (top of
     *                       page).
     * @param integer $page  Number of target page; -1 indicates the current
     *                       page.
     *
     * @see addLink()
     */
    function setLink($link, $y = 0, $page = -1)
    {
        if ($y == -1) {
            $y = $this->y;
        }
        if ($page == -1) {
            $page = $this->_page;
        }
        $this->_links[$link] = array($page, $y);
    }

    /**
     * Puts a link on a rectangular area of the page.
     *
     * Text or image links are generally put via {@link cell()}, {@link
     * write()} or {@link image()}, but this method can be useful for instance
     * to define a clickable area inside an image.
     *
     * All coordinates can be negative to provide values from the right or
     * bottom edge of the page (since File_PDF 0.2.0, Horde 3.2).
     *
     * @param float $x       Abscissa of the upper-left corner of the
     *                       rectangle.
     * @param float $y       Ordinate of the upper-left corner of the
     *                       rectangle.
     * @param float $width   Width of the rectangle.
     * @param float $height  Height of the rectangle.
     * @param mixed $link    URL or identifier returned by {@link addLink()}.
     *
     * @see addLink()
     * @see cell()
     * @see write()
     * @see image()
     */
    function link($x, $y, $width, $height, $link)
    {
        if ($x < 0) {
            $x += $this->w;
        }
        if ($y < 0) {
            $y += $this->h;
        }

        /* Set up the coordinates with correct scaling in pt. */
        $x      = $this->_toPt($x);
        $y      = $this->hPt - $this->_toPt($y);
        $width  = $this->_toPt($width);
        $height = $this->_toPt($height);

        /* Save link to page links array. */
        $this->_link($x, $y, $width, $height, $link);
    }

    /**
     * Prints a character string.
     *
     * The origin is on the left of the first character, on the baseline. This
     * method allows to place a string precisely on the page, but it is
     * usually easier to use {@link cell()}, {@link multiCell()} or {@link
     * write()} which are the standard methods to print text.
     *
     * All coordinates can be negative to provide values from the right or
     * bottom edge of the page (since File_PDF 0.2.0, Horde 3.2).
     *
     * @param float $x      Abscissa of the origin.
     * @param float $y      Ordinate of the origin.
     * @param string $text  String to print.
     *
     * @see setFont()
     * @see cell()
     * @see multiCell()
     * @see write()
     */
    function text($x, $y, $text)
    {
        if ($x < 0) {
            $x += $this->w;
        }
        if ($y < 0) {
            $y += $this->h;
        }

        /* Scale coordinates into points and set correct Y position. */
        $x = $this->_toPt($x);
        $y = $this->hPt - $this->_toPt($y);

        /* Escape any potentially harmful characters. */
        $text = $this->_escape($text);

        $out = sprintf('BT %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' Td (%s) Tj ET', $x, $y, $text);
        if ($this->_underline && $text != '') {
            $out .= ' ' . $this->_doUnderline($x, $y, $text);
        }
        if ($this->_color_flag) {
            $out = sprintf('q %s %s Q', $this->_text_color, $out);
        }
        $this->_out($out);
    }

    /**
     * Whenever a page break condition is met, the method is called, and the
     * break is issued or not depending on the returned value. The default
     * implementation returns a value according to the mode selected by
     * {@link setAutoPageBreak()}.
     * This method is called automatically and should not be called directly
     * by the application.
     *
     * @return boolean
     *
     * @see setAutoPageBreak()
     */
    function acceptPageBreak()
    {
        return $this->_auto_page_break;
    }

    /**
     * Prints a cell (rectangular area) with optional borders, background
     * color and character string.
     *
     * The upper-left corner of the cell corresponds to the current
     * position. The text can be aligned or centered. After the call, the
     * current position moves to the right or to the next line. It is possible
     * to put a link on the text.  If automatic page breaking is enabled and
     * the cell goes beyond the limit, a page break is done before outputting.
     *
     * @param float $width   Cell width. If 0, the cell extends up to the right
     *                       margin.
     * @param float $height  Cell height.
     * @param string $text   String to print.
     * @param mixed $border  Indicates if borders must be drawn around the
     *                       cell. The value can be either a number:
     *                         - 0: no border (default)
     *                         - 1: frame
     *                       or a string containing some or all of the
     *                       following characters (in any order):
     *                         - L: left
     *                         - T: top
     *                         - R: right
     *                         - B: bottom
     * @param integer $ln    Indicates where the current position should go
     *                       after the call. Possible values are:
     *                         - 0: to the right (default)
     *                         - 1: to the beginning of the next line
     *                         - 2: below
     *                       Putting 1 is equivalent to putting 0 and calling
     *                       {@link newLine()} just after.
     * @param string $align  Allows to center or align the text. Possible
     *                       values are:
     *                         - L or empty string: left (default)
     *                         - C: center
     *                         - R: right
     * @param integer $fill  Indicates if the cell fill type. Possible values
     *                       are:
     *                         - 0: transparent (default)
     *                         - 1: painted
     * @param string $link   URL or identifier returned by {@link addLink()}.
     *
     * @see setFont()
     * @see setDrawColor()
     * @see setFillColor()
     * @see setLineWidth()
     * @see addLink()
     * @see newLine()
     * @see multiCell()
     * @see write()
     * @see setAutoPageBreak()
     */
    function cell($width, $height = 0, $text = '', $border = 0, $ln = 0,
                  $align = '', $fill = 0, $link = '')
    {
        $k = $this->_scale;
        if ($this->y + $height > $this->_page_break_trigger &&
            !$this->_in_footer && $this->acceptPageBreak()) {
            $x = $this->x;
            $ws = $this->_word_spacing;
            if ($ws > 0) {
                $this->_word_spacing = 0;
                $this->_out('0 Tw');
            }
            $result = $this->addPage($this->_current_orientation);
            if (is_a($result, 'PEAR_Error')) {
                return $result;
            }
            $this->x = $x;
            if ($ws > 0) {
                $this->_word_spacing = $ws;
                $this->_out(sprintf('%.3' . FILE_PDF_FLOAT . ' Tw', $ws * $k));
            }
        }
        if ($width == 0) {
            $width = $this->w - $this->_right_margin - $this->x;
        }
        $s = '';
        if ($fill == 1 || $border == 1) {
            if ($fill == 1) {
                $op = ($border == 1) ? 'B' : 'f';
            } else {
                $op = 'S';
            }
            $s = sprintf('%.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' re %s ', $this->x * $k, ($this->h - $this->y) * $k, $width * $k, -$height * $k, $op);
        }
        if (is_string($border)) {
            if (strpos($border, 'L') !== false) {
                $s .= sprintf('%.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' m %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' l S ', $this->x * $k, ($this->h - $this->y) * $k, $this->x * $k, ($this->h - ($this->y + $height)) * $k);
            }
            if (strpos($border, 'T') !== false) {
                $s .= sprintf('%.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' m %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' l S ', $this->x * $k, ($this->h - $this->y) * $k, ($this->x + $width) * $k, ($this->h - $this->y) * $k);
            }
            if (strpos($border, 'R') !== false) {
                $s .= sprintf('%.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' m %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' l S ', ($this->x + $width) * $k, ($this->h - $this->y) * $k, ($this->x + $width) * $k, ($this->h - ($this->y + $height)) * $k);
            }
            if (strpos($border, 'B') !== false) {
                $s .= sprintf('%.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' m %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' l S ', $this->x * $k, ($this->h - ($this->y + $height)) * $k, ($this->x + $width) * $k, ($this->h - ($this->y + $height)) * $k);
            }
        }
        if ($text != '') {
            if ($align == 'R') {
                $dx = $width - $this->_cell_margin - $this->getStringWidth($text);
            } elseif ($align == 'C') {
                $dx = ($width - $this->getStringWidth($text)) / 2;
            } else {
                $dx = $this->_cell_margin;
            }
            if ($this->_color_flag) {
                $s .= 'q ' . $this->_text_color . ' ';
            }
            $text = str_replace(')', '\\)', str_replace('(', '\\(', str_replace('\\', '\\\\', $text)));
            $test2 = ((.5 * $height) + (.3 * $this->_font_size));
            $test1 = $this->fhPt - (($this->y + $test2) * $k);
            $x = ($this->x + $dx) * $k;
            $y = ($this->h - ($this->y + .5 * $height + .3 * $this->_font_size)) * $k;
            $s .= sprintf('BT %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' Td (%s) Tj ET', $x, $y, $text);
            if ($this->_underline) {
                $s .= ' ' . $this->_doUnderline($x, $y, $text);
            }
            if ($this->_color_flag) {
                $s .= ' Q';
            }
            if ($link) {
                $this->link($this->x + $dx, $this->y + .5 * $height- .5 * $this->_font_size, $this->getStringWidth($text), $this->_font_size, $link);
            }
        }
        if ($s) {
            $this->_out($s);
        }
        $this->_last_height = $height;
        if ($ln > 0) {
            /* Go to next line. */
            $this->y += $height;
            if ($ln == 1) {
                $this->x = $this->_left_margin;
            }
        } else {
            $this->x += $width;
        }
    }

    /**
     * This method allows printing text with line breaks.
     *
     * They can be automatic (as soon as the text reaches the right border of
     * the cell) or explicit (via the \n character). As many cells as
     * necessary are output, one below the other. Text can be aligned,
     * centered or justified. The cell block can be framed and the background
     * painted.
     *
     * @param float $width   Width of cells. If 0, they extend up to the right
     *                       margin of the page.
     * @param float $height  Height of cells.
     * @param string $text   String to print.
     * @param mixed $border  Indicates if borders must be drawn around the cell
     *                       block. The value can be either a number:
     *                         - 0: no border (default)
     *                         - 1: frame
     *                       or a string containing some or all of the
     *                       following characters (in any order):
     *                         - L: left
     *                         - T: top
     *                         - R: right
     *                         - B: bottom
     * @param string $align  Sets the text alignment. Possible values are:
     *                         - L: left alignment
     *                         - C: center
     *                         - R: right alignment
     *                         - J: justification (default value)
     * @param integer $fill  Indicates if the cell background must:
     *                         - 0: transparent (default)
     *                         - 1: painted
     *
     * @see setFont()
     * @see setDrawColor()
     * @see setFillColor()
     * @see setLineWidth()
     * @see cell()
     * @see write()
     * @see setAutoPageBreak()
     */
    function multiCell($width, $height, $text, $border = 0, $align = 'J',
                       $fill = 0)
    {
        $cw = &$this->_current_font['cw'];
        if ($width == 0) {
            $width = $this->w - $this->_right_margin - $this->x;
        }
        $wmax = ($width-2 * $this->_cell_margin) * 1000 / $this->_font_size;
        $s = str_replace("\r", '', $text);
        $nb = strlen($s);
        if ($nb > 0 && $s[$nb-1] == "\n") {
            $nb--;
        }
        $b = 0;
        if ($border) {
            if ($border == 1) {
                $border = 'LTRB';
                $b = 'LRT';
                $b2 = 'LR';
            } else {
                $b2 = '';
                if (strpos($border, 'L') !== false) {
                    $b2 .= 'L';
                }
                if (strpos($border, 'R') !== false) {
                    $b2 .= 'R';
                }
                $b = (strpos($border, 'T') !== false) ? $b2 . 'T' : $b2;
            }
        }
        $sep = -1;
        $i   = 0;
        $j   = 0;
        $l   = 0;
        $ns  = 0;
        $nl  = 1;
        while ($i < $nb) {
            /* Get next character. */
            $c = $s[$i];
            if ($c == "\n") {
                /* Explicit line break. */
                if ($this->_word_spacing > 0) {
                    $this->_word_spacing = 0;
                    $this->_out('0 Tw');
                }
                $result = $this->cell($width, $height, substr($s, $j, $i-$j),
                                      $b, 2, $align, $fill);
                if (is_a($result, 'PEAR_Error')) {
                    return $result;
                }
                $i++;
                $sep = -1;
                $j = $i;
                $l = 0;
                $ns = 0;
                $nl++;
                if ($border && $nl == 2) {
                    $b = $b2;
                }
                continue;
            }
            if ($c == ' ') {
                $sep = $i;
                $ls = $l;
                $ns++;
            }
            $l += $cw[$c];
            if ($l > $wmax) {
                /* Automatic line break. */
                if ($sep == -1) {
                    if ($i == $j) {
                        $i++;
                    }
                    if ($this->_word_spacing > 0) {
                        $this->_word_spacing = 0;
                        $this->_out('0 Tw');
                    }
                    $result = $this->cell($width, $height,
                                          substr($s, $j, $i - $j), $b, 2,
                                          $align, $fill);
                    if (is_a($result, 'PEAR_Error')) {
                        return $result;
                    }
                } else {
                    if ($align == 'J') {
                        $this->_word_spacing = ($ns>1)
                            ? ($wmax - $ls) / 1000 * $this->_font_size / ($ns - 1)
                            : 0;
                        $this->_out(sprintf('%.3' . FILE_PDF_FLOAT . ' Tw',
                                            $this->_word_spacing * $this->_scale));
                    }
                    $result = $this->cell($width, $height,
                                          substr($s, $j, $sep - $j),
                                          $b, 2, $align, $fill);
                    if (is_a($result, 'PEAR_Error')) {
                        return $result;
                    }
                    $i = $sep + 1;
                }
                $sep = -1;
                $j = $i;
                $l = 0;
                $ns = 0;
                $nl++;
                if ($border && $nl == 2) {
                    $b = $b2;
                }
            } else {
                $i++;
            }
        }
        /* Last chunk. */
        if ($this->_word_spacing > 0) {
            $this->_word_spacing = 0;
            $this->_out('0 Tw');
        }
        if ($border && strpos($border, 'B') !== false) {
            $b .= 'B';
        }
        $result = $this->cell($width, $height, substr($s, $j, $i), $b, 2,
                              $align, $fill);
        if (is_a($result, 'PEAR_Error')) {
            return $result;
        }
        $this->x = $this->_left_margin;
    }

    /**
     * This method prints text from the current position.
     *
     * When the right margin is reached (or the \n character is met) a line
     * break occurs and text continues from the left margin. Upon method exit,
     * the current position is left just at the end of the text.
     *
     * It is possible to put a link on the text.
     *
     * Example:
     * <code>
     * // Begin with regular font
     * $pdf->setFont('Arial', '', 14);
     * $pdf->write(5, 'Visit ');
     * // Then put a blue underlined link
     * $pdf->setTextColor(0, 0, 255);
     * $pdf->setFont('', 'U');
     * $pdf->write(5, 'www.fpdf.org', 'http://www.fpdf.org');
     * </code>
     *
     * @param float $height  Line height.
     * @param string $text   String to print.
     * @param mixed $link    URL or identifier returned by {@link addLink()}.
     *
     * @see setFont()
     * @see addLink()
     * @see multiCell()
     * @see setAutoPageBreak()
     */
    function write($height, $text, $link = '')
    {
        $cw = &$this->_current_font['cw'];
        $width = $this->w - $this->_right_margin - $this->x;
        $wmax = ($width - 2 * $this->_cell_margin) * 1000 / $this->_font_size;
        $s = str_replace("\r", '', $text);
        $nb = strlen($s);
        $sep = -1;
        $i = 0;
        $j = 0;
        $l = 0;
        $nl = 1;
        while ($i < $nb) {
            /* Get next character. */
            $c = $s{$i};
            if ($c == "\n") {
                /* Explicit line break. */
                $result = $this->cell($width, $height, substr($s, $j, $i - $j),
                                      0, 2, '', 0, $link);
                if (is_a($result, 'PEAR_Error')) {
                    return $result;
                }
                $i++;
                $sep = -1;
                $j = $i;
                $l = 0;
                if ($nl == 1) {
                    $this->x = $this->_left_margin;
                    $width = $this->w - $this->_right_margin - $this->x;
                    $wmax = ($width - 2 * $this->_cell_margin) * 1000 / $this->_font_size;
                }
                $nl++;
                continue;
            }
            if ($c == ' ') {
                $sep = $i;
                $ls = $l;
            }
            $l += (isset($cw[$c]) ? $cw[$c] : 0);
            if ($l > $wmax) {
                /* Automatic line break. */
                if ($sep == -1) {
                    if ($this->x > $this->_left_margin) {
                        /* Move to next line. */
                        $this->x = $this->_left_margin;
                        $this->y += $height;
                        $width = $this->w - $this->_right_margin - $this->x;
                        $wmax = ($width - 2 * $this->_cell_margin) * 1000 / $this->_font_size;
                        $i++;
                        $nl++;
                        continue;
                    }
                    if ($i == $j) {
                        $i++;
                    }
                    $result = $this->cell($width, $height,
                                          substr($s, $j, $i - $j),
                                          0, 2, '', 0, $link);
                    if (is_a($result, 'PEAR_Error')) {
                        return $result;
                    }
                } else {
                    $result = $this->cell($width, $height,
                                          substr($s, $j, $sep - $j),
                                          0, 2, '', 0, $link);
                    if (is_a($result, 'PEAR_Error')) {
                        return $result;
                    }
                    $i = $sep + 1;
                }
                $sep = -1;
                $j = $i;
                $l = 0;
                if ($nl == 1) {
                    $this->x = $this->_left_margin;
                    $width = $this->w - $this->_right_margin - $this->x;
                    $wmax = ($width - 2 * $this->_cell_margin) * 1000 / $this->_font_size;
                }
                $nl++;
            } else {
                $i++;
            }
        }
        /* Last chunk. */
        if ($i != $j) {
            $result = $this->cell($l / 1000 * $this->_font_size, $height,
                                  substr($s, $j, $i), 0, 0, '', 0, $link);
            if (is_a($result, 'PEAR_Error')) {
                return $result;
            }
        }
    }

    /**
     * Writes text at an angle.
     *
     * All coordinates can be negative to provide values from the right or
     * bottom edge of the page (since File_PDF 0.2.0, Horde 3.2).
     *
     * @param integer $x         X coordinate.
     * @param integer $y         Y coordinate.
     * @param string $text       Text to write.
     * @param float $text_angle  Angle to rotate (Eg. 90 = bottom to top).
     * @param float $font_angle  Rotate characters as well as text.
     *
     * @see setFont()
     */
    function writeRotated($x, $y, $text, $text_angle, $font_angle = 0)
    {
        if ($x < 0) {
            $x += $this->w;
        }
        if ($y < 0) {
            $y += $this->h;
        }

        /* Escape text. */
        $text = $this->_escape($text);

        $font_angle += 90 + $text_angle;
        $text_angle *= M_PI / 180;
        $font_angle *= M_PI / 180;

        $text_dx = cos($text_angle);
        $text_dy = sin($text_angle);
        $font_dx = cos($font_angle);
        $font_dy = sin($font_angle);

        $s= sprintf('BT %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' Tm (%s) Tj ET',
                    $text_dx, $text_dy, $font_dx, $font_dy,
                    $x * $this->_scale, ($this->h-$y) * $this->_scale, $text);

        if ($this->_draw_color) {
            $s = 'q ' . $this->_draw_color . ' ' . $s . ' Q';
        }
        $this->_out($s);
    }

    /**
     * Prints an image in the page.
     *
     * The upper-left corner and at least one of the dimensions must be
     * specified; the height or the width can be calculated automatically in
     * order to keep the image proportions. Supported formats are JPEG and
     * PNG.
     *
     * All coordinates can be negative to provide values from the right or
     * bottom edge of the page (since File_PDF 0.2.0, Horde 3.2).
     *
     * For JPEG, all flavors are allowed:
     *   - gray scales
     *   - true colors (24 bits)
     *   - CMYK (32 bits)
     *
     * For PNG, are allowed:
     *   - gray scales on at most 8 bits (256 levels)
     *   - indexed colors
     *   - true colors (24 bits)
     * but are not supported:
     *   - Interlacing
     *   - Alpha channel
     *
     * If a transparent color is defined, it will be taken into account (but
     * will be only interpreted by Acrobat 4 and above).
     * The format can be specified explicitly or inferred from the file
     * extension.
     * It is possible to put a link on the image.
     *
     * Remark: if an image is used several times, only one copy will be
     * embedded in the file.
     *
     * @param string $file   Name of the file containing the image.
     * @param float $x       Abscissa of the upper-left corner.
     * @param float $y       Ordinate of the upper-left corner.
     * @param float $width   Width of the image in the page. If equal to zero,
     *                       it is automatically calculated to keep the
     *                       original proportions.
     * @param float $height  Height of the image in the page. If not specified
     *                       or equal to zero, it is automatically calculated
     *                       to keep the original proportions.
     * @param string $type   Image format. Possible values are (case
     *                       insensitive): JPG, JPEG, PNG. If not specified,
     *                       the type is inferred from the file extension.
     * @param mixed $link    URL or identifier returned by {@link addLink()}.
     *
     * @see addLink()
     */
    function image($file, $x, $y, $width = 0, $height = 0, $type = '',
                   $link = '')
    {
        if ($x < 0) {
            $x += $this->w;
        }
        if ($y < 0) {
            $y += $this->h;
        }

        if (!isset($this->_images[$file])) {
            /* First use of image, get some file info. */
            if ($type == '') {
                $pos = strrpos($file, '.');
                if ($pos === false) {
                    return $this->raiseError(sprintf('Image file has no extension and no type was specified: %s', $file));
                }
                $type = substr($file, $pos + 1);
            }
            $type = strtolower($type);
            $mqr = get_magic_quotes_runtime();
            set_magic_quotes_runtime(0);
            if ($type == 'jpg' || $type == 'jpeg') {
                $info = $this->_parseJPG($file);
            } elseif ($type == 'png') {
                $info = $this->_parsePNG($file);
            } else {
                return $this->raiseError(sprintf('Unsupported image file type: %s', $type));
            }
            if (is_a($info, 'PEAR_Error')) {
                return $info;
            }
            set_magic_quotes_runtime($mqr);
            $info['i'] = count($this->_images) + 1;
            $this->_images[$file] = $info;
        } else {
            $info = $this->_images[$file];
        }

        /* Make sure all vars are converted to pt scale. */
        $x      = $this->_toPt($x);
        $y      = $this->hPt - $this->_toPt($y);
        $width  = $this->_toPt($width);
        $height = $this->_toPt($height);

        /* If not specified do automatic width and height calculations. */
        if (empty($width) && empty($height)) {
            $width = $info['w'];
            $height = $info['h'];
        } elseif (empty($width)) {
            $width = $height * $info['w'] / $info['h'];
        } elseif (empty($height)) {
            $height = $width * $info['h'] / $info['w'];
        }

        $this->_out(sprintf('q %.2' . FILE_PDF_FLOAT . ' 0 0 %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' cm /I%d Do Q', $width, $height, $x, $y - $height, $info['i']));

        /* Set any link if requested. */
        if ($link) {
            $this->_link($x, $y, $width, $height, $link);
        }
    }

    /**
     * Performs a line break.
     *
     * The current abscissa goes back to the left margin and the ordinate
     * increases by the amount passed in parameter.
     *
     * @param float $height  The height of the break. By default, the value
     *                       equals the height of the last printed cell.
     *
     * @see cell()
     */
    function newLine($height = '')
    {
        $this->x = $this->_left_margin;
        if (is_string($height)) {
            $this->y += $this->_last_height;
        } else {
            $this->y += $height;
        }
    }

    /**
     * Returns the abscissa of the current position in user units.
     *
     * @return float
     *
     * @see setX()
     * @see getY()
     * @see setY()
     */
    function getX()
    {
        return $this->x;
    }

    /**
     * Defines the abscissa of the current position.
     *
     * If the passed value is negative, it is relative to the right of the
     * page.
     *
     * @param float $x  The value of the abscissa.
     *
     * @see getX()
     * @see getY()
     * @see setY()
     * @see setXY()
     */
    function setX($x)
    {
        if ($x >= 0) {
            /* Absolute value. */
            $this->x = $x;
        } else {
            /* Negative, so relative to right edge of the page. */
            $this->x = $this->w + $x;
        }
    }

    /**
     * Returns the ordinate of the current position in user units.
     *
     * @return float
     *
     * @see setY()
     * @see getX()
     * @see setX()
     */
    function getY()
    {
        return $this->y;
    }

    /**
     * Defines the ordinate of the current position.
     *
     * If the passed value is negative, it is relative to the bottom of the
     * page.
     *
     * @param float $y  The value of the ordinate.
     *
     * @see getX()
     * @see getY()
     * @see setY()
     * @see setXY()
     */
    function setY($y)
    {
        if ($y >= 0) {
            /* Absolute value. */
            $this->y = $y;
        } else {
            /* Negative, so relative to bottom edge of the page. */
            $this->y = $this->h + $y;
        }
    }

    /**
     * Defines the abscissa and ordinate of the current position.
     *
     * If the passed values are negative, they are relative respectively to
     * the right and bottom of the page.
     *
     * @param float $x  The value of the abscissa.
     * @param float $y  The value of the ordinate.
     *
     * @see setX()
     * @see setY()
     */
    function setXY($x, $y)
    {
        $this->setY($y);
        $this->setX($x);
    }

    /**
     * Returns the current buffer content and resets the buffer.
     *
     * Use this method when creating large files to avoid memory problems.
     * This method doesn't work in combination with the output() or save()
     * methods, use getOutput() at the end. Calling this method doubles the
     * memory usage during the call.
     *
     * @since File_PDF 0.2.0
     * @since Horde 3.2
     * @see getOutput()
     */
    function flush()
    {
        // Make sure we have the file header.
        $this->_beginDoc();

        $buffer = $this->_buffer;
        $this->_buffer = '';
        $this->_flushed = true;
        $this->_buflen += strlen($buffer);

        return $buffer;
    }

    /**
     * Returns the raw PDF file.
     *
     * @see output()
     * @see flush()
     */
    function getOutput()
    {
        /* Check whether file has been closed. */
        if ($this->_state < 3) {
            $result = $this->close();
            if (is_a($result, 'PEAR_Error')) {
                return $result;
            }
        }

        return $this->_buffer;
    }

    /**
     * Sends the buffered data to the browser.
     *
     * @param string $filename  The filename for the output file.
     * @param boolean $inline   True if inline, false if attachment.
     */
    function output($filename = 'unknown.pdf', $inline = false)
    {
        /* Check whether the buffer has been flushed already. */
        if ($this->_flushed) {
            return $this->raiseError('The buffer has been flushed already, don\'t use output() in combination with flush().');
        }

        /* Check whether file has been closed. */
        if ($this->_state < 3) {
            $result = $this->close();
            if (is_a($result, 'PEAR_Error')) {
                return $result;
            }
        }

        /* Check if headers have been sent. */
        if (headers_sent()) {
            return $this->raiseError('Unable to send PDF file, some data has already been output to browser');
        }

        /* If HTTP_Download is not available return a PEAR_Error. */
        if (!include_once 'HTTP/Download.php') {
            return $this->raiseError('Missing PEAR package HTTP_Download');
        }

        /* Params for the output. */
        $disposition = $inline ? HTTP_DOWNLOAD_INLINE : HTTP_DOWNLOAD_ATTACHMENT;
        $params = array('data'               => $this->_buffer,
                        'contenttype'        => 'application/pdf',
                        'contentdisposition' => array($disposition, $filename));
        /* Output the file. */
        return HTTP_Download::staticSend($params);
    }

    /**
     * Saves the PDF file on the filesystem.
     *
     * @param string $filename  The filename for the output file.
     */
    function save($filename = 'unknown.pdf')
    {
        /* Check whether the buffer has been flushed already. */
        if ($this->_flushed) {
            return $this->raiseError('The buffer has been flushed already, don\'t use save() in combination with flush().');
        }

        /* Check whether file has been closed. */
        if ($this->_state < 3) {
            $result = $this->close();
            if (is_a($result, 'PEAR_Error')) {
                return $result;
            }
        }

        $f = fopen($filename, 'wb');
        if (!$f) {
            return $this->raiseError(sprintf('Unable to save PDF file: %s', $filename));
        }
        fwrite($f, $this->_buffer, strlen($this->_buffer));
        fclose($f);
    }

    function _toPt($val)
    {
        return $val * $this->_scale;
    }

    function _getFontFile($fontkey, $path = '')
    {
        static $font_widths = array();

        if (!isset($font_widths[$fontkey])) {
            if (!empty($path)) {
                $file = $path . strtolower($fontkey) . '.php';
            } else {
                $file = dirname(__FILE__) . '/PDF/fonts/' . strtolower($fontkey) . '.php';
            }
            include $file;
            if (!isset($font_widths[$fontkey])) {
                return $this->raiseError(sprintf('Could not include font metric file: %s', $file));
            }
        }

        return $font_widths;
    }

    function _link($x, $y, $width, $height, $link)
    {
        /* Save link to page links array. */
        $this->_page_links[$this->_page][] = array($x, $y, $width, $height, $link);
    }

    function _beginDoc()
    {
        /* Start document, but only if not yet started. */
        if ($this->_state < 1) {
            $this->_state = 1;
            $this->_out('%PDF-1.3');
        }
    }

    function _putPages()
    {
        $nb = $this->_page;
        if (!empty($this->_alias_nb_pages)) {
            /* Replace number of pages. */
            for ($n = 1; $n <= $nb; $n++) {
                $this->_pages[$n] = str_replace($this->_alias_nb_pages, $nb, $this->_pages[$n]);
            }
        }
        if ($this->_default_orientation == 'P') {
            $wPt = $this->fwPt;
            $hPt = $this->fhPt;
        } else {
            $wPt = $this->fhPt;
            $hPt = $this->fwPt;
        }
        $filter = ($this->_compress) ? '/Filter /FlateDecode ' : '';
        for ($n = 1; $n <= $nb; $n++) {
            /* Page */
            $this->_newobj();
            $this->_out('<</Type /Page');
            $this->_out('/Parent 1 0 R');
            if (isset($this->_orientation_changes[$n])) {
                $this->_out(sprintf('/MediaBox [0 0 %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ']', $hPt, $wPt));
            }
            $this->_out('/Resources 2 0 R');
            if (isset($this->_page_links[$n])) {
                /* Links */
                $annots = '/Annots [';
                foreach ($this->_page_links[$n] as $pl) {
                    $rect = sprintf('%.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . '', $pl[0], $pl[1], $pl[0] + $pl[2], $pl[1] - $pl[3]);
                    $annots .= '<</Type /Annot /Subtype /Link /Rect [' . $rect . '] /Border [0 0 0] ';
                    if (is_string($pl[4])) {
                        $annots .= '/A <</S /URI /URI ' . $this->_textString($pl[4]) . '>>>>';
                    } else {
                        $l = $this->_links[$pl[4]];
                        $height = isset($this->_orientation_changes[$l[0]]) ? $wPt : $hPt;
                        $annots .= sprintf('/Dest [%d 0 R /XYZ 0 %.2' . FILE_PDF_FLOAT . ' null]>>', 1 + 2 * $l[0], $height - $l[1] * $this->_scale);
                    }
                }
                $this->_out($annots . ']');
            }
            $this->_out('/Contents ' . ($this->_n + 1) . ' 0 R>>');
            $this->_out('endobj');
            /* Page content */
            $p = ($this->_compress) ? gzcompress($this->_pages[$n]) : $this->_pages[$n];
            $this->_newobj();
            $this->_out('<<' . $filter . '/Length ' . strlen($p) . '>>');
            $this->_putStream($p);
            $this->_out('endobj');
        }
        /* Pages root */
        $this->_offsets[1] = $this->_buflen + strlen($this->_buffer);
        $this->_out('1 0 obj');
        $this->_out('<</Type /Pages');
        $kids = '/Kids [';
        for ($i = 0; $i < $nb; $i++) {
            $kids .= (3 + 2 * $i) . ' 0 R ';
        }
        $this->_out($kids . ']');
        $this->_out('/Count ' . $nb);
        $this->_out(sprintf('/MediaBox [0 0 %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ']', $wPt, $hPt));
        $this->_out('>>');
        $this->_out('endobj');
    }

    function _putFonts()
    {
        $nf = $this->_n;
        foreach ($this->_diffs as $diff) {
            /* Encodings */
            $this->_newobj();
            $this->_out('<</Type /Encoding /BaseEncoding /WinAnsiEncoding /Differences [' . $diff . ']>>');
            $this->_out('endobj');
        }
        $mqr = get_magic_quotes_runtime();
        set_magic_quotes_runtime(0);
        foreach ($this->_font_files as $file => $info) {
            /* Font file embedding. */
            $this->_newobj();
            $this->_font_files[$file]['n'] = $this->_n;
            $size = filesize($file);
            if (!$size) {
                return $this->raiseError('Font file not found');
            }
            $this->_out('<</Length ' . $size);
            if (substr($file, -2) == '.z') {
                $this->_out('/Filter /FlateDecode');
            }
            $this->_out('/Length1 ' . $info['length1']);
            if (isset($info['length2'])) {
                $this->_out('/Length2 ' . $info['length2'] . ' /Length3 0');
            }
            $this->_out('>>');
            $f = fopen($file, 'rb');
            $this->_putStream(fread($f, $size));
            fclose($f);
            $this->_out('endobj');
        }
        set_magic_quotes_runtime($mqr);
        foreach ($this->_fonts as $k => $font) {
            /* Font objects */
            $this->_newobj();
            $this->_fonts[$k]['n'] = $this->_n;
            $name = $font['name'];
            $this->_out('<</Type /Font');
            $this->_out('/BaseFont /' . $name);
            if ($font['type'] == 'core') {
                /* Standard font. */
                $this->_out('/Subtype /Type1');
                if ($name != 'Symbol' && $name != 'ZapfDingbats') {
                    $this->_out('/Encoding /WinAnsiEncoding');
                }
            } else {
                /* Additional font. */
                $this->_out('/Subtype /' . $font['type']);
                $this->_out('/FirstChar 32');
                $this->_out('/LastChar 255');
                $this->_out('/Widths ' . ($this->_n + 1) . ' 0 R');
                $this->_out('/FontDescriptor ' . ($this->_n + 2) . ' 0 R');
                if ($font['enc']) {
                    if (isset($font['diff'])) {
                        $this->_out('/Encoding ' . ($nf + $font['diff']) . ' 0 R');
                    } else {
                        $this->_out('/Encoding /WinAnsiEncoding');
                    }
                }
            }
            $this->_out('>>');
            $this->_out('endobj');
            if ($font['type'] != 'core') {
                /* Widths. */
                $this->_newobj();
                $cw = &$font['cw'];
                $s = '[';
                for ($i = 32; $i <= 255; $i++) {
                    $s .= $cw[chr($i)] . ' ';
                }
                $this->_out($s . ']');
                $this->_out('endobj');
                /* Descriptor. */
                $this->_newobj();
                $s = '<</Type /FontDescriptor /FontName /' . $name;
                foreach ($font['desc'] as $k => $v) {
                    $s .= ' /' . $k . ' ' . $v;
                }
                $file = $font['file'];
                if ($file) {
                    $s .= ' /FontFile' . ($font['type'] == 'Type1' ? '' : '2') . ' ' . $this->_font_files[$file]['n'] . ' 0 R';
                }
                $this->_out($s . '>>');
                $this->_out('endobj');
            }
        }
    }

    function _putImages()
    {
        $filter = ($this->_compress) ? '/Filter /FlateDecode ' : '';
        foreach ($this->_images as $file => $info) {
            $this->_newobj();
            $this->_images[$file]['n'] = $this->_n;
            $this->_out('<</Type /XObject');
            $this->_out('/Subtype /Image');
            $this->_out('/Width ' . $info['w']);
            $this->_out('/Height ' . $info['h']);
            if ($info['cs'] == 'Indexed') {
                $this->_out('/ColorSpace [/Indexed /DeviceRGB ' . (strlen($info['pal'])/3 - 1) . ' ' . ($this->_n + 1) . ' 0 R]');
            } else {
                $this->_out('/ColorSpace /' . $info['cs']);
                if ($info['cs'] == 'DeviceCMYK') {
                    $this->_out('/Decode [1 0 1 0 1 0 1 0]');
                }
            }
            $this->_out('/BitsPerComponent ' . $info['bpc']);
            $this->_out('/Filter /' . $info['f']);
            if (isset($info['parms'])) {
                $this->_out($info['parms']);
            }
            if (isset($info['trns']) && is_array($info['trns'])) {
                $trns = '';
                $i_max = count($info['trns']);
                for ($i = 0; $i < $i_max; $i++) {
                    $trns .= $info['trns'][$i] . ' ' . $info['trns'][$i] . ' ';
                }
                $this->_out('/Mask [' . $trns . ']');
            }
            $this->_out('/Length ' . strlen($info['data']) . '>>');
            $this->_putStream($info['data']);
            $this->_out('endobj');

            /* Palette. */
            if ($info['cs'] == 'Indexed') {
                $this->_newobj();
                $pal = ($this->_compress) ? gzcompress($info['pal']) : $info['pal'];
                $this->_out('<<' . $filter . '/Length ' . strlen($pal) . '>>');
                $this->_putStream($pal);
                $this->_out('endobj');
            }
        }
    }

    function _putResources()
    {
        $this->_putFonts();
        $this->_putImages();
        /* Resource dictionary */
        $this->_offsets[2] = $this->_buflen + strlen($this->_buffer);
        $this->_out('2 0 obj');
        $this->_out('<</ProcSet [/PDF /Text /ImageB /ImageC /ImageI]');
        $this->_out('/Font <<');
        foreach ($this->_fonts as $font) {
            $this->_out('/F' . $font['i'] . ' ' . $font['n'] . ' 0 R');
        }
        $this->_out('>>');
        if (count($this->_images)) {
            $this->_out('/XObject <<');
            foreach ($this->_images as $image) {
                $this->_out('/I' . $image['i'] . ' ' . $image['n'] . ' 0 R');
            }
            $this->_out('>>');
        }
        $this->_out('>>');
        $this->_out('endobj');
    }

    function _putInfo()
    {
        $this->_out('/Producer ' . $this->_textString('Horde PDF'));
        if (!empty($this->_info['title'])) {
            $this->_out('/Title ' . $this->_textString($this->_info['title']));
        }
        if (!empty($this->_info['subject'])) {
            $this->_out('/Subject ' . $this->_textString($this->_info['subject']));
        }
        if (!empty($this->_info['author'])) {
            $this->_out('/Author ' . $this->_textString($this->_info['author']));
        }
        if (!empty($this->keywords)) {
            $this->_out('/Keywords ' . $this->_textString($this->keywords));
        }
        if (!empty($this->creator)) {
            $this->_out('/Creator ' . $this->_textString($this->creator));
        }
        $this->_out('/CreationDate ' . $this->_textString('D:' . date('YmdHis')));
    }

    function _putCatalog()
    {
        $this->_out('/Type /Catalog');
        $this->_out('/Pages 1 0 R');
        if ($this->_zoom_mode == 'fullpage') {
            $this->_out('/OpenAction [3 0 R /Fit]');
        } elseif ($this->_zoom_mode == 'fullwidth') {
            $this->_out('/OpenAction [3 0 R /FitH null]');
        } elseif ($this->_zoom_mode == 'real') {
            $this->_out('/OpenAction [3 0 R /XYZ null null 1]');
        } elseif (!is_string($this->_zoom_mode)) {
            $this->_out('/OpenAction [3 0 R /XYZ null null ' . ($this->_zoom_mode / 100) . ']');
        }
        if ($this->_layout_mode == 'single') {
            $this->_out('/PageLayout /SinglePage');
        } elseif ($this->_layout_mode == 'continuous') {
            $this->_out('/PageLayout /OneColumn');
        } elseif ($this->_layout_mode == 'two') {
            $this->_out('/PageLayout /TwoColumnLeft');
        }
    }

    function _putTrailer()
    {
        $this->_out('/Size ' . ($this->_n + 1));
        $this->_out('/Root ' . $this->_n . ' 0 R');
        $this->_out('/Info ' . ($this->_n - 1) . ' 0 R');
    }

    function _endDoc()
    {
        $this->_putPages();
        $this->_putResources();
        /* Info */
        $this->_newobj();
        $this->_out('<<');
        $this->_putInfo();
        $this->_out('>>');
        $this->_out('endobj');
        /* Catalog */
        $this->_newobj();
        $this->_out('<<');
        $this->_putCatalog();
        $this->_out('>>');
        $this->_out('endobj');
        /* Cross-ref */
        $o = $this->_buflen + strlen($this->_buffer);
        $this->_out('xref');
        $this->_out('0 ' . ($this->_n + 1));
        $this->_out('0000000000 65535 f ');
        for ($i = 1; $i <= $this->_n; $i++) {
            $this->_out(sprintf('%010d 00000 n ', $this->_offsets[$i]));
        }
        /* Trailer */
        $this->_out('trailer');
        $this->_out('<<');
        $this->_putTrailer();
        $this->_out('>>');
        $this->_out('startxref');
        $this->_out($o);
        $this->_out('%%EOF');
        $this->_state = 3;
    }

    function _beginPage($orientation)
    {
        $this->_page++;
        $this->_pages[$this->_page] = '';
        $this->_state = 2;
        $this->x = $this->_left_margin;
        $this->y = $this->_top_margin;
        $this->_last_height = 0;
        /* Page orientation */
        if (!$orientation) {
            $orientation = $this->_default_orientation;
        } else {
            $orientation = strtoupper($orientation[0]);
            if ($orientation != $this->_default_orientation) {
                $this->_orientation_changes[$this->_page] = true;
            }
        }
        if ($orientation != $this->_current_orientation) {
            /* Change orientation */
            if ($orientation == 'P') {
                $this->wPt = $this->fwPt;
                $this->hPt = $this->fhPt;
                $this->w   = $this->fw;
                $this->h   = $this->fh;
            } else {
                $this->wPt = $this->fhPt;
                $this->hPt = $this->fwPt;
                $this->w   = $this->fh;
                $this->h   = $this->fw;
            }
            $this->_page_break_trigger = $this->h - $this->_break_margin;
            $this->_current_orientation = $orientation;
        }
    }

    function _endPage()
    {
        /* End of page contents */
        $this->_state = 1;
    }

    function _newobj()
    {
        /* Begin a new object */
        $this->_n++;
        $this->_offsets[$this->_n] = $this->_buflen + strlen($this->_buffer);
        $this->_out($this->_n . ' 0 obj');
    }

    function _doUnderline($x, $y, $text)
    {
        /* Set the rectangle width according to text width. */
        $width  = $this->getStringWidth($text, true);

        /* Set rectangle position and height, using underline position and
         * thickness settings scaled by the font size. */
        $y = $y + ($this->_current_font['up'] * $this->_font_size_pt / 1000);
        $height = -$this->_current_font['ut'] * $this->_font_size_pt / 1000;

        return sprintf('%.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' re f', $x, $y, $width, $height);
    }

    function _parseJPG($file)
    {
        /* Extract info from a JPEG file. */
        $img = @getimagesize($file);
        if (!$img) {
            return $this->raiseError(sprintf('Missing or incorrect image file: %s', $file));
        }
        if ($img[2] != 2) {
            return $this->raiseError(sprintf('Not a JPEG file: %s', $file));
        }
        if (!isset($img['channels']) || $img['channels'] == 3) {
            $colspace = 'DeviceRGB';
        } elseif ($img['channels'] == 4) {
            $colspace = 'DeviceCMYK';
        } else {
            $colspace = 'DeviceGray';
        }
        $bpc = isset($img['bits']) ? $img['bits'] : 8;

        /* Read whole file. */
        $f = fopen($file, 'rb');
        $data = fread($f, filesize($file));
        fclose($f);

        return array('w' => $img[0], 'h' => $img[1], 'cs' => $colspace, 'bpc' => $bpc, 'f' => 'DCTDecode', 'data' => $data);
    }

    function _parsePNG($file)
    {
        /* Extract info from a PNG file. */
        $f = fopen($file, 'rb');
        if (!$f) {
            return $this->raiseError(sprintf('Unable to open image file: %s', $file));
        }

        /* Check signature. */
        if (fread($f, 8) != chr(137) . 'PNG' . chr(13) . chr(10) . chr(26) . chr(10)) {
            return $this->raiseError(sprintf('Not a PNG file: %s', $file));
        }

        /* Read header chunk. */
        fread($f, 4);
        if (fread($f, 4) != 'IHDR') {
            return $this->raiseError(sprintf('Incorrect PNG file: %s', $file));
        }
        $width = $this->_freadInt($f);
        $height = $this->_freadInt($f);
        $bpc = ord(fread($f, 1));
        if ($bpc > 8) {
            return $this->raiseError(sprintf('16-bit depth not supported: %s', $file));
        }
        $ct = ord(fread($f, 1));
        if ($ct == 0) {
            $colspace = 'DeviceGray';
        } elseif ($ct == 2) {
            $colspace = 'DeviceRGB';
        } elseif ($ct == 3) {
            $colspace = 'Indexed';
        } else {
            return $this->raiseError(sprintf('Alpha channel not supported: %s', $file));
        }
        if (ord(fread($f, 1)) != 0) {
            return $this->raiseError(sprintf('Unknown compression method: %s', $file));
        }
        if (ord(fread($f, 1)) != 0) {
            return $this->raiseError(sprintf('Unknown filter method: %s', $file));
        }
        if (ord(fread($f, 1)) != 0) {
            return $this->raiseError(sprintf('Interlacing not supported: %s', $file));
        }
        fread($f, 4);
        $parms = '/DecodeParms <</Predictor 15 /Colors ' . ($ct == 2 ? 3 : 1) . ' /BitsPerComponent ' . $bpc . ' /Columns ' . $width . '>>';
        /* Scan chunks looking for palette, transparency and image data. */
        $pal = '';
        $trns = '';
        $data = '';
        do {
            $n = $this->_freadInt($f);
            $type = fread($f, 4);
            if ($type == 'PLTE') {
                /* Read palette */
                $pal = fread($f, $n);
                fread($f, 4);
            } elseif ($type == 'tRNS') {
                /* Read transparency info */
                $t = fread($f, $n);
                if ($ct == 0) {
                    $trns = array(ord(substr($t, 1, 1)));
                } elseif ($ct == 2) {
                    $trns = array(ord(substr($t, 1, 1)), ord(substr($t, 3, 1)), ord(substr($t, 5, 1)));
                } else {
                    $pos = strpos($t, chr(0));
                    if (is_int($pos)) {
                        $trns = array($pos);
                    }
                }
                fread($f, 4);
            } elseif ($type == 'IDAT') {
                /* Read image data block */
                $data .= fread($f, $n);
                fread($f, 4);
            } elseif ($type == 'IEND') {
                break;
            } else {
                fread($f, $n + 4);
            }
        } while ($n);

        if ($colspace == 'Indexed' && empty($pal)) {
            return $this->raiseError(sprintf('Missing palette in: %s', $file));
        }
        fclose($f);

        return array('w' => $width, 'h' => $height, 'cs' => $colspace, 'bpc' => $bpc, 'f' => 'FlateDecode', 'parms' => $parms, 'pal' => $pal, 'trns' => $trns, 'data' => $data);
    }

    function _freadInt($f)
    {
        /* Read a 4-byte integer from file. */
        $i  = ord(fread($f, 1)) << 24;
        $i += ord(fread($f, 1)) << 16;
        $i += ord(fread($f, 1)) << 8;
        $i += ord(fread($f, 1));
        return $i;
    }

    function _textString($s)
    {
        /* Format a text string */
        return '(' . $this->_escape($s) . ')';
    }

    function _escape($s)
    {
        /* Add \ before \, ( and ) */
        return str_replace(array('\\', ')', '('),
                           array('\\\\', '\\)', '\\('),
                           $s);
    }

    function _putStream($s)
    {
        $this->_out('stream');
        $this->_out($s);
        $this->_out('endstream');
    }

    function _out($s)
    {
        /* Add a line to the document. */
        if ($this->_state == 2) {
            $this->_pages[$this->_page] .= $s . "\n";
        } else {
            $this->_buffer .= $s . "\n";
        }
    }

}

Youez - 2016 - github.com/yon3zu
LinuXploit