tags:

views:

96

answers:

2

%PDF-1.7 3 0 obj << /Type /Page /Parent 1 0 R /LastModified (D:20100723054757+08'00') /Resources 2 0 R /MediaBox [0.00 0.00 595.28 841.89] /CropBox [0.00 0.00 1687.40 2386.46] /BleedBox [0.00 0.00 4783.17 6764.77] /TrimBox [0.00 0.00 4783.17 6764.77] /ArtBox [0.00 0.00 4783.17 6764.77] /Contents 4 0 R /Rotate 0 /Group << /Type /Group /S /Transparency /CS /DeviceRGB >> /Annots [ 200001 0 R 200002 0 R 200003 0 R 200004 0 R 200005 0 R 200006 0 R ] /PZ 1 >> endobj 4 0 obj <> stream x��X�v�8}�W�yk�j��獂�I�\B�ˬ��ĭ�m����%��pڡ$�����:��nb �|��o��S9�2�޺h��� �e�8�t�j�7a�L֨��b�Ma�Ӷ�j�u�эp^�V�����&�+�x ���yuvܬ��� X�� ���Wng�}�n<� d����}f^����B��d��j���=��c���<� \����ن_�� ��L+�X.�,�n� ��ieRK�R�I�|��I��|��l��Һ�bn]�ۨp���0I(��t]�S�C\@��F���=H�jnW۵֧�6aG�sr4��fA�g��j�x4M�x��n��la�F��;�D� �*0A#��cm�ng{�n��;�[��,�l�����I��X�)_1x�r���3�?�I�.�����`6¡��� �?jv��Җ�B�á-�ט��[�u����5) ����n� ��7��q|�^��2i�L�+���ɡ 1�-BRq�f����<>I0��m������۴�� �e��/��#������c��nj���:�q�Hq-���ID��?��M�7+xz�0 ���7��?�j0����=��Z|}P�s���w��AZ�� ��>*�#��kd�P��Zx?�ԕD�أ���#o1�t�

This is what i see when i create pdf. I use kohana as php framework. What would be the possible reason why this happens? Also what are the possible solutions to this? Thanks and God Bless..

A: 

This is solved by adding exit() at the end of pdf creation.

Manie
A: 

generating PDF using TCPDF or FPDF with kohana framework may result error because while generating PDF, there are still some HTML code executed by kohana through template controller. ex.

Some_controller extend Template_controller { public function index() { --- }

public function create_pdf() { --- } }

where template controller contain HTML code as your template for all of your webpage, even your page to generate PDF (if you extend from template controller). in this case, like some code above, you have to exclude you function create_pdf(), take it out and make new controller which extend controller (not template).

your code become like this:

Print_pdf_controller extend Controller { public function index() { url::redirect("......"); }

public function print_pdf() { $print = new View("print_pdf"); $print->render(TRUE); } }

denny