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

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/share/ghostscript/Resource/Init/pdf_main.ps
% Copyright (C) 2001-2019 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
% implied.
%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
%
% Refer to licensing information at http://www.artifex.com or contact
% Artifex Software, Inc.,  1305 Grant Avenue - Suite 200, Novato,
% CA 94945, U.S.A., +1(415)492-9861, for further information.
%

% pdf_main.ps
% PDF file- and page-level operations.

/.setlanguagelevel where { pop 2 .setlanguagelevel } if
.currentglobal //true .setglobal
pdfdict begin
/GS_PDF_ProcSet dup load def	% keep in pdfdict to hide it
userdict /GS_PDF_ProcSet undef

% Patch in an obsolete variable used by some third-party software.
/#? //false def

% Test whether the current output device handles pdfmark.
/.writepdfmarkdict 1 dict dup /pdfmark //null put readonly def
/.writepdfmarks {	% - .writepdfmarks <bool>
  currentdevice //.writepdfmarkdict .getdeviceparams
  mark eq { //false } { pop pop //true } ifelse
  systemdict /DOPDFMARKS known or
} bind executeonly def

% For simplicity, we use a single interpretation dictionary for all
% PDF graphics execution, even though this is too liberal.
/pdfopdict mark
  objopdict { } forall
  drawopdict { } forall
  /endstream { exit } bind executeonly
  (%%EOF) cvn { exit } bind	executeonly	% for filters
  /obj { (   **** Error: Content stream is not terminated by 'endstream'.\n)
         pdfformaterror
         (                Output may be incorrect.\n) pdfformaterror
       } bind executeonly
        % PDF 1.1 operators
  /BX { /BXlevel BXlevel 1 add store } bind executeonly
  /EX { /BXlevel BXlevel 1 sub store } bind executeonly
  /PS { cvx exec } bind executeonly
        % PDF 1.2 operators
  /BMC {
    /BMClevel BMClevel 1 add store
    pop
  } bind executeonly
  /BDC {
    /BMClevel BMClevel 1 add store
    exch /OC eq {
      dup type /nametype eq {
        PDFfile fileposition exch                      % pos /Name
        Page /Properties rget {
          ocg-is-visible not {
            OFFlevels BMClevel dup put
          } if
        } if
        PDFfile exch setfileposition
      } {
        pop
      } ifelse
    } {
      pop
    } ifelse
  } bind executeonly
  /EMC {
    OFFlevels BMClevel
    2 copy known {
       2 copy undef
    } if
    1 sub /BMClevel exch store
    pop
  } bind executeonly
  /MP { pop } bind
  /DP { pop pop } bind
  /- { 0  % Bug 690016
       (   **** Error: Invalid operator '-' is assumed to be the number 0.\n)
       pdfformaterror
       (               Output may be incorrect.\n) pdfformaterror
     } bind executeonly

  /Recursive_XObject_D 1 dict def

.dicttomark readonly def


% This dictionaty encapsulates all that is needed to generate pagelabel pdfmarks.
%
% This is provided by Leon Bottou for the benefit of the djvudigital device
% which is a device developed and maintained outside of Artifex, and which is
% not a contributed device.
%
% This device does not cope with the method used by pdfwrite to pass the pagelabels
% number tree as a 'blob' of data, but requires that the page labels be passed using
% a PAGELABEL pdfmark.
%
% We don't want to do that with pdfwrite because there is no mechanism in pdfmark syntax
% to pass a tree, which means we'd have to laboriously disassemble the pdfmarks for the
% page labels and rebuild a number tree for it. This would mean pattern matching each
% string passed via PAGELABEL to see if it could be defined as a continuation
% of the preceding string, uing prefixes. Its much easier for us just to pass the tree.
%
% Note that this code simply translates the PageLabels Number tree into a number of
% individual PAGELABEL pdfmarks, if used for pdfwrite this would result in a number
% tree which consists solely of leaf nodes, where each node has a string for its label.
% This can be considerably more verbose than the shorthand possible with a Page Label
% dictionary.
%
/pagelabeldict mark
  % (TEXT) .toLower (text)
  /.toLower {
      dup length 1 sub  -1 0 {
          1 index exch 2 copy get 2#00100000 or put
      } for
  } bind executeonly
  % int .cvAlpha (int in alphabetic base 26)
  /.cvAlpha {
      [ exch % construct an array of ASCII values, in reverse
        { % the remainder stays on the top of stack
            dup 0 eq { pop exit } if % quit if the value is zero
            dup 26 mod dup 0 eq { 26 add } if % so that the division is correct
            dup 64 add 3 1 roll sub 26 idiv % save the ASCII value and iterate
        } loop ]
      dup length dup string 3 1 roll
      dup -1 1 { % put the letters in a string
          4 copy sub exch 4 -1 roll 1 sub get put
      } for pop pop
  } bind executeonly
  % int  .cvRoman  (int in capital Roman numerals)
  % convert a positive integer to capital Roman numerals
  % return a decimal string if >= 4000
  /.cvRoman {
      dup 255 string cvs % start with the decimal representation
      exch 4000 lt { % convert only if Roman numerals can represent this
          dup length
          [ [ () (I) (II) (III) (IV) (V) (VI) (VII) (VIII) (IX) ]
            [ () (X) (XX) (XXX) (XL) (L) (LX) (LXX) (LXXX) (XC) ]
            [ () (C) (CC) (CCC) (CD) (D) (DC) (DCC) (DCCC) (CM) ]
            [ () (M) (MM) (MMM) ] ] % Roman equivalents
          () % append the Roman equivalent of each decimal digit to this string
          2 index  -1 1 {
              2 index 1 index 1 sub get
              5 index 5 index 4 -1 roll sub get
              48 sub get concatstrings
          } for
          4 1 roll pop pop pop
      } if
  } bind executeonly
  % style printers
  /PageStyle <<
    /D { 255 string cvs } bind executeonly
    /R { .cvRoman } executeonly
    /r { .cvRoman .toLower } executeonly
    /A { .cvAlpha } executeonly
    /a { .cvAlpha .toLower } executeonly >>
  % check whether we want to generate pdfmarks
  /wantpagelabelmarks {
      % WantsPageLabels means that pagelabels will be passed
      % using .pdfpagelabels and not using pdfmarks
    /WantsPageLabels /GetDeviceParam .special_op
    {pop pop //false}{//true} ifelse

    %% This is truly ugly.....
    %% GSView 5 redefines pdfmark and processes it itself. However if it gets
    %% a pdfmark it cannot cope with, it simply fails. Its not prepared to cope
    %% with PAGELABEL pdfmarks, so we don't want to send it to them. There's no
    %% way for us to fix GSView 5, its long out of any kind of support, but we do
    %% try not to break it. We happen to know that GSView 5 installs a GSview
    %% dictionary in userdict, so this test simply ensures we don't emit PAGELABEL
    %% pdfmarks if that dictioanry is present.
    userdict /GSview known {pop //false} if
  } bind executeonly
  % generate pagelabel pdfmark
  /dopagelabel {  % -- dopagelabel --
      << /S //null /P () /O 0 >> begin
      wantpagelabelmarks {
          Trailer /Root knownoget {
              oforce /PageLabels knownoget {
                  oforce Page# 1 sub
                  numogetle
                  { oforce
                    dup /S knownoget not { //false } if /S exch def
                    dup /P knownoget not { 0 string } if /P exch def
                    /St knownoget not { 1 } if exch sub /O exch def
                  } if
                  P Page# 1 sub O add PageStyle S knownoget { exec concatstrings } if
                  mark /Label 3 -1 roll /PAGELABEL pdfmark
              } if
          } if
      } if
      end
  } bind executeonly
.dicttomark readonly def

% ======================== Main program ======================== %

end			% pdfdict
userdict begin

/defaultfontname /Times-Roman def

% Make sure the registered encodings are loaded, so we don't run the risk
% that some of the indices for their names will overflow the packed
% representation.  (Yes, this is a hack.)
SymbolEncoding pop
DingbatsEncoding pop

% Redefine 'run' so it recognizes PDF files.
systemdict begin
/.runps /run load def
/run {
  dup type /filetype ne { (r) file } if
  % skip leading whitespace characters (actually anything less than or equal to <sp>)
  { dup ( ) .peekstring not { //false exit } if
    dup 0 get 32 le { pop dup read pop pop } { //true exit } ifelse
  } loop
  exch pop
  {
    % Appletalk PAP sends short strings with %! header expecting a response.
    % 'gv' swallows the %!PS line, then sends DSC comments beginning with %%
    % and also waits for a response. The following avoids those hangs.
    dup 2 string .peekstring pop dup (%!) eq exch (%%) eq or {
      cvx .runps
    } {
      dup 1023 string .peekstring pop
      % "1024 string" exceeds current %stdin buffer
      % Valid PDF file cannot be smaller than 400 bytes.
      (%PDF-) search {
        3 1 roll pop pop
        dup (%!PS) search not {
          length 0 ne {
            1 index exch readstring pop pop
            (%stderr) (w) file dup
            (   **** Warning: File has some garbage before %PDF- .\n)
            writestring flushfile
          } {
            pop
          } ifelse
          dup (%stdin) (r) file eq {
            % Copy PDF from stdin to temporary file then run it.
            //null (w+) /.tempfile .systemvar exec exch 3 1 roll
            % stack: tempname stdin tempfile
            64000 string
            {
              % stack: tempname stdin tempfile string
              2 index 1 index readstring
              exch 3 index exch writestring
              not { exit } if
            }
            loop
            pop exch closefile
            % stack: tempname tempfile
            dup 0 setfileposition
            dup
              runpdf
            closefile deletefile
          } {
              runpdf
          } ifelse
        } {
          pop pop pop pop cvx .runps % (%!PS) found first
        } ifelse
      } {
        pop cvx .runps % (%PDF-) not found
      } ifelse
    } ifelse
  } {
    closefile % file was empty
  } ifelse
} bind odef
currentdict /runpdfstring .undef

/runpdfbegin {		% <file> runpdfbegin -
   userdict begin
        % It turns out that the PDF interpreter uses memory more
        % effectively if it is run under at least one level of save.
        % This is counter-intuitive, and we don't understand why it happens,
        % but the improvement is significant.
   /PDFTopSave save def
   <</ProcessDSCComment //null>> setuserparams
   <</ProcessComment //null>> setuserparams
   %% Bug #696487, allow dict stack to grow without limit, as these PDF
   %% files have stupidly deep gsave nesting and we need a dictionary per gsave
   %% at the moment.
   %% Remove ths if bug #696511 is ever completed (move ExtGstate parameters into gstate)
   <</MaxDictStack -1>> setuserparams
   %% Bug #696567, same customer as above. Ths time they have a file with a page whch has
   %% 447000 ExtGState references (all of hwch contain no gstate!) Because we allocate
   %% these on the stack, allow the stack to grow indefinitely in order to accomodate
   %% such stupid files. Also move these lines from the end of the routine, so that
   %% the increases are in place before we call odfopen, which will build the
   %% resources and needs this definition in place.
   <</MaxOpStack -1>> setuserparams

   0 setobjectformat
   /Page# //null def
   /Page //null def
   /DSCPageCount 0 def
   /PDFSave //null def
   //pdfdict /GS_PDF_ProcSet get begin
   //pdfdict begin
   pdfopen begin
   /CumulativePageCount currentpagedevice /PageCount get def
} bind executeonly def

/runpdfpagerange {	% - runpdfpagerange <firstpage#> <lastpage#>
<</DisablePageHandler //true>> setpagedevice
   /PortfolioPage where {
     pop
     PortfolioPage cvi dup pdfpagecount add                  % a b+1
     /PortfolioPage dup load                                 % a b+1 /P ()
     (          ) 1 index  copy pop
     dup 3 index exch cvs pop                                % a b+1 /P (b+1)
     store
     1 sub                                                   % a b
     /FirstPage where { pop FirstPage <</DisablePageHandler //true>> setpagedevice} { 1 } ifelse
     /LastPage  where { pop LastPage  <</DisablePageHandler //true>> setpagedevice} {2000000000} ifelse  % a b fp lp
     2 index 2 index lt { % b < fp
       1e10
     } {
       3 index 2 index gt { % a > fp
         1
       } {
         1 index 4 index sub 1 add
       } ifelse
     } ifelse                                                % a b fp lp f
     3 index 2 index lt { % b < bp
       3 index 5 index sub 1 add  % b-a+1=count
     } {
       4 index 2 index gt {
         0
       } {
         1 index 5 index sub 1 add
       } ifelse
     } ifelse                                                % a b fp lp f l
     6 2 roll pop pop pop pop

     QUIET not {
       1 index 1 index gt {
         (Skipping the subfile.) = flush
       } {
           (Processing pages ) print 1 index =only ( through ) print dup =only
           (.) = flush
       } ifelse
     } if
   } {
     /PageList where {
       pop PageList
       (even) anchorsearch {
         pop length 0 gt {
           /runpdfpagerange /syntaxerror cvx signalerror
         } if
           /PDFPageList pdfpagecount 1 add array def
           2 2 pdfpagecount {
             PDFPageList exch 1 put
           } for
           1 pdfpagecount
           QUIET not {
             (Processing even-numbered pages\n) print
             (.) = flush
           } if
       } {
         (odd) anchorsearch {
           pop length 0 gt {
             /runpdfpagerange /syntaxerror cvx signalerror
           } if
           /PDFPageList pdfpagecount 1 add array def
           1 2 pdfpagecount {
             PDFPageList exch 1 put
           } for
           1 pdfpagecount
           QUIET not {
             (Processing odd-numbered pages\n) print 1 index =only ( through ) print dup =only
             (.) = flush
           } if
         } {
           %% validate string contents, check for digit comma or minus
           dup
           {
             dup 44 eq not {
               dup 45 eq not {
                 dup 48 lt 1 index 57 gt or {
                   /runpdfpagerange /syntaxerror cvx signalerror
                 } if
               } if
             } if
             pop
           }
           forall
           <</DisablePageHandler //true>> setpagedevice
           /PDFPageList pdfpagecount 1 add array def
           {
             (,) search {
               %% We now have (post) (,) (pre)
               exch pop %% get rid of the (,), leave the (post) as the string for the next iteration, deal with the section up to the comma
               (-) search {
                 %% Now we have (end) (-) (start)
                 exch pop %% get rid of the minus (end) (start)
                 0 exch {48 sub exch 10 mul add} forall
                 %% Make sure the start of the range is inside the number of available pages
                 dup pdfpagecount le {
                   exch
                   %% deal with a trailing '-' by replacing it with the number of pages in the file
                   dup length 0 eq {
                     pop pdfpagecount
                   }{
                     0 exch {48 sub exch 10 mul add} forall
                   } ifelse
                   1 exch %% start 1 end
                   %% Make sure the end of the range is inside the number of available pages
                   dup pdfpagecount gt {pop pdfpagecount} if
                   {PDFPageList exch 1 put} for
                 } {
                   %% start of range invalid, drop this range.
                   pop pop
                 }ifelse
               }{
                 %% no minus signs, must be a simple page number
                 0 exch {48 sub exch 10 mul add} forall
                 %% ensure its in the valid range of pages
                 dup pdfpagecount le {
                    PDFPageList exch 1 put
                 } {
                   pop
                 } ifelse
               } ifelse
             }{
               %% no commas separating pages, just the original string (), deal with its as a section, then exit the loop
               (-) search {
                 %% Now we have (end) (-) (start)
                 exch pop %% get rid of the minus (end) (start)
                 0 exch {48 sub exch 10 mul add} forall
                 %% Make sure the start of the range is inside the number of available pages
                 dup pdfpagecount le {
                   exch
                   %% deal with a trailing '-' by replacing it with the number of pages in the file
                   dup length 0 eq {
                     pop pdfpagecount
                   }{
                     0 exch {48 sub exch 10 mul add} forall
                   } ifelse
                   1 exch %% start 1 end
                   %% Make sure the end of the range is inside the number of available pages
                   dup pdfpagecount gt {pop pdfpagecount} if
                   {PDFPageList exch 1 put} for
                 } {
                   %% start of range invalid, drop this range.
                   pop pop
                 }ifelse
               }{
                 %% no minus signs, must be a simple page number
                 0 exch {48 sub exch 10 mul add} forall
                 %% ensure its in the valid range of pages
                 dup pdfpagecount le {
                    PDFPageList exch 1 put
                 } {
                   pop
                 } ifelse
               } ifelse
               exit %% done all the sections.
             } ifelse
           } loop
           QUIET not {
             (Processing pages ) print PageList =only
             (.) = flush
           } if
         } ifelse
       } ifelse
       1 pdfpagecount
     }{
       /FirstPage where {
         <</DisablePageHandler //true>> setpagedevice
         pop FirstPage dup pdfpagecount gt {
           (\nRequested FirstPage is greater than the number of pages in the file: ) print
            pdfpagecount = flush
         } if
       } {
          1
       } ifelse
       /LastPage where {<</DisablePageHandler //true>> setpagedevice pop LastPage pdfpagecount .min } { pdfpagecount } ifelse
       1 index 1 index gt {
         (   No pages will be processed \(FirstPage > LastPage\).) = flush
       } {
         QUIET not {
           (Processing pages ) print 1 index =only ( through ) print dup =only
           (.) = flush
         } if
       } ifelse
     } ifelse
   }ifelse
} bind executeonly def

/dopdfpages {   % firstpage# lastpage# dopdfpages -
  << /PDFScanRules //true >> setuserparams	% set scanning rules for PDF vs. PS
  << /RenderTTNotdef systemdict
     /RENDERTTNOTDEF get >> setuserparams	% Should we render TT /.notdef
  1 exch
    {
      %% If we have a array of pages to render, use it.
      /PDFPageList where {
        pop dup PDFPageList exch get 1 eq
      }
      {//true} ifelse

      {
        dup /Page# exch store
        QUIET not { (Page ) print dup //== exec flush } if
        pdfgetpage pdfshowpage
      }{
        pop
      }ifelse
    } for
  % Indicate that the number of spot colors is unknown in case the next page
  % imaged is a PS file.
  currentpagedevice /PageSpotColors known { << /PageSpotColors -1 >> setpagedevice } if
  << /PDFScanRules //null >> setuserparams	% restore scanning rules for PS
} bind executeonly def

/runpdfend {
   RepairedAnError
   {
     printrepairederror
   } {
     Repaired { printrepaired } if
   } ifelse
   currentdict pdfclose
   end			% temporary dict
   end			% pdfdict
   end			% GS_PDF_ProcSet
   PDFTopSave restore
   end			% userdict
   2 vmreclaim		% couldn't hurt
} bind executeonly def

% Copy stream to an external temporary file and
% return the file name as PS name.
/copy_embedded_file {
  //true resolvestream      % strm
  dup 1023 string .peekstring pop % "1024 string" exceeds current %stdin buffer
  dup length 400 ge {             % Valid PDF file cannot be smaller than 400 bytes.
     (%PDF-) search {
       pop pop pop //true
     } {
       pop //false
     } ifelse
   } {
     pop //false
   } ifelse {
    //null (w) /.tempfile   % strm (name) null (w) /.tempfile
    .systemvar exec         % strm (name) file
    3 -1 roll               % (name) file strm
    32768 string            % (name) file strm (buf)
    { 3 copy readstring     % (name) file strm (buf) file (data) bool
      3 1 roll              % (name) file strm (buf) bool file (data)
      writestring           % (name) file strm (buf) bool
      not { exit } if
    } loop
    pop closefile           % (name) file
    closefile               % (name)
    cvn                     % /name
  } {
    closefile
  } ifelse
} bind executeonly def

% Recursively enumerate /Names entries
% <node> pdf_collection_names /temp_file_name ...
/pdf_collection_names {
  dup /Names knownoget {
    exch pop
    { oforce
      dup type /dicttype eq {
        /EF knownoget {
          /F knownoget {
            copy_embedded_file
          } if
        } if
      } {
        pop
      } ifelse
    } forall
  } {
    /Kids knownoget {
      { oforce
        dup //null ne {
          pdf_collection_names
        } {
          pop
        } ifelse
      } forall
    } if
  } ifelse
} bind executeonly def

% Copy selected subfiles to temporary files and return the file names
% as a PostScript names to protect them from restore.
% Currently, all PDF files in the Portfolio are extracted and returned.
%
% - pdf_collection_files [ /temp_file_name ... /temp_file_name
/pdf_collection_files {
  mark
  Trailer /Root knownoget {
    dup /Collection oknown {
      /Names knownoget {
        /EmbeddedFiles knownoget {
          pdf_collection_names
        } if
      } if
    } {
      pop
    } ifelse
  } if
} bind executeonly def

/runpdf {		% <file> runpdf -
  %% Get the PDF filename (it *must* be a file even if it came from stdin it gets
  %% copied to a temporary file) and store it in pdfdict. We will use this for
  %% hashing fonts to detect if fonts with the same name are from different files.
  %%
  dup currentglobal exch //true setglobal .getfilename exch setglobal /InputPDFFileName exch //pdfdict 3 1 roll .forceput

  //runpdfbegin exec
  //pdf_collection_files exec
  dup mark eq {
    pop
    process_trailer_attrs
    //runpdfpagerange exec
    //dopdfpages exec
    //runpdfend exec
  } {
    //runpdfend exec
    ]
    (1         ) 10 string copy exch
    {
        dup type /filetype eq {
          //runpdfbegin exec
          dup /PortfolioPage exch def
          process_trailer_attrs
          //runpdfpagerange exec
          //dopdfpages exec
          //runpdfend exec
          closefile
        } {
          .namestring dup (r) file
          //runpdfbegin exec
          /PortfolioPage 2 index def
          process_trailer_attrs
          //runpdfpagerange exec
          //dopdfpages exec
          //runpdfend exec
          deletefile
        } ifelse
    } forall
    pop
  } ifelse
} bind executeonly odef

currentdict /pdf_collection_files .undef

end			% systemdict
% Redefine the procedure that the C code uses for running piped input.
% It is OK to use { (%stdin) run } here, because a startjob cannot occur.
/.runstdin {
  { (%stdin) run } execute0
} bind executeonly def

end			% userdict
pdfdict begin

% ======================== File parsing ======================== %

% Read the cross-reference and trailer sections.

% I believe the definitions here are only used when parsing the trailer
% dictionary and cross-reference table. So, following on from bug 697351
% we will validate the operands to /R here, because the trailer and xref
% are comparatively small. Note that the bug does not expose a problem
% here, but we probably ought to validate the operands. Of course, if
% they are invalid, the PDF file is probably unreadable anyway.

/traileropdict mark
  (<<) cvn { /dictlevelcount dictlevelcount 1 add store mark } bind executeonly
  (>>) cvn { { .dicttomark } stopped {
              (   **** Warning: File has unbalanced >> in trailer.\n) pdfformatwarning
             } if
             /dictlevelcount dictlevelcount 1 sub def
             dictlevelcount 0 eq { exit } if
           } bind executeonly
  ([) cvn { mark } bind executeonly		% ditto
  (]) cvn dup load
%  /true true		% see .pdfexectoken in pdf_base.ps
%  /false false		% ibid.
%  /null null		% ibid.
  /R {
  1 index type /integertype eq 1 index type /integertype eq and {
    /resolveR cvx 3 packedarray cvx
  } {
    (   **** Error: indirect object reference \(R\) encountered with invalid arguments.) pdfformaterror
    (               Output may be incorrect.\n) pdfformaterror
  } ifelse
  } bind executeonly	% see Objects below
.dicttomark readonly def

% After reading entry count: skip whitespace, exit on a digit
% (presumably the object offset, otherwise throw /syntaxerror
/xref-char-dict <<
   0  {}        % \000
   9  1 index   % \t
  10  1 index   % \r
  12  1 index   % \f
  13  1 index   % \n
  32  1 index   % ' '

  48  { exit } bind % '0'
  49  1 index   % '1'
  50  1 index   % '2'
  51  1 index   % '3'
  52  1 index   % '4'
  53  1 index   % '5'
  54  1 index   % '6'
  55  1 index   % '7'
  56  1 index   % '8'
  57  1 index   % '9'
 116  {         % 't'railer
        PDFfile 7 string .peekstring not { () } if
        dup /trailer eq {
          % Empty xref section
          pop exit
        } {
          (   **** Warning: Invalid string \() exch concatstrings
          (\) follows xref section header.\n) concatstrings
          pdfformatwarning
          /setxrefentry cvx /syntaxerror signalerror
        } ifelse
      } bind
>> readonly def

 %  Read original version (pre PDF 1.5) of the xref table.
 %  Note:  The position is the location of 'xref'.  The current PDFfile
 %  position is just after the 'XREF'.
/readorigxref		% <pos> readorigxref <trailerdict>
 {
   pop				% We do not need the position.

   % First we search this (and any Previous) trailers, looking for
   % the /Size of the xref. We use ths to initialise our storage
   % of xref and similar objects. This avoids us havign to continually
   % resize these objescts which is very wasteful, and leads to us
   % spending much time in memory amanagement.
   % Bug #696454
   PDFfile fileposition
   /dictlevelcount 0 def
   /TrailerSizeError //false def
   /TrailerSize 0 def

   {
     % Throw away the 'xref' data up to the trailer dictionary
     PDFfile 0 (trailer) /SubFileDecode filter flushfile
     % Now read the trailer dictionary
     PDFfile traileropdict .pdfrun

     dup /Size known {
       % If we have a /Size then use it and exit this loop
       /Size get /TrailerSize exch def
       exit
     }{
       dup /Prev known {
         % We don't have a Size, but we have a Previous, set up to read it.
         /Prev get PDFfile exch setfileposition
       }{
         % No size and no Prev with a Size. Fall back to resizing the xref as we go.
         pop
         (*** Warning: No trailer dictionary with a Size detected, xref processing will be dynamic and slower) pdfformatwarning
         /TrailerDict 0 def
         exit
       } ifelse
     }ifelse
   }loop

   % Initialise the objects with the detected Size.
   TrailerSize growPDFobjects
   PDFfile exch setfileposition
   0				% Initialize xref table error counter
   //false            % Have we seen at least one section entry in this xref ? Bug #694342
   { PDFfile token pop		% first object # or trailer
     dup /trailer eq {
         %% check to see if we have seen at least an empty section for this xref
        pop {exit}
        {
            %% we have not seen any section entries in an xref, not even an empty section (xref 0 0)
            %% Bug 694342, treat this as an error and rebuild the xref.
            /setxrefentry cvx /syntaxerror signalerror
        } ifelse
     }
     {
     %% remove the boolean telling us if we have a section or not, leaving the first object number
     exch pop
     } ifelse
     PDFfile token pop		% entry count

     % remaining must be whitespace only (otherwise this xref Size was invalid.
     { PDFfile (0) .peekstring not { pop exit } if
       0 get //xref-char-dict exch .knownget {
         exec
       } {
         (   **** Warning: xref subsection header has extra characters.\n)
         pdfformatwarning
         /setxrefentry cvx /syntaxerror signalerror
       } ifelse
       PDFfile read { pop } { exit } ifelse
     } loop
                % This section might be adding new objects:
                % ensure that Objects and Generations are big enough.
                % stack: <err count> <first obj> <entry count>
     2 copy add
     TrailerSize gt {
       TrailerSizeError not {
         /TrailerSizeError //true def
         PDFSTOPONERROR not {
           (**** Warning: Discovered more entries in xref than declared in trailer /Size\n) pdfformatwarning
         } {
           /readorigxref cvx /rangecheckerror signalerror
         } ifelse
       } if
       % We now know that the /Size was wrong. We could read the whole table
       % resizing on every section, but if there are a lot of sections we
       % end up spending lots of time in memory management (Bug #696454) so
       % instead add 64k to the first object number in the section. This will
       % waste some memory, but is faster in ths case.
       1 index 65534 add dup /TrailerSize exch def
       growPDFobjects
     } if
     {				% stack: <err count> <obj num>
                % Read xref line
       PDFfile 20 string readstring pop  % always read 20 chars.
       token pop		% object position
       exch token pop		% generation #
       exch token pop		% n or f
       exch			% stack: <err count> <obj#> <loc> <gen#> <tag> <remainder of line>
       % check to make sure trailing garbage is just white space
       //false 1 index { 32 gt or } forall {
         6 -1 roll 1 add 6 1 roll  % bump error count on garbage
         dup (\n) search {
           exch pop exch pop
         } {
           (\r) search {
             exch pop exch pop
           } if
         } ifelse
         length
         PDFfile fileposition exch sub PDFfile exch setfileposition
       } if
       pop			% Stack: <err count> <obj#> <loc> <gen#> <tag>
       dup /n eq {		% xref line tag is /n
         pop			% pop dup of line tag
         1 index 0 eq {
           (   **** Warning: considering '0000000000 XXXXX n' as a free entry.\n)
           pdfformatwarning
         } {
           0 3 1 roll		% Set ObjectStream object number = 0
           //false setxrefentry	% Save xref entry, don't change existing entries
           3 -1 roll pop	% Remove ObjectStream object onumber
         } ifelse
       }
       {			% xref line tag was not /n
         /f ne			% verify that the tag was /f
         { /setxrefentry cvx /syntaxerror signalerror
         } if
       } ifelse
       pop pop			% pop <obj location> and <gen num>
       % stack: <err count> <obj num>
       1 add			% increment object number
     } repeat
     pop			% pop <obj #>
     //true           % We have seen at least one entry in an xref section Bug #694342
   } loop
   0 ne {
     (   **** Warning:  length of some xref entries is not equal to 20 bytes.\n)
     pdfformatwarning
   } if
   PDFfile traileropdict .pdfrun
 } bind executeonly def

currentdict /xref-char-dict undef

 % This dicitonary is used to read the xref dictionary.  It should work for
 % reading any dictionary.  dictlevelcount must contain 0.
/xrefopdict mark
  (<<) cvn { /dictlevelcount dictlevelcount 1 add def mark } bind executeonly
  (>>) cvn { .dicttomark /dictlevelcount dictlevelcount 1 sub def
             dictlevelcount 0 eq { exit} if } bind executeonly
  ([) cvn { mark } bind	executeonly	% ditto
  (]) cvn dup load
%  /true true		% see .pdfexectoken in pdf_base.ps
%  /false false		% ibid.
%  /null null		% ibid.
  /R { /resolveR cvx 3 packedarray cvx } bind executeonly	% see Objects below
.dicttomark readonly def

% Get a variable length positive integer value from a stream.  A value
% of zero is returned if the count is zero.
/getintn {	% <stream> <count> getintn int
  0 exch { 256 mul 1 index read pop add } repeat
  exch pop			% Discard stream
} bind executeonly def

% This array contains handlers for processing the different types of
% entries in the XRef stream.
% Stack: <Xrefdict> <xref stream> <Index array> <pair loc> <obj num>
% 	 <field 2> <field 3>
% The handlers leave the stack unchanged.
/xref15entryhandlers [
  {	% XRef entry type 0 - free or f type xref entry
%    (free ) print
%    (obj num: ) print 2 index pdfstring cvs print ( ) print
%    (loc: ) print 1 index pdfstring cvs print ( ) print
%    (gen: ) print dup === flush
  } bind executeonly		% Do nothing for free xref entries
        % XRef entry type 1 - normal or n type xref entry
  {	% field 2 = obj loc, field 3 = gen num
%    (normal ) print
%    (obj num: ) print 2 index pdfstring cvs print ( ) print
%    (loc: ) print 1 index pdfstring cvs print ( ) print
%    (gen: ) print dup === flush
    0 3 1 roll			% set stream number = 0
    //false setxrefentry
    3 -1 roll pop		% remove stream number
  } bind executeonly
        % XRef entry type 2 - compressed object type xref entry
  {	% field 2 = object stream num, field 3 = index into object stream
%    (Compressed objects: ) print
%    (obj num: ) print 2 index pdfstring cvs print ( ) print
%    (field 2: ) print 1 index pdfstring cvs print ( ) print
%    (field 3: ) print dup === flush
    0 //false setxrefentry pop	% set generation number = 0
  } bind executeonly
] def

 %  Read the PDF 1.5 version of the xref table.
 %  Note:  The position is the location of the start of the dictionary object
 %  In PDF 1.5, the XRef dictionary also serves as the trailer dictionary
/readpdf15xref		% <pos> readpdf15xref <trailerdict>
 {
   /Classic-xref //false store
   PDFfile exch setfileposition		% move to start of object
        % Get object number, revision, and 'obj' and discard
   //false PDFfile token {
     type /integertype eq {
       PDFfile token {
         type /integertype eq {
           PDFfile token {
             /obj eq or
           } if
         } if
       } if
     } if
   } if
   not {
     /readpdf15xref cvx /syntaxerror signalerror
   } if
        % Get the XRef dicitionary
   /dictlevelcount 0 def PDFfile xrefopdict .pdfrun
        % Verify that we have an XRef dictionary
   dup /Type get /XRef ne {
     /readpdf15xref cvx /syntaxerror signalerror
   } if
        % Ensure that we we have room in the objects array, etc.
   dup /Size get 1 index /Index .knownget {
     %% if we have a /Index, remember to add the starting index on to the size
     dup 0 get 3 -1 roll add exch
     %% Get the staring index and number of entries from the Index array
     %% add them, and see if the result is larger than the starting index plus
     %% Size entry (yes they are *supposed* to be consistent.....)
     %% Bug #696365
     dup 0 get exch 1 get add 2 copy gt {
       pop
     }{
       exch pop
     } ifelse
   } if
   growPDFobjects
        % Create a stream for the XRef data
   PDFfile token pop pop		% Skip over 'stream'
   dup stream //false resolvestream
        % Stack: <XRefdict> <xref stream>
        % The Index array defines the ranges of object numbers in the
        % XRef stream.  Each value pair is consists of starting object
        % number and the count of consecutive objects.
        % Get the Index array, if present
   1 index /Index .knownget not {	% If no Index array ...
     [ 0 3 index /Size get ]		% Default = [ 0 Size ]
   } if
        % Loop through the Index array
   0 2 2 index length 1 sub {
        % Get start and end of object range
     2 copy get				% Start of the range
     dup 3 index 3 index 1 add get 	% Number of entries in range
        % Loop through the range of object numbers
     add 1 sub 1 exch {			% Form end of range, set increment = 1
        % Stack: <Xrefdict> <xref stream> <Index array> <pair loc> <obj num>
        % Get xref parameters.  Note:  The number of bytes for each parameter
        % is defined by the entries in the W array.
       4 index /W get aload pop		% Get W array values
        % The first field indicates type of entry.  Get first field value.
        % If the num. of bytes for field 1 is 0 then default field value is 1
       3 -1 roll dup 0 eq { pop 1 } { 6 index exch getintn } ifelse
        % Get the handler for the xref entry type.  We will execute the
        % handler after we get the other two field values.
       xref15entryhandlers exch get
       3 -1 roll 6 index exch getintn	% Get second field
       3 -1 roll 6 index exch getintn	% Get third field
       3 -1 roll exec			% Execute Xref entry handler
       pop pop pop			% Remove field values and obj num
     } for				% Loop through Xref entries
     pop				% Remove Index array pair loc
   } for				% Loop through Index array entries
   pop pop				% Remove Index array and xref stream
 } bind executeonly def

% Read the cross-reference table.
% <pos> is the position either from the startxref statement or the /Prev
% entry in the prior trailer dictionary.
/readxref		% <pos> readxref <trailerdict>
 {
   PDFoffset add PDFfile exch
   % Check that the given location is within the file.
   dup PDFfilelen gt {
       (   **** Warning:  Specified xref location is beyond end of file.\n)
       pdfformatwarning
       /readxref cvx /invalidaccess signalerror
   } if
   setfileposition
                % In some PDF files, this position actually points to
                % white space before the xref line.  Skip over this here.
   {
     PDFfile fileposition PDFfile read pop 32 gt { exit } if pop
   } loop
   dup		% Make copy of the file position (before last char was read).
   PDFfile exch setfileposition
                % The PDF specification says that the 'xref' must be on a line
                % by itself. The code here formerly used readline and linene to
                % check this. However, Acrobat Reader only requires the line to
                % begin with 'xref', and there are enough applications producing
                % non-compliant PDF files that we have to do this too.
   PDFfile pdfstring 0 4 getinterval readstring pop
   (xref) eq
   {
     readorigxref	% 'xref' -> original xref table
     % if hybrid-reference PDF, also fetch the entries
     % found in the XRef stream pointed by /XRefStm
     dup /XRefStm knownoget {
        %% Bug #695883 the test file has an XRefStm which points beyond the end of the file.
        %% We check that here and simply fall back to thje classic xref if this error occurs.
        dup PDFfilelen lt{
          PDFSTOPONERROR not {
            mark exch {readpdf15xref pop} stopped
            {
              (   **** Error:  This hybrid file's XRefStm does not point to a valid stream.\n                Ignoring error, output may be incorrect.\n) pdfformaterror
            } if
            cleartomark
          } {
            readpdf15xref pop
          } ifelse
        } {
          (   **** Error:  This hybrid file's XRefStm points beyond the end of file.\n                Ignoring error, output may be incorrect.\n) pdfformaterror
          pop
        }ifelse
     } if
   }
   { readpdf15xref }	% otherwise assume PDF 1.5 xref stream
   ifelse
 } bind executeonly def

% Open a PDF file and read the header, trailer, and cross-reference.
/pdfopen {		% <file> pdfopen <dict>
        % Color space substitution in PDF is handled somewhat differently
        % than in PostScript. A given device color space will be substituted
        % if the corresponding "Default..." entry exists in the Page's
        % Resource dictionary (which might be inhereted); there is no
        % UseCIEColor to enable/disable color mapping.
        %
        % This behavior is achieved by always setting UseCIEColor to true
        % in the page device dictionary. If the value of this parameter was
        % originally false (i.e.: the output device does not perform color
        % space substitution by default), the instances DefaultGray,
        % DefaultRGB, and DefaultCMYK of the (local) ColorSpace category
        % are redefined to be DeviceGray, DeviceRGB, and DeviceCMYK,
        % respectively. This is not done if UseCIEColor is true by default,
        % as in that case color substitution is presumably desired even
        % if the file does not request it.
   currentpagedevice /UseCIEColor .knownget dup { pop } if not
    { .currentglobal //false .setglobal
      /DefaultGray { /DeviceGray } cvlit /ColorSpace defineresource pop
      /DefaultRGB { /DeviceRGB } cvlit /ColorSpace defineresource pop
      /DefaultCMYK { /DeviceCMYK } cvlit /ColorSpace defineresource pop
      .setglobal
    }
   if
  pdfopenfile begin
  pdfopencache
  currentdict end
} bind executeonly def

/process_trailer_attrs {  % - process_trailer_attrs -
  writeoutputintents
  .writepdfmarks {
        % Copy bookmarks (outline) to the output.
    Trailer /Root knownoget {
     /Outlines knownoget {
       /NO_PDFMARK_OUTLINES where {pop NO_PDFMARK_OUTLINES not}{//true}ifelse
       {
          dup /First known {
            100 dict exch                               %% dictionary for detecting circular references
            /First get dup type /packedarraytype eq {   %% << >> {} or << >>
              dup 0 get dup                             %% << >> {} object_num object_num
              3 index 3 1 roll                          %% << >> {} << >> object_num object_num
              put
              oforce
            } if

            dup type /dicttype eq {
              {
                dup
                /Next known {
                  dup /Next get                         %% << >> <</Next...>> {} or << >>
                  dup type /packedarraytype eq {
                    dup 0 get                           %% << >> <</Next....>> {} object_num
                    dup 4 index exch known {
                      (\n   **** ERROR:  Circular reference detected in Outlines,\n) pdfformaterror
                      (                terminating Outline processing.\n) pdfformaterror
                      (                Output may be incorrect.\n) pdfformaterror
                                                        %% << >> <</Next....>> {} object_num
                      pop pop dup /Next undef           %% << >> <<.....>>
                      writeoutline exit
                    } if
                                                        %% << >> <</Next....>> {} object_num
                    dup 3 index 3 1 roll put            %% << >> <</Next....>> {}
                    oforce
                  } if
                  exch writeoutline                     %% << >> </Next object>
                  dup type /dicttype eq not
                  {pop exit} if
                } {
                  writeoutline exit
                }ifelse
              } loop
              pop
            }
            {pop pop} ifelse
          }{
            pop
          }ifelse
        } {
          pop
        }ifelse
      } if
    } if
    count /pdfemptycount exch def
    Trailer /Info {knownoget} stopped {
      (   **** Error:  Unable to read Info dictionary from Trailer, Info will not be preserved.\n) pdfformaterror
      count pdfemptycount sub {pop} repeat
      /emitProducer where {/emitProducer //false put} if
    }
    {
      {
        %
        % Bug #700820, if the Info dictionary isn't a dictionary, then don't try to use it....
        %
        dup type /dicttype eq {
          mark exch
          { /Author /Creator /Title /Subject /Keywords
            % /Producer is Ghostscript; /CreationDate is now; /ModDate is also now.
          } {
            2 copy knownoget { 3 -1 roll } { pop } ifelse
          } forall
          pop
          dup mark ne { {/DOCINFO pdfmark} stopped {cleartomark} if } { pop } ifelse
        }{
          pop
          (   **** Error:  The Info dictionary is not a dictionary, Info will not be preserved.\n) pdfformaterror
          count pdfemptycount sub {pop} repeat
          /emitProducer where {/emitProducer //false put} if
        } ifelse
      } if
    } ifelse
  } if
  % Initialize OC groups
  Trailer /Root knownoget {
    /OCProperties knownoget {
    % By default, OCGs are 'on'; mark only 'off' OCGs.
    % If, contrary to the spec, BaseState is OFF, mark all OCGs
    % and unmark ON ones. Bug 691491.
    dup /OCGs knownoget not { {} } if exch
    /D knownoget {
      dup /BaseState knownoget { /OFF eq } { //false } ifelse {
        (   **** Warning:  Default viewing OC config dictionary has /BaseState /OFF\n)
        pdfformatwarning
        1 index {
          oforce dup type /dicttype eq {
            /OFF 0 put
          } {
            pop
          } ifelse
        } forall
        /ON knownoget {
          { oforce dup type /dicttype eq {
              /OFF undef
            } {
              pop
            } ifelse
          } forall
        } if
      } {
        /OFF knownoget {
          { oforce dup type /dicttype eq {
              /OFF 0 put
            } {
              pop
            } ifelse
          } forall
        } if
      } ifelse
    } if
    pop
  } if
  } if

  % Enumerate all AcroForm fields and link all separate widgets
  % to the parent field.
  Trailer /Root knownoget {
    /AcroForm knownoget {
    %% If we don't have a NeedAppearances entry, treat as if true.
    %% We know Acrobat always regenerates all annotait
    dup /NeedAppearances knownoget not { //true } if {
      /NeedAppearances //true def
      dup
      /Fields knownoget {
        { oforce
          %% Make sure the entry from the Fields array is a dictionary
          %% Bug #692447.pdf has an array of nulls.
          dup type /dicttype eq {
            link_widget_annots
          }if
          pop
        } forall
      } if
      pop
    } {
      pop
    } ifelse
  } if
  } if

  % Use OutputIntent ICC profile
  systemdict /UsePDFX3Profile .knownget {
    dup //false eq {
      pop
    } {
      dup //true eq { pop 0 } if
      dup type /integertype eq {
        Trailer /Root oget /OutputIntents knownoget {
          dup length 2 index le  % i [] bool
          2 index 0 lt or {
            pop pop
            (Source file has no OutputIntent with this number.\n)
          } {
            exch oget dup type /dicttype ne { pop << >> } if
            /DestOutputProfile knownoget {
              [ /ICCBased 3 -1 roll ] ICCBased-resolve
              1 get .set_outputintent
              ()
            } {
              (This OutputputIntents dictionary has no profile.\n)
            } ifelse
          } ifelse
        } {
          pop (File has no /OutputIntents attribute\n)
        } ifelse
      } {
        pop (UsePDFX3Profile must be a boolean or an integer.\n)
      } ifelse
      dup () eq {
        pop
      } {
        (   **** ) stderrprint stderrprint
      } ifelse
    } ifelse
  } {
    % If the user told us to use a named OutputIntent
    systemdict /UseOutputIntent .knownget {
      cvn
      Trailer /Root oget /OutputIntents knownoget {
        {
          dup /OutputConditionIdentifier get cvn
          dup /Custom eq {
            pop
            dup /Info get cvn
          }if
          2 index eq {
            %% Found the required OutputIntent
            /DestOutputProfile knownoget {
              [ /ICCBased 3 -1 roll ] ICCBased-resolve
              1 get .set_outputintent
              ()
            } if
            pop
            exit
          }{
            pop
          } ifelse
        }
        forall
        pop
      }{
        pop
      }ifelse
    } if
  }ifelse
  Trailer /Root knownoget { /PageLabels knownoget {
    %% Currenlty only the pdfwrite device can handle PageLabels
    %% because we deal with these using putparams, not pdfmarks
    %% This is because the pdfmark syntax can't handle all the
    %% possible page label formats in a PDF file!
    /WantsPageLabels /GetDeviceParam .special_op {
      pop pop
      .pdfpagelabels
    } {
      pop
    } ifelse
  } if
  } if
} bind executeonly def

% Verify that each entry in the xref table is pointing at an object with
% the correct object number and generation number.
/verify_xref				% - verify_xref -
{ PDFfilelen
  1 1 Objects length 1 sub	% stack: filesize 1 1 <number of objects - 1>
  {	% Check if the object is free (i.e. not used).  The values in
        % Generations is the generation number plus 1.  If the value in
        % Generations is zero then the object is free.
        % Stack:  <filesize> <obj num>
    Generations 1 index get 		% Get the genration number
    0 ne {				% Skip if object number is free
      ObjectStream 1 index get 	% Check if object is in objectstream
      0 eq {	% We only check objects not in an objectstream
        {	% Use stop context since we may get an error if object is invalid
          dup Objects exch get 	% Get the object location
          PDFoffset add dup 3 index ge	% Compare object location to file size
          { pop //true }			% Rebuild if location not in file
          { PDFfile exch setfileposition % Go to the object location
            //true			% Stack:  <filesize> <obj num> <true>
            PDFfile token pop		% Read object number from file
            2 index eq {		% Verify object number
              PDFfile token pop		% Read generation number from file
              Generations 3 index	% Get specified generaton number
              get 1 sub		% Gen numbs are stored with 1 added.
              eq { 			% Verify generation number
                PDFfile token pop
                /obj eq { % Verify 'obj' text
                  pop //false		% We have valid object, do not rebuild
                } if
              } if
            } if
          } ifelse
        } //.internalstopped exec
        { //true } if			% If we stop then we need to rebuild
        % Stack:  <filesize> <obj num> <need rebuild flag>
        {
          (   **** Warning:  File has an invalid xref entry:  )
          pdfformatwarning
          pdfstring cvs pdfformatwarning
          (.  Rebuilding xref table.\n) pdfformatwarning
          search_objects
          exit
        } if				% If the entry is invalid
      } {
              % The object is in an object stream.  We currently do not rebuild
              % objects in an object stream.  So If we find one, then abort the
              % verification of the xref table entries.
        pop exit			% Pop object number and then exit loop
      } ifelse				% If not in an object stream
    } if				% If object entry is not free
    pop					% Remove object number
  } for
  pop					% Remove the size of the file
} bind odef

/pdfopencache {		% - pdfopencache -
        % Create and initialize some caches.
  /PageCount pdfpagecount def
  /PageNumbers PageCount 65534 .min dict def
  /PageIndex PageCount 65534 .min array def
} bind executeonly def

/pdfopenfile {		% <file> pdfopenfile <dict>
   //pdfdict readonly pop		% can't do it any earlier than this
   32 dict begin
   /LocalResources 0 dict def
   /DefaultQstate //null def	% establish binding
   /Printed where { pop } {
                % Guess whether the output device is a printer.
     /Printed currentpagedevice /OutputFile known def
   } ifelse
   currentpagedevice /OutputFile known {
     currentpagedevice /OutputFile get (%d) search {
       pop pop pop
       /NO_PDFMARK_OUTLINES //true def
       /NO_PDFMARK_DESTS //true def
     } {
       pop
     }ifelse
   } if
   /PSLevel1 where { pop } { /PSLevel1 //false def } ifelse
   % NB: PDFfile is used outside of the PDF code to determine that a
   % PDF job is being processed; to not change or hide this key.
   cvlit /PDFfile exch def
   /PDFsource PDFfile def
   /Repaired //false def
   /emitProducer //true def
   /RepairedAnError //false def
   /StreamRunAborted //false def
   /NeedAppearances //false def
   /ICCProfileNError //false def
   currentglobal //true .setglobal globaldict begin
   /UndefProcList 0 dict def
   end .setglobal
   PDFfile dup 0 setfileposition
   0 () /SubFileDecode filter   % to avoid file closure
   pdfstring readstring pop
   (%PDF-) search not {/pdfopen cvx /syntaxerror signalerror} if
   length /PDFoffset exch def pop
   % some badly formed PDF's (Visioneer) have something other than EOL
   % after the version number. If we get an error, shorten the string
   % and try again.
   //false exch		% error encountered
   { { cvr } stopped
     { exch pop //true exch 0 1 index length 1 sub dup 0 eq
       { pop 0 exit } if	% exit if string now empty
       getinterval		% trim character from right end and retry
     }
     { exch {
         (   **** Warning: PDF version number not followed by EOL.\n)
         pdfformatwarning
       }
       if exit
     }
     ifelse
   } loop

   /Classic-xref //true def
   /PDFversion exch def
        % Read the last cross-reference table.
   count /pdfemptycount exch def
   /Trailer << >> def		% Initialize to an emptry dict.
   {initPDFobjects findxref readxref}
   PDFSTOPONERROR not {
     //.internalstopped exec {
       recover_xref_data		% Read failed.  Attempt to recover xref data.
       search_trailer		% Search for the primary trailer
       //false                % search_trailer sets up /Trailer, so don't run the code to do that...
     } {
       //true
     } ifelse
   } {
     exec //true
   } ifelse

   {
     /Trailer exch def		% Save trailer dict after first xref table
        % Read any previous cross-reference tables.  When we are done,
        % verify that the entries in the xref tables are valid if NoVerifyXref
        % is not defined.
     /PrevArray [] def                        % Empty array, we use this to detect circular /Prev entries in xref (see below)
                                              % For some reqason, leaving this on the stack messes up seom files.
     Trailer
     { /Prev knownoget not {	% If no previous xref table then ...
         Classic-xref {
           /NoVerifyXref where { pop } { verify_xref } ifelse
         } if
         exit
       } if

       %% This code is used to detect circular references in xref tables. Every time
       %% we detect a /Prev in the xref, we check the given offset of the /Prev xref
       %% against a list of all previously encountered /Prev offsets. If we find that
       %% we have previously seen this one, we raise an error, stop processing the xref
       %% but carry on with the PDF file (unless PDFSTOPONERROR is true).
       //false exch PrevArray           %% Used to determine if the looop found a circular ref
       {                                %% //false offset 'array entry'
         1 index eq {
           exch pop //true exch         %% We've seen this offset before, pop the false and replace with true
           exit                         %% //true offset
         } if
       } forall

       exch                             %% [...] offset bool
       {
         (\n   **** Error: Circular /Prev entry while reading xref.\n               Aborting xref read, output may be incorrect.\n)
         pdfformaterror
         PDFSTOPONERROR {
           /readxref /syntaxerror cvx signalerror
         } if
         pop exit                       %% [...] and then exit this loop
       } if

       PrevArray dup                         %% offset [...] [...]
       length 1 add array               %% offset [...] [    ]
       dup 3 1 roll                     %% offset [    ] [...] [    ]
       copy pop                         %% offset [... ]
       dup dup length 1 sub             %% offset [... ] [... ] index
       3 index                          %% offset [... ] [... ] index offset
       put /PrevArray exch def

       { readxref }
       PDFSTOPONERROR not {
         //.internalstopped exec {
           recover_xref_data	% Read failed.  Attempt to recover xref data.
           /PrevArray where {/PrevArray undef} if     %% remove the array we were using to detect circular references
           exit			% Exit loop since recover gets all obj data.
         } if  			% If readxref stopped
       } {
         exec
       } ifelse
       % The PDF spec. says that each trailer dict should contain the required
       % entries.  However we have seen a PDF file that only has a Prev entry in
       % the initial trailer dict.  Acrobat complains but it accepts these files.
       % To work with these files, we are copying any entries which we find in
       % a previous trailer dict which are not present in the initial dict.
       dup {
         Trailer 2 index known {
           pop pop              % discard if key already present
         } {
           Trailer 3 1 roll put % add key if not present
         } ifelse
       } forall
     } loop			% Loop to previous trailer
     /PrevArray where {/PrevArray undef} if     %% remove the array we were using to detect circular references
   } if

   /NumObjects Objects length def  % To check that obj# < NumObjects

   % Scan numbers in the range 2147483648..4294967295 in Encrypt dictionary
   % as unsigned integers for compatibility with Acrobat Reader. Bug 689010.
   << /PDFScanUnsigned //true >> setuserparams
   { Trailer /Encrypt knownoget {
       pop
       pdf_process_Encrypt	% signal error
     } if
   } stopped
   << /PDFScanUnsigned //false >> setuserparams
   { stop } if

   % Check for recursion in the page tree. Bug 689954, MOAB-06-01-2007
   verify_page_tree

   currentdict end
 } bind executeonly def

%% Executing token on a file will close the file if we reach EOF while
%% processing. When repairing broken files (or searching for startxref
%% and the xref offset) we do *NOT* want this to happen, because that
%% will close PDFfile and we don't have the filename to reopen it.
/token_no_close {   %% -file- token_no_close <any> true | false
  dup type /filetype eq {
    <<
    /EODCount 2 index bytesavailable    %% fix data length at underlying bytes
    /EODString ()                       %% make sure filter passes that many bytes, no EOD
    /CloseSource //false                  %% Be sure, tell the filter not to close the source file
    >>
    /SubFileDecode filter dup           %% -filter- -filter-
    token {                             %% -filter- <any> true | false
                                        %%  token returned a value
      exch                              %%  <any> filter
      closefile                         %%  <any>
      //true                              %%  <any> true
    }{
                                        %% token didn't find a value
      closefile                         %%  -
      //false                             %%  false
    } ifelse
  } {
      token
  } ifelse
} bind executeonly def

% Look for the last (startxref) from the current position
% of the file. Return the position after (startxref) if found or -1 .
/find-startxref {  % <file> find_eof <file> <position>
  -1
  { 1 index dup  0 (startxref) /SubFileDecode filter flushfile
    bytesavailable 9 lt { exit } if
    pop dup fileposition
  } loop
} bind executeonly def

% Search for the last 'startxfer' and read a following token, which
% must be a number. Don't pay any attention to %%EOF because it's
% often mangled.
% There seems to be no limit on the amount of garbage that can be
% appended to the PDF file. Current record (60K) belongs to
% PDF-Out (v 2.0 - 35). We start the search from the last 1024
% bytes and continue from the beginning of the file.
/findxref {		% - findxref <xrefpos>
  PDFfile dup dup dup 0 setfileposition bytesavailable
  dup /PDFfilelen exch def
        % Find the last %%EOF string (within 1024 bytes)
  1024 sub PDFoffset .max
  setfileposition find-startxref   % file pos|-1  % search the last 1024 bytes
  dup 0 le {
    pop
    dup PDFoffset setfileposition find-startxref  % search from the beginnibg
    dup 0 le {
       (   **** Error: Cannot find a 'startxref' anywhere in the file.\n)
       pdfformaterror
       (               Output may be incorrect.\n) pdfformaterror
       /findxref cvx /syntaxerror signalerror
    } if
  } if
  2 copy setfileposition
  pop token_no_close not { //null } if
  dup type /integertype ne {
    (   **** Error: invalid token after startxref.\n)  pdfformaterror
    (               Output may be incorrect.\n) pdfformaterror
        /findxref cvx /syntaxerror signalerror
  } if
} bind executeonly def

/stderrfile (%stderr) (w) file def
/stdoutfile (%stdout) (w) file def

/stderrprint {                % <string> stderrprint -
  //stderrfile dup 3 -1 roll writestring flushfile
} bind executeonly def

/stdoutprint {                % <string> stderrprint -
  //stdoutfile dup 3 -1 roll writestring flushfile
} bind executeonly def

/pdfformaterror {	% <string> pdfformaterror -
  stdoutprint
  /Repaired //true store
  /RepairedAnError //true store
} bind executeonly def

/pdfformatwarning {	% <string> pdfformaterror -
  QUIET not {stdoutprint}{pop}ifelse
  /Repaired //true store
  PDFSTOPONWARNING {/warning cvx /undefined signalerror} if
} bind executeonly def

/knownoget_safe
{ 2 copy knownoget { 3 1 roll pop pop //true } { pop pop //false } ifelse
} odef

/printProducer {
  Trailer /Info { knownoget_safe } stopped { pop pop //false } if

  {
    /emitProducer where {/emitProducer get}{//true} ifelse
    {
      /Producer knownoget not { //null } if
    }{
      pop //null
    } ifelse
  } {
    //null
  } ifelse

  dup //null eq {
    pop
  } {
    (   **** The file was produced by: \n   **** >>>> ) stderrprint
        % Handle a Unicode Producer.
    (\376\377) anchorsearch {
      pop dup length 2 idiv string 0 1 2 index length 1 sub {
                % Stack: origstr newstr i
        1 index exch 3 index 1 index 2 mul 1 add get put
      } for exch pop
    } if
    stderrprint
    ( <<<<\n) stderrprint
  } ifelse
} bind executeonly def
% The UndefProcList collects noisy warnings.
% This gets rid of many multiple warnings from pdf_font.ps
/printCollectedWarnings {
   UndefProcList length 0 gt {
      (\n   **** Embedded font uses undefined procedure\(s\):  ) stderrprint
      UndefProcList {
         exch .namestring stderrprint ( ) stderrprint
         =string cvs stderrprint ( times, ) stderrprint
      } forall
      (\n) stderrprint
   } if
} bind executeonly def

/printrepaired {
  QUIET not
  {
    printCollectedWarnings
    (\n   **** This file had errors that were repaired or ignored.\n)
    stdoutprint
    printProducer
    (   **** Please notify the author of the software that produced this\n)
    stdoutprint
    (   **** file that it does not conform to Adobe's published PDF\n)
    stdoutprint
    (   **** specification.\n\n)
    stdoutprint
  } if
} bind executeonly def

/printrepairederror {
  QUIET not
  {
    printrepaired
    (   **** The rendered output from this file may be incorrect.\n)
    stdoutprint
  } if
} bind executeonly def

% Write the outline structure for a file.  Uses linkdest (below).
% omit links to pages that don't exist.
/writeoutline		% <outlinedict> writeoutline -
 { mark
   0 2 index /First knownoget
    { { exch 1 add exch /Next knownoget not { exit } if } loop }
   if
                % stack: dict mark count
   dup 0 eq
    { pop 1 index }
    { 2 index /Count knownoget { 0 lt { neg } if } if
      /Count exch 3 index
    }
    ifelse
    {
      dup /A knownoget {
        dup /URI known {
          /A mark 3 2 roll    % <<>> /A [ <<action>>
          { oforce } forall
          .dicttomark
          3 2 roll
        }
        {
          dup /S knownoget  {
            %% Because we process GoTo Destinations into absolute references in the PDF file
            %% we need to resolve the /D or /Dest. However, we must *not* do this for
            %% GoToR Destinations because (obviously) those are in a different file and
            %% we cannot resolve them into absolute references. We don't need to anyway
            %% because that file must already have a named destination.
            dup /GoTo eq {
              pop
              dup /D knownoget {
                exch pop exch dup length dict copy dup /Dest 4 -1 roll put
              } if
            }{
              dup /GoToR eq {
                pop /A mark       % <<..action dict..>> /A [
                3 2 roll          % /A [ <<..action dict..>>
                { oforce } forall
                .dicttomark
                3 2 roll
              }{
                dup /Launch eq {
                  pop /A mark       % <<..action dict..>> /A [
                  3 2 roll          % /A [ <<..action dict..>>
                  { oforce } forall
                  .dicttomark
                  3 2 roll
                }{
                    /Named eq {
                    /N knownoget {                % Assume /S /Named
                        namedactions exch .knownget { exec } if
                    } if
                  } if
                } ifelse
              } ifelse
            } ifelse
          } if
        } ifelse
      } if
      linkdest
    } stopped
    {
      cleartomark	% ignore this link
      (   **** Warning: Outline has invalid link that was discarded.\n)
      pdfformatwarning
    } {
      /Title knownoget {
        {/Title exch /OUT pdfmark} stopped {cleartomark} if
      } {
        cleartomark
        (   **** Warning: Outline without /Title attribute was discarded.\n)
        pdfformatwarning
      } ifelse
    }
   ifelse
   /First knownoget
    { { dup writeoutline /Next knownoget not { exit } if } loop }
   if
 } bind executeonly def

% Close a PDF file.
/pdfclose		% <dict> pdfclose -
 { begin
   PDFfile closefile
   end
 } bind executeonly def

% ======================== Page accessing ======================== %

% Get a (possibly inherited) attribute of a page.
/pget			% <pagedict> <key> pget <value> -true-
                        % <pagedict> <key> pget -false-
 {
   2 copy knownoget
    { exch pop exch pop //true }
    {
      %% Check to see if there's a Parent
      1 index
      3 1 roll
      exch /Parent knownoget
      {
        %% If there is a Parent, check to see if this dictionary has a stored object number
        3 -1 roll /.gs.pdfobj# .knownget {
          %% if it does, check the Parent as wwell
          1 index /.gs.pdfobj# .knownget {
            %% Both have object numbers, are they the same (ie its self-referencing)
            eq {
              pop pop
              //false
            }{
              exch pget
            }ifelse
          }{
            pop exch pget
          }ifelse
        } {
          exch pget
        }ifelse
      }
        % finally see if the key is (misplaced) in the Root Catalog dict
      { exch pop dup Trailer /Root oget exch knownoget dup {
          3 -1 roll (   **** Error:  The /) pdfformaterror 50 string cvs pdfformaterror
          ( key is missing from the Page tree.\n) pdfformaterror
          (                Output may be incorrect.\n) pdfformaterror
        }
        { exch pop }
        ifelse
      }
      ifelse
    }
   ifelse
 } bind executeonly def

/parent_obj_get { % /ResourceName pagedict /ObjType LocalResourceDir
  /ParentResources .knownget {
    dup 2 index .knownget {
      % Found ObjType directory
      4 index .knownget {
        0 get 5 1 roll pop pop pop pop
      } {
         parent_obj_get	% not found -- check it's parent.
      } ifelse
    } {
      parent_obj_get	% not found -- check it's parent.
    } ifelse
  } {
    pop pop pop 0
  } ifelse
} bind executeonly def

/obj_get { % /ResourceName pagedict /ObjType obj_get
           %                                 success: /ResourceName objnumber
           %                                    fail: /ResourceName /ResourceName 0
  LocalResources 1 index knownoget {
    dup 4 index .knownget {
      0 get 5 1 roll pop pop pop pop
    } {
      pop pop pop 0
    } ifelse
  } {
    % Not in LocalResources. Try Page Resources.
    1 index /Resources pget {
      1 index knownoget {
        dup 4 index known {
          3 index get
          0 get 4 1 roll pop pop pop
        }{
          % Not in Page Resources, recursively try ParentResources as a last resort
          pop	% page Resources
          LocalResources parent_obj_get
        }ifelse
      }{
        % No Page Resources, recursively try ParentResources as a last resort
          pop	% page Resources
          LocalResources parent_obj_get
      } ifelse
    } {
        % No Page Resources, recursively try ParentResources as a last resort
      pop pop pop 0
    }ifelse
  }ifelse
}bind executeonly def

% Get the value of a resource on a given page.
/rget {			% <resname> <pagedict> <restype> rget <value> -true-
                        % <resname> <pagedict> <restype> rget -false-
  LocalResources 1 index knownoget {
     3 index knownoget
  } {
    //false
  } ifelse {
    exch pop exch pop exch pop //true
  } {
    1 index /Resources pget {
      1 index  knownoget { 3 index knownoget } { //false } ifelse
    } {
      //false
    } ifelse {
      4 1 roll pop pop pop //true
    } {
      countdictstack array dictstack
      //false 5 1 roll
      dup length 1 sub -1 4 {       % false /Name <<>> /Type [<<gstate>>] i
        1 index exch get            % false /Name <<>> /Type [] <<gstate>>
        /FormResDict .knownget {    % false /Name <<>> /Type [] <<res>>
          2 index knownoget {       % false /Name <<>> /Type [] <<type_dict>>
            4 index knownoget {     % false /Name <<>> /type [] <<res_dict>>
              (   **** Warning: resource was found only in an external (parent) context.\n) pdfformatwarning
              //true 7 2 roll       % <<res_dict>> true false /Name <<>> /Type []
              pop exit
            } if
          } if
        } if
      } for
      pop pop pop pop
    } ifelse
  } ifelse
} bind executeonly def

% Get the total number of pages in the document.
/pdfpagecount		% - pdfpagecount <int>
 { Trailer /Root knownoget {
    /Pages knownoget {
     dup /Count knownoget {
       dup type /integertype eq { dup 0 le } { //true } ifelse {
         pop
         dup /Kids knownoget {
           pop
           (   **** Warning:  Invalid Page count.\n) pdfformatwarning
           % find the last page and use that as the Count
           1 1 999999999 {
             dup pdffindpage?
             exch pop
             //null eq { exit } { pop } ifelse
           } for
           1 sub		% decrement to last page that we were able to find
           2 copy /Count exch put
         } {
           0 % return 0 and keep 0 page count.
           (   **** Warning:  PDF document has no pages.\n) pdfformatwarning
         } ifelse
       } if
       exch pop
     } {
         dup /Type oget /Page eq {
           << exch 1 array astore /Kids exch /Count 1 /Type /Pages >>
           Trailer /Root oget /Pages 3 -1 roll put
           1
           (   **** Warning:  No /Pages node. The document /Root points directly to a page.\n)
           pdfformatwarning
       } {
         (   **** Warning:  Page count not found; assuming 1.\n)
         pdfformatwarning
         pop 1
       } ifelse
     } ifelse
     } {
     0
     }ifelse
  }{
   0
  } ifelse
 } bind executeonly def

% Check for loops in the 'page tree' but accept an acyclic graph.
% - verify_page_tree -
/verify_page_tree {
  Trailer /Root knownoget {
    /Pages knownoget {
      10 dict begin
      /Count pdfpagecount def
      /verify_page_tree_recursive {
        Count 0 gt {
          dup 1 def
          dup /Kids knownoget {
            { oforce
              dup //null ne {
                currentdict 1 index known {
                  (   **** Error: there's a loop in the Pages tree. Giving up.\n) pdfformaterror
                  /verify_page_tree cvx /syntaxerror signalerror
                } if
                verify_page_tree_recursive
              } {
                pop
              } ifelse
            } forall
          } {
            /Count Count 1 sub def
          }ifelse
          currentdict exch undef
          } {
            pop
            (   **** Error: Too many pages in Page tree.\n) pdfformaterror
        } ifelse
      } def
      verify_page_tree_recursive
      end
    } if
  } if
} bind executeonly def

/pdffindpage? {		% <int> pdffindpage? 1 null 	(page not found)
                        %  <int> pdffindpage? 1 noderef (page found)
                        %  <int> pdffindpage? 0 null	(Error: page not found)
  Trailer /Root oget /Pages get
    {		% We should be able to tell when we reach a leaf
                % by finding a Type unequal to /Pages.  Unfortunately,
                % some files distributed by Adobe lack the Type key
                % in some of the Pages nodes!  Instead, we check for Kids.
      dup oforce /Kids knownoget not { exit } if
      exch pop //null
      0 1 3 index length 1 sub {
         2 index exch get
         dup oforce dup /Kids known { /Count oget } { pop 1 } ifelse
                % Stack: index kids null noderef count
         dup 5 index ge { pop exch pop exit } if
         5 -1 roll exch sub 4 1 roll pop
      } for exch pop
                % Stack: index null|noderef
      dup //null eq { pop pop 1 //null exit } if
    } loop
} bind executeonly def

% Find the N'th page of the document by iterating through the Pages tree.
% The first page is numbered 1.
/pdffindpageref {		% <int> pdffindpage <objref>
  dup pdffindpage?
                % Stack: index countleft noderef
   1 index 1 ne { pop pop /pdffindpage cvx /rangecheck signalerror } if
   exch pop
   PageIndex 2 index 1 sub 65533 .min 2 index oforce put
   PageNumbers 1 index oforce 3 index dup 65534 le
    { put }
    { pop pop pop }	% don't store more than 65534 pagenumbers
   ifelse
   exch pop
} bind executeonly def
/pdffindpage {		% <int> pdffindpage <pagedict>
  pdffindpageref oforce
} bind executeonly def

% Find the N'th page of the document.
% The first page is numbered 1.
/pdfgetpage		% <int> pdfgetpage <pagedict>
 { PageIndex 1 index 1 sub dup 65533 lt
    { get }
    { pop pop //null }
   ifelse
   dup //null ne
    { exch pop oforce }
    { pop pdffindpage }
   ifelse
 } bind executeonly def

% Find the page number of a page object (inverse of pdfgetpage).
/pdfpagenumber		% <pagedict> pdfpagenumber <int>
 {	% We use the simplest and stupidest of all possible algorithms....
   PageNumbers 1 index .knownget
    { exch pop
    }
    { 1 1 PageCount 1 add	% will give a rangecheck if not found
       { dup pdfgetpage oforce 2 index eq { exit } if pop
       }
      for exch pop
    }
   ifelse
 } bind executeonly def

% Arrange the four elements that define a rectangle into a 'normal' order.
/normrect_elems   % <x1> <y1> <x2> <y2> normrect_elems <llx> <lly> <urx> <ury>
{
    4 { % Bug 693919
      dup type dup /integertype ne exch /realtype ne and {
         (   **** Error: replacing malformed number ') pdfformaterror pdfstring cvs pdfformaterror
         (' with 0.\n) pdfformaterror
         (               Output may be incorrect.\n) pdfformaterror
         0
      } if
      4 1 roll
    } repeat
    exch 4 1 roll			% <x2> <x1> <y1> <y2>
    2 copy gt { exch } if		% <x2> <x1> <lly> <ury>
    4 2 roll 2 copy lt { exch } if	% <lly> <ury> <urx> <llx>
    4 1 roll exch			% <llx> <lly> <urx> <ury>
} bind executeonly def

% Arrange a rectangle into a 'normal' order.  I.e the lower left corner
% followed by the upper right corner.
/normrect 	% <rect> normrect <rect>
{
    aload pop normrect_elems 4 array astore
} bind executeonly def

/fix_empty_rect_elems % </Name> <x1> <y1> <x2> <y2> fix_empty_rect_elems <x1> <y1> <x2'> <y2'>
{  dup 3 index eq { //true } { 1 index 4 index eq } ifelse {
     pop pop pop pop
     (   **** Warning:  File has an empty ) pdfformaterror pdfstring cvs pdfformaterror
     (. Using the current page size instead.\n) pdfformaterror
     (                  Output may be incorrect.\n) pdfformaterror
     0 0 currentpagedevice /PageSize get aload pop
   } {
     5 -1 roll pop
   } ifelse
} bind executeonly def

/boxrect		% <llx> <lly> <urx> <ury> boxrect <x> <y> <w> <h>
 { exch 3 index sub exch 2 index sub
 } bind executeonly def
/resolvedest {		% <name|string|other> resolvedest <other|null>
  dup type /nametype eq {
    Trailer /Root oget /Dests knownoget {
      exch knownoget not { //null } if
    } {
      pop //null
    } ifelse
  } {
    dup type /stringtype eq {
      Trailer /Root oget /Names knownoget {
        /Dests knownoget {
          exch nameoget
        } {
          pop //null
        } ifelse
      } {
        pop //null
      } ifelse
    } if
  } ifelse
} bind executeonly def

% Procedures to do the necessary transformations of view destinations
% <PDF2PS_matrix> <rot> <view> -- <view'>
/viewdestprocs 8 dict dup begin
    /Fit  { exch pop exch pop } bind executeonly def
    /FitH {
        aload length 2 lt {
          1 array astore
          3 1 roll pop pop
        }{
          0 4 -1 roll 1 and 0 eq { exch } if
          4 -1 roll transform exch pop
          2 array astore
        } ifelse
    } bind executeonly def
    /FitV {
        aload length 2 lt {
          1 array astore
          3 1 roll pop pop
        }{
          0 4 -1 roll 1 and 0 ne { exch } if
          4 -1 roll transform pop
          2 array astore
        } ifelse
    } bind executeonly def
    /FitB  /Fit  load def
    /FitBH /FitH load def
    /FitBV /FitV load def
    /XYZ  {
        dup length dup 4 gt {
          pop /viewdestprocs cvx /rangecheck signalerror
        }{
          dup 4 eq {
            pop aload pop
          } {
            dup 3 eq {
              pop aload pop //null
            } {
              dup 2 eq {
                pop aload pop //null //null
              } {
                dup 1 eq {
                  pop aload pop //null //null //null
                } {
                  pop /viewdestprocs cvx /rangecheck signalerror
                } ifelse
              } ifelse
            } ifelse
          } ifelse
        } ifelse
        3 1 roll
        2 copy 7 -1 roll 1 and 0 ne { exch } if	4 2 roll    % odd rotation switches x<->y
        2 { dup //null eq { pop 0 } if exch } repeat	    % replace nulls with 0
        7 -1 roll transform				    % transform coordinates
        2 { 3 -1 roll //null eq { pop //null } if exch } repeat % put the nulls back
        3 -1 roll
        4 array astore
    } bind executeonly def
    /FitR {
        exch pop
        aload pop
        2 { 5 index transform 4 2 roll } repeat normrect_elems
        5 array astore
        exch pop
    } bind executeonly def
end readonly def

/linkdest {		% <link|outline> linkdest
                        %   ([/Page <n>] /View <view> | ) <link|outline>
  dup /NewWindow knownoget {
    /NewWindow exch 3 -1 roll
  } if
  dup /F knownoget {
    /File exch 3 -1 roll
  } if
  dup /Dest knownoget
    {
      resolvedest
      dup type /dicttype eq { /D knownoget not { //null } if } if
      dup //null eq
       { pop }
       { dup 0 oget
         //false % don't have a page# and transformation matrix (yet)
         1 index type /dicttype eq {
           1 index /Type knownoget {
             /Page eq {
               pop % the "false" flag
               dup pdf_cached_PDF2PS_matrix exch
               dup /Rotate pget not { 0 } if cvi 90 idiv exch
               pdfpagenumber /CumulativePageCount where {pop CumulativePageCount}{0}ifelse add
               //true % now we have a page# and a transformation matrix
             } if
           } if
         } if
         % stack: <link|outline> <dest>	( <PDF2PS_matrix> <rot>	<page#>	true  |	 <page> false )
         {
           /Page exch 6	2 roll
           % stack: [/Page <page#>] <link|outline> <dest> <PDF2PS_matrix> <rot>
           3 -1 roll dup length 1	sub 1 exch getinterval /View 4 1 roll
           % stack: [/Page <page#>] <link|outline> /View <PDF2PS_matrix> <rot> <view>
          //viewdestprocs 1 index 0 get get exec
           3 -1 roll
        } {
           dup type /integertype eq {
             /CumulativePageCount where {pop CumulativePageCount}{0}ifelse add
             /Page exch 1 add 4 2 roll
           } {
             pop
           } ifelse
           dup length 1 sub 1 exch getinterval /View exch 3 -1 roll
         } ifelse
       }
      ifelse
    }
   if
} bind executeonly def


%% Used to recursively check dictionaries for any /.gs.pdfobj# keys
%% and remove them if so
%% -any- /Removepdfobj# -any-

/Removepdfobj#
{
  dup type /dicttype eq {
    dup /.gs.pdfobj# known {
      dup /.gs.pdfobj# undef
    } if
    dup {Removepdfobj# 2 index 3 1 roll put} forall
  } if
}bind executeonly def

% <pagedict> mark ... -proc- <page#> <error>
/namedactions 8 dict dup begin
  /FirstPage { 1 /CumulativePageCount where {pop CumulativePageCount}{0}ifelse add //false } bind executeonly def
  /LastPage { pdfpagecount /CumulativePageCount where {pop CumulativePageCount}{0}ifelse add //false } bind executeonly def
  /NextPage { counttomark 2 add index pdfpagenumber 1 add dup pdfpagecount gt exch /CumulativePageCount where {pop CumulativePageCount}{0}ifelse add exch} bind executeonly def
  /PrevPage { counttomark 2 add index pdfpagenumber 1 sub dup 1 lt exch /CumulativePageCount where {pop CumulativePageCount}{0}ifelse add exch} bind executeonly def
end readonly def
% <pagedict> <annotdict> -proc- -

% **** The following procedure should not be changed to allow clients
% **** to directly interface with the constituent procedures. GSview
% **** and some Artifex customers rely on the pdfshowpage_init,
% **** pdfshowpage_setpage, pdfshowpage_finish so all logic should be
% **** implemented in one of those three procedures.
/pdfshowpage		% <pagedict> pdfshowpage -
 { dup /Page exch store
   pdfshowpage_init     % <pagedict>
   pdfshowpage_setpage  % <pagedict>
   pdfshowpage_finish   % -
 } bind executeonly def

/pdfpagecontents	% <pagedict> pdfpagecontents <contents>
 { } bind executeonly def

/pdfshowpage_init 	% <pagedict> pdfshowpage_init <pagedict>
 { /DSCPageCount DSCPageCount 1 add store
 } bind executeonly def

/get_media_box { % <pagedict> get_media_box <box> <bool>
  /MediaBox pget {
    oforce_array //true
  } {
    (   **** Error: Page has no /MediaBox attribute. Using the current page size.\n)
    pdfformaterror
    (               Output may be incorrect.\n) pdfformaterror
    [ 0 0 currentpagedevice /PageSize get aload pop ] //false
  } ifelse
} bind executeonly def

/get_any_box { % <pagedict> get_any_box <box name> <box>
  //systemdict /UseBleedBox .knownget dup { and } if {
    dup /BleedBox pget {
      /BleedBox exch
    } if
  } if
  //systemdict /UseTrimBox .knownget dup { and } if {
    dup /TrimBox pget {
      /TrimBox exch
    } if
  } if
  dup type /arraytype ne {
    //systemdict /UseArtBox .knownget dup { and } if {
      dup /ArtBox pget {
        /ArtBox exch
      } if
    } if
  } if
  dup type /arraytype ne {
    //systemdict /UseCropBox .knownget dup { and } if {
      dup /CropBox pget {
        /CropBox exch
      } if
    } if
  } if
  dup type /arraytype ne {
    /MediaBox exch get_media_box pop
  } {
    oforce_elems              % <<pdict>> /SomeBox x0 y0 x1 y1
    %% Complicated stuff. We need to use the 'Box' we identified (if any), but we
    %% need to clamp the boundaries of the 'Box' to the MediaBox. This appears to
    %% be what Acrobat does. The complication arises because the Box values don't
    %% have to be sensibly positive, its permissible to have the MediaBox set up
    %% so that it extends down and left instead of up and right. We take care of the
    %% content when we st up the CTM, but we do need to make sure that we clamp
    %% the BoundingBox, and that means we need to take direcitonality into account...

    6 -1 roll get_media_box { % /SomeBox x0 y0 x1 y1 [MediaBox]
      aload pop               % /SomeBox x0 y0 x1 y1 X0 Y0 X1 Y1

      %% Start with the width, get the X0 and X1 values of the MediaBox
      3 index                 % /SomeBox x0 y0 x1 y1 X0 Y0 X1 Y1 X0
      2 index                 % /SomeBox x0 y0 x1 y1 X0 Y0 X1 Y1 X0 X1
      gt {
        %% Media extends to left
        4 -1 roll             % /SomeBox x0 y0 x1 y1 Y0 X1 Y1 X0
        8 -1 roll             % /SomeBox y0 x1 y1 Y0 X1 Y1 X0 x0
        .min                  % /SomeBox y0 x1 y1 Y0 X1 Y1 mX0
        7 1 roll              % /SomeBox mX0 y0 x1 y1 Y0 X1 Y1
        exch                  % /SomeBox mX0 y0 x1 y1 Y0 Y1 X1
        5 -1 roll             % /SomeBox mX0 y0 y1 Y0 Y1 X1 x1
        .max                  % /SomeBox mX0 y0 y1 Y0 Y1 mX1
        5 1 roll              % /SomeBox mX0 mX1 y0 y1 Y0 Y1
      }{
        %% Media extends to right
        4 -1 roll             % /SomeBox x0 y0 x1 y1 Y0 X1 Y1 X0
        8 -1 roll             % /SomeBox y0 x1 y1 Y0 X1 Y1 X0 x0
        .max                  % /SomeBox y0 x1 y1 Y0 X1 Y1 mX0
        7 1 roll              % /SomeBox mX0 y0 x1 y1 Y0 X1 Y1
        exch                  % /SomeBox mX0 y0 x1 y1 Y0 Y1 X1
        5 -1 roll             % /SomeBox mX0 y0 y1 Y0 Y1 X1 x1
        .min                  % /SomeBox mX0 y0 y1 Y0 Y1 mX1
        5 1 roll              % /SomeBox mX0 mX1 y0 y1 Y0 Y1
      } ifelse

      %% Now deal with the height
      2 copy                  % /SomeBox mX0 mX1 y0 y1 Y0 Y1 Y0 Y1
      gt {
        %% Media extends down
        exch                  % /SomeBox mX0 mX1 y0 y1 Y1 Y0
        4 -1 roll             % /SomeBox mX0 mX1 y1 Y1 Y0 y0
        .min                  % /SomeBox mX0 mX1 y1 Y1 mY0
        3 1 roll              % /SomeBox mX0 mX1 mY0 y1 Y1
        .max                  % /SomeBox mX0 mX1 mY0 mY1
      }{
        %% Media extends up
        exch                  % /SomeBox mX0 mX1 y0 y1 Y1 Y0
        4 -1 roll             % /SomeBox mX0 mX1 y1 Y1 Y0 y0
        .max                  % /SomeBox mX0 mX1 y1 Y1 mY0
        3 1 roll              % /SomeBox mX0 mX1 mY0 y1 Y1
        .min                  % /SomeBox mX0 mX1 mY0 mY1
      } ifelse
      exch                    % /SomeBox mX0 mX1 mY1 mY0
      3 1 roll                % /SomeBox mX0 mY0 mX1 mY1
    } {
      pop
    } ifelse
    4 array astore            % /SomeBox [mX0 mY0 mX1 mY1]
  } ifelse
} bind executeonly def

% Compute the matrix that transforms the PDF->PS "default" user space
/pdf_PDF2PS_matrix {	% <pdfpagedict> -- matrix
  matrix currentmatrix matrix setmatrix exch
  % stack: savedCTM <pdfpagedict>
  dup get_any_box
  % stack: savedCTM <pdfpagedict> /Trim|Crop|Art|MediaBox <Trim|Crop|Art|Media Box>
  oforce_elems normrect_elems fix_empty_rect_elems 4 array astore
  //systemdict /PDFFitPage known {
    PDFDEBUG { (Fiting PDF to imageable area of the page.) = flush } if
    currentpagedevice /.HWMargins get aload pop
    currentpagedevice /PageSize get aload pop
    % Adjust PageSize and .HWMargins for the page portrait/landscape orientation
    2 copy gt	% PageSize_is_landscape
    7 index aload pop 3 -1 roll sub 3 1 roll exch sub exch
    10 index /Rotate pget not { 0 } if cvi 90 idiv 1 and 0 ne { exch } if
    gt	% Box_is_landscape
    xor		% PageSize_is_landscape(or square) xor'ed with Box_is_lanscape suggests rotate
    2 index 2 index eq not and {	% don't rotate if Page is square
      1 index 0 translate 90 rotate	% add in a rotation
      PDFDEBUG { (    Rotating the page for best fit) = flush } if
      2 copy ne {
        % rotate the .HWMargins
        2 copy lt {
          6 2 roll 4 -1 roll 6 -2 roll
        } {
          6 2 roll 4  1 roll 6 -2 roll
        } ifelse
        % rotate the page dimensions
        exch
      } if
    } if
    3 -1 roll sub 3 1 roll exch sub exch
    % stack: savedCTM <pdfpagedict> <Crop|Media Box> Xmin Ymin Xmax Ymax
    PDFDEBUG { (    Translate up by [ ) print 3 index =print (, ) print 2 index =print ( ]) = flush } if
    3 index 3 index translate		% move origin up to imageable area
    2 index sub exch 3 index sub exch 4 2 roll pop pop
            % stack: savedCTM <pdfpagedict> [Box] XImageable YImageable
    2 index aload pop 2 index sub exch 3 index sub exch 4 2 roll pop pop
    5 index /Rotate pget not { 0 } if 90 cvi idiv 1 and 0 ne { exch } if
            % stack: savedCTM <pdfpagedict> [Box] XImageable YImageable XBox YBox
    4 copy
    3 -1 roll exch div 3 1 roll div .min
            % stack: savedCTM <pdfpagedict> [Box] XImageable YImageable XBox YBox scale
    PDFDEBUG { (    Scale by ) print dup = flush } if
    5 -4 roll
            % stack: savedCTM <pdfpagedict> [Box] scale XImageable YImageable XBox YBox
    3 index 2 index 6 index mul sub 2 div 3 index 2 index 7 index mul sub 2 div
    PDFDEBUG { (    Centering translate by [ ) print 1 index =print (, ) print dup =print ( ]) = flush } if
    translate pop pop pop pop
  } {
    //systemdict /NoUserUnit .knownget not { //false } if {
      1
    } {
      1 index /UserUnit knownoget {
        PDFDEBUG { (Scaling due to UserUnit by ) print dup = flush } if
      } {
        1
      } ifelse
    } ifelse
  } ifelse
  % stack: savedCTM <pdfpagedict> [Box] scale
  dup scale
  % Rotate according to /Rotate
  aload pop boxrect
  {
    {     pop pop }
    { -90 rotate pop neg 0 translate }
    { 180 rotate neg exch neg exch translate }
    {  90 rotate neg 0 exch translate pop }
  }
  5 index /Rotate pget not { 0 } if cvi
  PDFDEBUG { dup 0 ne { (Rotating by ) print dup =print ( degrees.) = flush } if } if
  90 idiv 3 and get exec
  % Now translate to the origin given in the Crop|Media Box
  exch neg exch neg translate
  % stack: savedCTM <pdfpagedict>
  pop
  matrix currentmatrix exch setmatrix
} bind executeonly def

% Cache the matrix that transforms the PDF->PS "default" user space
% into <pdfpagedict> under the key //PDF2PS_matrix_key, then return it
/PDF2PS_matrix_key (PDF->PS matrix) cvn def
/pdf_cached_PDF2PS_matrix {  % <pdfpagedict> -- <PDF2PS_matrix>
  dup //PDF2PS_matrix_key .knownget {
    exch pop
  } {
    dup dup pdf_PDF2PS_matrix //PDF2PS_matrix_key exch put
    //PDF2PS_matrix_key get
  } ifelse
} bind executeonly def
currentdict /PDF2PS_matrix_key undef

/.pdfshowpage_Install {	% <pagedict> [<prevproc>] .pdfshowpage_Install -
  0 get exec
  pdf_cached_PDF2PS_matrix concat
} bind executeonly def

/pdfshowpage_setpage {	% <pagedict> pdfshowpage_setpage <pagedict>
  6 dict begin		% for setpagedevice
        % Stack: pdfpagedict
  % This comment is no longer true, and is maintained here for history only:
  %
  % UseCIEColor is always true for PDF; see the comment in runpdf above
  %
  % We now test the page to see if it defines any Default* colour spaces and
  % only set UseCIEColor if it does. This prevents a spurious warning from
  % pdfwrite about not using UseCIEColor with pdfwrite.
  %
    pdfshowpage_detect_cspacesub {
      /UseCIEColor //true def
    } if

  % Only lock in Orientation if we need to for pdfmarks
  .writepdfmarks { /Orientation 0 def } if
  currentpagedevice
        % Stack: pdfpagedict currentpagedevicedict
  1 index get_any_box
        % Stack: pdfpagedict currentpagedevicedict /BoxName [box]
  oforce_elems normrect_elems fix_empty_rect_elems boxrect 4 2 roll pop pop
  3 index /Rotate pget not { 0 } if cvi 90 idiv 1 and 0 ne { exch } if
  % stack: pdfpagedict currentpagedevicedict boxwidth boxheight
  //systemdict /PDFFitPage known {
    % Preserve page size,
    % but choose portrait/landscape depending on box width:height ratio
    % (if box width == height, select portrait orientation)
    gt
    1 index /PageSize get aload pop
    2 copy gt
    4 -1 roll ne { exch } if
  } {
    % Set the page size.
    //systemdict /NoUserUnit .knownget not { //false } if not {
      3 index /UserUnit knownoget {
        dup 4 -1 roll mul 3 1 roll mul
      } if
    } if
  } ifelse
  2 array astore /PageSize exch def
  % Determine the number of spot colors used on the page.  Note: This searches
  % the pages resources.  It may be high if a spot color is in a resource but
  % is not actually used on the page.
  currentpagedevice /PageSpotColors known { /PageSpotColors 2 index countspotcolors def } if

  % If the user told us to use a named OutputIntent
  systemdict /UseOutputIntent .knownget {
    cvn
    % Check to see if this page has such an OutputIntent
    2 index /OutputIntents knownoget {
      {
        dup /OutputConditionIdentifier get cvn
        dup /Custom eq {
          pop
          dup /Info get cvn
        }if
        2 index eq {
          %% Found the required OutputIntent
          /DestOutputProfile knownoget {
            [ /ICCBased 3 -1 roll ] ICCBased-resolve
            1 get .set_outputintent
            ()
          } if
          pop
          exit
        }{
          pop
        } ifelse
      }
      forall
      pop
    }{
      pop
    }ifelse
  } if

  % Let the device know if we will be using PDF 1.4 transparency.
  % The clist logic may need to adjust the size of bands.
  1 index pageusestransparency /PageUsesTransparency exch def
  dup /Install .knownget {
                        % Don't let the Install procedure get more deeply
                        % nested after every page.
      dup type dup /arraytype eq exch /packedarraytype eq or {
        dup length 4 eq {
          dup 2 get /.pdfshowpage_Install load eq {
            1 get 0 get	% previous procedure
          } if
        } if
      } if
  } {
    { }
  } ifelse 1 array astore
  2 index exch /.pdfshowpage_Install load /exec load
  4 packedarray cvx
        % Stack: pagedict currentpagedict installproc
  /Install exch def
        % Stack: pagedict currentpagedict
  pop currentdict end setpagedevice
} bind executeonly def

/.free_page_resources {   % - .free_page_resources -
  Page /Resources pget {
    /Shading knownoget {
      { dup type /dicttype eq {
          dup /.shading_dict known {
            dup /.shading_dict undef
          } if
        } if
        pop pop
      } forall
    } if
  } if
} bind executeonly def

/pdfshowpage_finish {	% <pagedict> pdfshowpage_finish -
   save /PDFSave exch store
   /PDFdictstackcount countdictstack store
   /PDFexecstackcount count 2 sub store
   (before exec) VMDEBUG

   % set up color space substitution (this must be inside the page save)
   pdfshowpage_setcspacesub

  .writepdfmarks {

    % Pagelabel
      pagelabeldict begin dopagelabel end
    % Copy the boxes.
        % Copy the boxes.
    { /CropBox /BleedBox /TrimBox /ArtBox } {
      2 copy pget {
        % .pdfshowpage_Install transforms the user space do same here with the boxes
        oforce_elems
        2 { Page pdf_cached_PDF2PS_matrix transform 4 2 roll } repeat
        normrect_elems 4 index 5 1 roll fix_empty_rect_elems 4 array astore
        mark 3 1 roll {/PAGE pdfmark} stopped {cleartomark} if
      } {
        pop
      } ifelse
    } forall
  } if		% end .writepdfmarks

        % Display the actual page contents.
   9 dict begin
   /BXlevel 0 def
   /BMClevel 0 def
   /OFFlevels 0 dict def
   /BGDefault currentblackgeneration def
   /UCRDefault currentundercolorremoval def
        %****** DOESN'T HANDLE COLOR TRANSFER YET ******
   /TRDefault currenttransfer def
  matrix currentmatrix 2 dict
  2 index /CropBox pget {
    oforce_elems normrect_elems boxrect
    4 array astore 1 index /ClipRect 3 -1 roll put
  } if
  dictbeginpage setmatrix
  /DefaultQstate qstate store

  count 1 sub /pdfemptycount exch store
        % If the page uses any transparency features, show it within
        % a transparency group. The scan was performed during pdfshowpage_setpage
        % and the result was set in the pagedevice dictionary. Use it rather than
        % scanning again IF it is present. If the pdfshowpage_setup was not called
        % (eg GSView 5) then it will not be present, so we must rescan.
  currentpagedevice /PageUsesTransparency .knownget not {dup pageusestransparency} if
  dup /PDFusingtransparency exch def {
    % If the current device isn't CMYK, or if it is a HighLevelDevice (pdfwrite) we
    % don't need the special handling of Overprint transparency, so disable the checking.
    currentpagedevice dup /Colors get 4 lt exch /HighLevelDevice known or {
      /checkOPtrans { pop //false } def	% NB: original will be restored from PDFsave
    } if
    % Show the page within a PDF 1.4 device filter.
    0 .pushpdf14devicefilter {
      /DefaultQstate qstate store		% device has changed -- reset DefaultQstate
      % If the page has a Group, enclose contents in transparency group.
      % (Adobe Tech Note 5407, sec 9.2)
      dup /Group knownoget {
        1 index /CropBox pget {
          /CropBox exch
        } {
          1 index get_media_box pop /MediaBox exch
        } ifelse
        oforce_elems normrect_elems fix_empty_rect_elems 4 array astore .beginpagegroup
        showpagecontents
        .endtransparencygroup
      } {
        showpagecontents
      } ifelse
    } stopped {
      % abort the transparency device
      .abortpdf14devicefilter
      /DefaultQstate qstate store	% device has changed -- reset DefaultQstate
      stop
    } if
    { } settransfer		% identity transfer during popdevice (put_image)
    .poppdf14devicefilter	% NB: reset to DefaultQstate will also restore transfer function
    /DefaultQstate qstate store	% device has changed -- reset DefaultQstate
  } {
    /checkOPtrans { pop //false } def	% no-op the check if the page doesn't use transparency
                                % NB: original will be restored from PDFsave
    showpagecontents
  } ifelse
  .free_page_resources
  % todo: mixing drawing ops outside the device filter could cause
  % problems, for example with the pnga device.
  endpage
  end			% scratch dict
  % Some PDF files don't have matching q/Q (gsave/grestore) so we need
  % to clean up any left over dicts from the dictstack

  PDFdictstackcount //false
  { countdictstack 2 index le { exit } if
    currentdict /n known not or
    end
  } loop {
    StreamRunAborted not {
      (\n   **** Error: File has unbalanced q/Q operators \(too many q's\)\n               Output may be incorrect.\n)

      //pdfdict /.Qqwarning_issued .knownget
      {
        {
          pop
        }
        {
          currentglobal //pdfdict gcheck .setglobal
          //pdfdict /.Qqwarning_issued //true .forceput
          .setglobal
          pdfformaterror
        } executeonly ifelse
      } executeonly
      {
        currentglobal //pdfdict gcheck .setglobal
        //pdfdict /.Qqwarning_issued //true .forceput
        .setglobal
        pdfformaterror
      } executeonly ifelse
    } executeonly if
  } executeonly if
  pop
  count PDFexecstackcount sub { pop } repeat
  (after exec) VMDEBUG
  Repaired		% pass Repaired state around the restore
  RepairedAnError
  PDFSave restore
  currentglobal //pdfdict gcheck .setglobal
  //pdfdict /.Qqwarning_issued //false .forceput
  .setglobal
  /RepairedAnError exch def
  /Repaired exch def
} bind executeonly odef

% Display the contents of a page (including annotations).
/showpagecontents {	% <pagedict> showpagecontents -
  dup		% Save the pagedict for the Annotations

  % We do a 'save' here in order to allow us to restore at the end of the page, before
  % we run the annotations. There are two reasons for this; firstly so that the graphics state
  % at the time we run the annotations is the same as when we ran the page, secondly in order
  % to empty the font cache before we run the annotations.
  %
  % Bug #700096 an annotation uses Helvetica but doesn't embed it, however the page *does*
  % use an embedded Helvetica, which is subset and not prefixed as such. For this file to
  % render correctly we must not use the font from the page, but must find a replacement.
  % However the file for Bug #695897 has a page which uses two versions of the same font,
  % one embedded, one not. In order for *that* file to render correctly we *must* use the
  % embedded font as a substitute for the missing font. So we divorce the fonts used
  % for the page from the fonts used for Annotations, this allows both files to work as
  % expected.
  %
  % We also need a countdictstack, so that we can check the dictionaries on the dictioanry
  % stack after we run the page contents, and 'end' an extra ones before we try to restore
  % otherwise we might try to restore back to a point before one of those dictionaries existed.
  %
  save
  countdictstack
  3 -1 roll
  count 1 sub  /pdfemptycount exch store
  /Contents knownoget not { 0 array } if
  dup type /arraytype ne { 1 array astore } if {
    oforce dup type /dicttype eq {
      //false resolvestream pdfopdict .pdfrun
    } {
      (**** Error: The Page /Contents array contains an element which is not a stream\n            This page will not display correctly\n\n)
      pdfformaterror
      pop exit
    }ifelse
  } forall
  % check for extra garbage on the ostack and clean it up
  count pdfemptycount sub dup 0 ne {
    (   **** Error: File did not complete the page properly and may be damaged.\n)
    pdfformaterror
    (               Output may be incorrect.\n) pdfformaterror
    { pop } repeat
  } {
    pop
  } ifelse

  % Top of the stack should ow be the count of dictionaries on the stack at the time
  % we did a save. If there are more than there were then, end dictionaries until
  % we get back to the sme number.
  {
    countdictstack 1 index le {exit}if
    end
  } loop
  % discard the count of dictionaries
  pop
  % and restore the state. This will take us back to a point before any fonts
  % used on the page were defined, so the annotations won't inherit any of
  % them.
  restore

  % Draw the annotations
  //systemdict /ShowAnnots .knownget not { //true } if {
    /Annots knownoget {
      { oforce
        dup //null ne {
        .writepdfmarks
        %%
        %% We don't want to preserve annotations with ps2write, because we don't convert them
        %% back into pdfmarks on output.
        %%
        /ForOPDFRead /GetDeviceParam .special_op {
          exch pop
        }{
          //false
        }ifelse
        not
        and
        //systemdict /PreserveAnnots .knownget not {//true} if and {
            mark exch {preserveannot} PDFSTOPONERROR {exec}{stopped {(Error: Ignoring invalid annotation, output may be incorrect.\n) pdfformaterror} if} ifelse cleartomark
          }{
            mark exch {drawannot} PDFSTOPONERROR {exec}{stopped {(Error: Ignoring invalid annotation, output may be incorrect.\n) pdfformaterror} if} ifelse cleartomark
          } ifelse
        } {
          pop
        } ifelse
      } forall
    } if
  } if
  //systemdict /ShowAcroForm .knownget { //true eq } { //false } ifelse {
    Trailer /Root oget /AcroForm knownoget { draw_acro_form } if
  } if
} bind executeonly def

/processcolorspace {	% - processcolorspace <colorspace>
        % The following is per the PLRM3.
  currentdevice 1 dict dup /ProcessColorModel dup put .getdeviceparams
  exch pop exch pop
  dup type /nametype ne { cvn } if
  dup { setcolorspace } //.internalstopped exec { pop /DeviceRGB } if
} bind executeonly def

% ------ Transparency support ------ %

% Determine whether a page might invoke any transparency features:
%	- Non-default BM, ca, CA, or SMask in an ExtGState
%	- Image XObject with SMask
% Note: we deliberately don't check to see whether a Group is defined,
% because Adobe Illustrator 10 (and possibly other applications) define
% a page-level group whether transparency is actually used or not.
% Ignoring the presence of Group is justified because, in the absence
% of any other transparency features, they have no effect.
%
% Transparency is a 1.4 feature however we have seen files that claimed
% to be PDF 1.1 with transparency features. Bugs 689288, 691273.
/pageusestransparency {		% <pagedict> pageusestransparency <bool>
  NOTRANSPARENCY {
    pop //false
  } {
    dup //false exch {
      4 dict 1 index resourceusestransparency { pop not exit } if
      %% Check the current dictionary and its Parent (if any) to see
      %% if they both have stored object numbers. If they do then
      %% check the numbers, don't allow self-references.
      dup /Parent knownoget not { pop exit }
      {
        exch /.gs.pdfobj# .knownget
        {
          1 index /.gs.pdfobj# .knownget {
            eq {
              pop exit
            }if
          }{
            pop
          }ifelse
        }if
      } ifelse
    } loop
    % Also check for transparency in the annotation (if not in resources).
    { pop //true } { annotsusetransparency } ifelse
  } ifelse
} bind executeonly def

% Check if transparency is specified in an ExtGState dict
/extgstateusestransparency {	% <gstate dict> extgstateusestransparency <bool>
  //false exch		% Assume no transparency
  dup //null eq {
    pop % bug 692050
  } {
    {			% establish loop context
      dup /BM knownoget {
        dup /Normal ne exch /Compatible ne and { pop not exit } if
      } if
      dup /ca knownoget { 1 ne { pop not exit } if } if
      dup /CA knownoget { 1 ne { pop not exit } if } if
      dup /SMask knownoget { /None ne { pop not exit } if } if
      pop exit
    } loop
  } ifelse
} bind executeonly def

% Check if transparency is used in a Pattern
/patternusestransparency {	% <Pattern dict> patternusestransparency <bool>
  dup //null eq NOTRANSPARENCY or
  { pop //false }
  { //false exch		% Assume no transparency
    {
      4 dict 1 index resourceusestransparency { pop not exit } if
      dup /ExtGState knownoget { extgstateusestransparency { pop not exit } if } if
      pop exit
    } loop
  }
  ifelse
} bind executeonly def

% Check the Resources of a page or Form. Check for loops in the resource chain.
/resourceusestransparency {	% <dict> <dict> resourceusestransparency <bool>
  {	% Use loop to provide an exitable context.
    /Resources knownoget not { 0 dict } if
    2 copy .knownget {
      { % Some circular references may be missed because scanning stops
        % when the 1st transparency is found.
        (   **** Warning: Found circular references in resource dictionaries while checking for transparency.\n)
        pdfformatwarning
      } if
      pop //false exit
    } if
    2 copy //true put              % In the current chain.
    dup /ExtGState knownoget {
      //false exch
      { exch pop oforce extgstateusestransparency { pop //true exit } if
      } forall
      { pop //true exit } if
    } if
    dup /Pattern knownoget {
      //false exch
      { exch pop oforce patternusestransparency { pop //true exit } if
      } forall
      { pop //true exit } if
    } if
    dup /XObject knownoget {
      dup type /dicttype eq {
        //false exch
        {
          exch pop oforce
          dup //null ne {
            dup type /dicttype eq {
                dup /Subtype get
                dup /Image eq {
                  1 index /SMask oknown { pop pop not exit } if
                  1 index /SMaskInData knownoget {
                    0 ne { pop pop not exit } if
                  } if
                } if
                /Form eq {
                  dup /Group known {pop pop //true exit}{
                  3 index exch resourceusestransparency { not exit } if
                  } ifelse
                } {
                  pop
                } ifelse
            } {
              pop
              (   **** Warning: Ignoring non-dictionary /XObject attribute while checking for transparency.\n)
              pdfformatwarning
            } ifelse
          } {
            pop
          } ifelse
        } forall
        { pop //true exit } if
      } {
        (   **** Warning: Ignoring non-dictionary /XObject while checking for transparency.\n)
        pdfformatwarning
        pop
      } ifelse
    } if
    dup /Font knownoget {
      //false exch
      {
        exch pop oforce
        dup type /dicttype eq {
          dup /Subtype knownoget {
            /Type3 eq
            {
              3 index exch resourceusestransparency
              { pop //true exit } if
            }
            {pop} ifelse
          }
          {
            pop
          }ifelse
        }
        { % probably a name object
          pop
        }ifelse
      } forall
      { pop //true exit } if
    } if
    2 copy //false put             % Visited but not in the current chain.
    pop //false exit
  } loop
  exch pop
} bind executeonly def

% Check if the annotations on a page use transparency
/annotsusetransparency {	% <page dict> annotsusetransparency <bool>
   //false exch			% Assume no transparency
   /Annots knownoget {		% Get Annots array
     {
       oforce
       dup //null ne {
         dup /Subtype knownoget {
           /Highlight eq {      % Highlight annotation is always implemented
             pop pop //true exit  % as transparency.
           } if
         } if
         dup /AP knownoget {	% Get appearance dict for the annoation
           /N knownogetdict { 	% Get the /N (i.e. normal) appearance stream
             4 dict exch resourceusestransparency { pop pop //true exit } if
           } if
         } if  			% If AP dict known
         dup /BM knownoget {
           //true exit
         } if
         dup /CA knownoget {
           1 le {
             pop pop //true exit
           } if
         } if
         /ca knownoget {
           1 le {
             pop //true exit
           } if
         } if
       } {
         pop
       } ifelse
     } forall			% For all annots on the page
   } if
} bind executeonly def

% Add a color name to our spot color list.  Ignore /All and /None
/putspotcolor {			% <name> <spotcolordict> putspotcolor -
  % The 'name' could be a string.  If so then convert to a name.
  exch dup type /stringtype eq { cvn } if
  dup dup /None eq exch /All eq or { pop pop } { 0 put } ifelse
} bind executeonly def

% Determine which spot colors are used within a color space  Note: This
% dict will include all colors used in Separation or DeviceN color spaces.
% Thus it may include Cyan, Magenta, Yellow, and Black.
%	<colorspace> <spotcolordict> colorspacespotcolors -
/colorspacespotcolors {
  exch dup type /arraytype eq {
    % If we have an Indexed color space then get the base space.
    dup 0 oget                    % <<>> [csp] /Type
    dup /Indexed eq {
      pop 1 oget                  % <<>> [base]
      2 copy exch colorspacespotcolors
    } {
      % Stack:  <spotcolordict> <colorspace> <colorspacetype>
      dup /Separation eq exch /DeviceN eq or {
        dup 1 oget dup type /arraytype eq {
          { oforce 2 index putspotcolor } forall
        } {
          2 index putspotcolor
        } ifelse
      } if
    } ifelse
  } if
  pop pop
} bind executeonly def

% Check the Resources of a page, form, or annotation.  Determine which spot
% colors are used within the resource  Note: The spot color dict will include
% all colors used in Separation or DeviceN color spaces.  Thus it may include
% Cyan, Magenta, Yellow, and Black.  We also pass a dict that is used to check
% for loops in the resource list.
%	<spotcolordict> <loopdict> <page/form/annot dict>
% 		 resourcespotcolors <spotcolordict> <loopdict>
/resourcespotcolors {
  {	% Use loop to provide an exitable context.
    % Exit if no Resources entry
    /Resources knownoget not { exit } if
    % Exit if we have already seen this dict
    2 copy known { pop exit } if

    % Save the Resources dict into our loop checking dict.
    2 copy 0 put

    % Scan resources that might contain a color space.
    dup /ColorSpace knownoget {
      { exch pop oforce 3 index colorspacespotcolors } forall
    } if
    dup /Pattern knownoget {
      { exch pop oforce
        dup /Shading knownoget {
          exch pop
          /ColorSpace oget 3 index colorspacespotcolors
        } {
          4 copy exch pop resourcespotcolors pop pop pop
        } ifelse
      } forall
    } if
    dup /Shading knownoget {
      { exch pop
        oforce /ColorSpace
        { oget } stopped
        {
          pop pop
          (   **** Error: invalid color space in shading, output may be incorrect.\n) pdfformaterror
        }
        { 3 index colorspacespotcolors}
        ifelse
      } forall
    } if
    /XObject knownoget {
      dup type /dicttype eq {
        { exch pop oforce
          dup type /dicttype eq {
            dup //null ne {
              dup /Subtype oget
              dup /Form eq {
                pop resourcespotcolors
              } {
                /Image eq {
                  /ColorSpace knownoget {
                    2 index colorspacespotcolors
                  } if
                } {
                  pop
                } ifelse
              } ifelse
            } {
              pop
            } ifelse
          } {
            pop
          } ifelse
        } forall
      } {
        pop % Just ignore here, already reported by resourceusestransparency.
      } ifelse
    } if
    exit
  } loop
} bind executeonly def

% Determine which spot colors are used within the annotations.  Note: This
% dict will include all colors used in Separation or DeviceN color spaces.
% Thus it may include Cyan, Magenta, Yellow, and Black.
%	<spotcolordict> <loopdict> <annotsarray>
% 		 annotsspotcolors <spotcolordict> <loopdict>
/annotsspotcolors {
  { oforce
    dup //null ne {
      /AP knownoget {	% Get appearance dict for the annoation
        /N knownogetdict {		% Get the /N (i.e. normal) appearance stream
          resourcespotcolors
        } if			% If normal appearance streamknown
      } if			% If AP dict known
    } {
      pop
    } ifelse
 } forall
} bind executeonly def

% Determine spot colors are used within a page.  We are creating a dict to
% hold the spot color names as keys.  Using a dict avoids having to worry
% about duplicate entries.  The keys in the dict contain the spot color
% names.  However the values have no meaning.  Note: This dict will include
% all colors used in Separation or DeviceN color spaces specified in the
% page's resources.  Thus it may include Cyan, Magenta, Yellow, and Black.
% There is no attempt to verify that these color spaces are actually used
% within the object streams for the page.
/pagespotcolors {		% <pagedict> pagespotcolors <spotcolordict>
  dup
  % Create a dict to hold spot color names.
  0 dict exch
  % Create a dict to be used to check for reference loops.
  4 dict exch
  % Check for color spaces in the Resources
  resourcespotcolors
  % now check upwards in the object hierarchy in case of inherited resources
  2 index
  {
    /Parent knownoget
    {
      dup 4 1 roll
      resourcespotcolors
      3 -1 roll
    }
    {
      exit
    } ifelse
  } loop
  % Also check for color spaces in the annotations.
  3 -1 roll
  /Annots knownoget { annotsspotcolors } if
  pop				% Discard reference loop dict
} bind executeonly def

% Determine how many (if any) spot colors are used by a page.
% Note:  This count does not include Cyan, Magenta, Yellow, or Black
/countspotcolors {		% <pagedict> countspotcolors <count>
  pagespotcolors		% Get dict with all spot colors
  dup length			% spot color dict length
  % Remove CMYK from the spot color count.
  [ /Cyan /Magenta /Yellow /Black ]
  { 2 index exch known { 1 sub } if } forall
  exch pop			% Remove spot color dict
} bind executeonly def

% ------ ColorSpace substitution support ------ %

%%
%% <pagedict> pdf_colorspace_detect_cspacesub <boolean>
%%
/pdf_colorspace_detect_cspacesub {
  //false exch
  /Resources knownoget {
    /ColorSpace knownoget {
      dup /DefaultGray knownoget {
        resolvecolorspace csncomp 1 eq {
          pop pop //true
        } if
      } {
        dup /DefaultRGB knownoget {
          resolvecolorspace csncomp 3 eq {
            pop pop //true
          } if
        } {
          /DefaultCMYK knownoget {
            resolvecolorspace csncomp 4 eq {
              pop //true
            } if
          } if
        } ifelse
      } ifelse
    } if
  } if
} bind executeonly def

%% <loopdict> <Objectdict>  <calling obj_num> pdfform_detect_cspacesub <boolean>
%%
/pdf_object_detect_cspacesub {
  %% use loop operator for an exitable context
  %% we need this to detect recursion/looping
  {
    exch                                      %%  <loopdict> <calling obj_num> <Objectdict>
    dup pdf_colorspace_detect_cspacesub {
      pop pop //true exit
    }{                                        %%  <loopdict> <calling obj_num> <Objectdict>
      /Resources knownoget {                  %%  <loopdict> <calling obj_num> <Resourcesdict>
        2 index 1 index known {
          %% We've already seen this object, ignore it and exit
          pop pop //false exit
        }{
          2 index 1 index //null put
        } ifelse

        /XObject knownoget {                  %%  <loopdict> <calling obj_num> <XObjectdict>
         //false exch                        %%  <loopdict> <calling obj_num> <XObjectdict> false
          %% We have files where the XObject Resource is not a dictionary
          dup type /dicttype eq {             %%  <loopdict> <calling obj_num> <XObjectdict> false

            %% check each Xobject entry in the dictionary,
            %% forall purs a key/value pair on the stack for us.
            %%
            {                                 %%  <loopdict> <calling obj_num> <XObjectdict> false key value
              exch pop                        %%  <loopdict> <calling obj_num> <XObjectdict> false value

              %% If this is an indirect reference, check if its the smae object
              %% as the current one. If its not indirect, make the object number 0
              %% for comparison purposes.
              dup type /packedarraytype eq {
                dup 0 get dup 4 index
                eq
              } {
                0 //false
              }ifelse

              %%  <calling obj_num> <XObjectdict> false value <form object or 0 if not indirect> <boolean>
              not {
                %% swap object number and value, and dereference value
                exch oforce
                %% Apparently we have files where the content of the XObject Resource dictionary is null
                dup //null ne {
                  %% and files where the indivudal XObjects are not dictionaries
                  dup type /dicttype eq {
                    dup /Subtype get /Form eq {
                      exch
                      4 index 3 1 roll pdf_object_detect_cspacesub {
                        pop //true exit
                      } if
                    } {
                      pop pop
                    }ifelse
                  }{
                    pop pop
                  } ifelse
                }{
                  pop pop
                }
                ifelse
              }{
                pop pop
              } ifelse
            } forall
          }{
            pop
          }ifelse
        } {
          %% No forms, so can't be any Default* spaces
          //false
        }ifelse
      } {
        //false
      } ifelse
    } ifelse
    %% Remove the calling object ID, return our boolean
    exch pop exit
  } loop
  %% remove and discard the loopdict
  exch pop
} bind executeonly def

%
% <pagedict> pdfshowpage_detect_cspacesub <pagedict> <boolean>
%
% this is used simply to detect whether the current page has any
% Default* color spaces defined. If it does then we want pdfshowpage_setpage
% to set UseCIEColor to true so that the Default* space is used. If the
% page doesn't use any Default* spaces, then we *don't* want to set
% UseCIEColor as that will confuse a warning in pdfwrite about
% not using UseCIEColor with pdfwrite.
%
/pdfshowpage_detect_cspacesub {
  dup 0 1 dict 3 1 roll pdf_object_detect_cspacesub

  /HighLevelDevice /GetDeviceParam .special_op {
      exch pop not exch pop
  }if
} bind executeonly def

%
%  <pagedict>   pdfshowpage_setcspacesub   <pagedict>
%
% Set up color space substitution for a page. Invocations of this procedure
% must be bracketed by the save/restore operation for the page, to avoid
% unintended effects on other pages.
%
% If any color space substitution is used, and the current color space is a
% device dependent color space, make sure the current color space is updated.
% There is an optimization in the setcolorspace operator that does
% nothing if both the current and operand color spaces are the same. For
% PostScript this optimization is disabled if the UseCIEColor page device
% parameter is true. This is not the case for PDF, as performance suffers
% significantly on some PDF files if color spaces are set repeatedly. Hence,
% if color space substitution is to be used, and the current color space
% is a device dependent color space, we must make sure to "transition" the
% current color space.
%
/pdfshowpage_setcspacesub  {
  //false
  /DefaultGray 2 index /ColorSpace //rget exec {
    resolvecolorspace dup csncomp 1 eq {
      dup type /nametype eq { 1 array astore } if
      /DefaultGray exch /ColorSpace defineresource pop
      pop //true
    } {
      pop
      (   **** Error: ignoring invalid /DefaultGray color space.\n)
      pdfformaterror
      (                 Output may be incorrect.\n) pdfformaterror
    } ifelse
  } if

  /DefaultRGB 2 index /ColorSpace //rget exec {
    resolvecolorspace dup csncomp 3 eq {
      dup type /nametype eq { 1 array astore } if
      /DefaultRGB exch /ColorSpace defineresource pop
      pop //true
    } {
      pop
      (   **** Error: ignoring invalid /DefaultRGB color space.\n)
      pdfformaterror
      (                 Output may be incorrect.\n) pdfformaterror
    } ifelse
  } if

  /DefaultCMYK 2 index /ColorSpace //rget exec {
    resolvecolorspace dup csncomp 4 eq {
      dup type /nametype eq { 1 array astore } if
      /DefaultCMYK exch /ColorSpace defineresource pop
      pop //true
    } {
      pop
      (   **** Error: ignoring invalid /DefaultCMYK color space.\n)
      pdfformaterror
      (                 Output may be incorrect.\n) pdfformaterror
    } ifelse
  } if

  { % if using color space substitution, "transition" the current color space
    currentcolorspace dup length 1 eq {  % always an array
      0 get
      dup /DeviceGray eq 1 index /DeviceRGB eq or 1 index /DeviceCMYK eq or {
        /Pattern setcolorspace setcolorspace
      } {
        pop
      } ifelse
    } {
      pop
    } ifelse
  } if
} bind executeonly def

% Write OutputIntents to device if the device handles it
/writeoutputintents {
  currentdevice 1 dict dup /OutputIntent //null put readonly
  .getdeviceparams
  mark ne { pop pop
    % device supports OutputIntent parameter
    % Make sure we don't have a badly broken PDF file!
    Trailer /Root knownoget {
      /OutputIntents knownoget {
        dup type /arraytype eq {
          {	% process all output profiles present
            oforce
            dup length dict .copydict
            dup /DestOutputProfile knownoget {
              PDFfile fileposition exch
              mark exch { oforce } forall .dicttomark
              //true resolvestream
              [ { counttomark 1 add index
                  64000 string readstring
                  not { exit } if
                } loop
              ] exch closefile
              0 1 index { length add } forall .bytestring
              0 3 2 roll {
                3 copy putinterval
                length add
              } forall pop
              exch PDFfile exch setfileposition
              1 index /DestOutputProfile 3 2 roll put
            } if
            % Convert to string array because it's easier for the device
            [ 1 index /OutputCondition knownoget not { () } if
              2 index /OutputConditionIdentifier knownoget not { () } if
              3 index /RegistryName knownoget not { () } if
              4 index /Info knownoget not { () } if
              5 index /DestOutputProfile knownoget not { () } if
            ]
            [ /OutputIntent 3 2 roll /.pdfputparams where
              { pop .pdfputparams }
              { currentdevice //null //false counttomark 1 add 3 roll .putdeviceparamsonly }
            ifelse
            pop pop
            pop	  % done with this OutputIntent dictionary
          } forall
        } {
          pop
          (   **** Error: /OutputIntent is of an incorrect type, ignoring OutputIntent.\n)
          pdfformaterror
          (                 Output may be incorrect.\n) pdfformaterror
        } ifelse
      } if	% OutputIntents known
      % tell device there are no more OutputIntents
      [ /OutputIntent [ ] /.pdfputparams where
        { pop .pdfputparams }
        { currentdevice //null //false counttomark 1 add 3 roll .putdeviceparamsonly }
        ifelse
        pop pop
    } if
  } if
} bind executeonly def

end			% pdfdict
.setglobal

%% This list of operators are used internally by various parts of the Ghostscript PDF interpreter.
%% Since each operator is a potential security vulnerability, and any operator listed here
%% is not required once the initislisation is complete and functions are bound, we undefine
%% the ones that aren't needed at runtime.
/.PDF_UNDEF_OPLIST
[
/.pdfawidthshow /.pdfwidthshow /.currentblackptcomp /.setblackptcomp
/.setfillcolor /.setfillcolorspace /.setstrokecolor /.setstrokecolorspace /.currentrenderingintent /.setrenderingintent
/.currenttextrenderingmode /.settextspacing /.currenttextspacing /.settextleading /.currenttextleading
/.settextrise /.currenttextrise /.setwordspacing /.currentwordspacing /.settexthscaling /.currenttexthscaling
/.settextlinematrix /.currenttextlinematrix /.currenttextmatrix /.settextmatrix /.currentblendmode
/.currentopacityalpha /.currentshapealpha /.currenttextknockout
/.pushextendedgstate /.popextendedgstate /.begintransparencytextgroup
/.endtransparencytextgroup /.begintransparencymaskgroup /.begintransparencymaskimage /.endtransparencymask /.image3x
/.abortpdf14devicefilter /.pdfinkpath /.pdfFormName /.setstrokeconstantalpha
/.setfillconstantalpha /.setalphaisshape /.currentalphaisshape
/.settextspacing /.currenttextspacing /.settextleading /.currenttextleading /.settextrise /.currenttextrise
/.setwordspacing /.currentwordspacing /.settexthscaling /.currenttexthscaling /.setPDFfontsize /.currentPDFfontsize
/.setdistillerparams

% Used by our own test suite files
%/.pushpdf14devicefilter    % transparency-example.ps
%/.poppdf14devicefilter     % transparency-example.ps
%/.setopacityalpha          % transparency-example.ps
%/.setshapealpha            % transparency-example.ps
%/.endtransparencygroup     % transparency-example.ps

% undefining these causes errors/incorrect output
%/.settextrenderingmode /.setblendmode /.begintransparencygroup /.settextknockout /.setstrokeoverprint /.setfilloverprint
%/.currentstrokeoverprint /.currentfilloverprint /.currentfillconstantalpha /.currentstrokeconstantalpha
] def

DELAYBIND not {
.PDF_UNDEF_OPLIST
{systemdict exch .undef} forall
systemdict /.PDF_UNDEF_OPLIST .undef
} if

Youez - 2016 - github.com/yon3zu
LinuXploit