I have stored pdf file into database i.e blob type.
Now I wanna display pdf like
$sqll="select * from pdff";
$query=mysql_query($sqll) or die(mysql_error());
$result=mysql_fetch_array($query);
$content=$result['pdf'];
<object data="<?php echo $content;?>" type="application/pdf" style="height:200px;width:60%"></object>
but in browser it shows..
> endobj 6 0 obj << /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] /ColorSpace << /Cs1 7 0 R /Cs2 10 0 R >> /ExtGState << /Gs2 34 0 R /Gs1 35 0 R >> /Font << /F1.0 31 0 R >> /XObject << /Im4 21 0 R /Im1 8 0 R /Im3 16 0 R /Im2 11 0 R /Im5 26 0 R /Im6 32 0 R /Fm3 23 0 R /Fm1 13 0 R /Fm2 18 0 R /Fm4 28 0 R >> /Properties << /Pl2 36 0 R /Pl1 37 0 R >> >> endobj 23 0 obj << /Length 24 0 R /Filter /FlateDecode /Type /XObject /Subtype /Form /FormType 1 /BBox [649 536 669 556] /Resources 25 0 R /Group << /S /Transparency /CS 10 0 R /I true /K false >> >> stream xMŽAƒ0ï}žÀĉmȹ/àÄU+Íÿ¥:(\|˜]ïî etc
and I tried
<object data="<?php echo base64_decode($content);?>" type="application/pdf" style="height:200px;width:60%"></object>
but no use...please help meeee
If your data still in Blob, you need to encode your data using base64_encode().
Please try it
<object data="data:application/pdf;base64,<?php echo base64_encode(content) ?>" type="application/pdf" style="height:200px;width:60%"></object>
I hope the following will do exactly what you want:
header('Content-type: application/pdf');
header('Content-Disposition: inline; filename=name.pdf');
header('Content-Transfer-Encoding: binary');
header('Accept-Ranges: bytes');
#readfile("data:application/pdf;base64,$content");
I know this thread is old but I recently had a similar issue to solve and wrote this quick guide to cover it.
https://medium.com/#alexmoran_19787/display-pdf-from-blob-file-11996146dbc0
Basically Depending on if you addslashes or not when inputing the pdf into the database you can view it by the following
I had this in my controller and passed the info to a php page. Setting the headers and if you addslashes make sure to stripslashes otherwise you will just end up with the raw data or blank screen.
$content = stripslashes($text["file"]);
header('Content-type: application/pdf');
header('Content-Disposition: inline; filename=document.pdf');
header('Content-Transfer-Encoding: binary');
header('Accept-Ranges: bytes');
$this->load->view("administrator/load_pdf", [
"title"=>"Display PDF",
"pdf"=>$content,
]);
This is from the php page.
<object data="data:application/pdf;base64,<?php echo base64_encode($content);?>" type="application/pdf" height="100%" width="100%"></object>
Related
could you help me with this problem?
I am trying to create and download a signed PDF.
Once the generated PDF file exists, I can't sign in because of this error.
"Call to a member function set_signature_certificate() on bool"
in browser and
"Error info at /Users/martinkravec/git/projectname/vendor/ddn/sapp/src/PDFUtilFnc.php:377: PDF version string not found"
in stderr.log.
I am running the following code outside CLI in Laravel 9 with PHP 8.1.9.
config/app.php
in provider:
Barryvdh\DomPDF\ServiceProvider::class,
In aliases:
'PDF' => Barryvdh\DomPDF\Facade::class,
Controller
use PDF;
use ddn\sapp\PDFDoc;
if (!defined('STDERR')) define('STDERR', fopen(__DIR__ . '/../../../storage/logs/stderr.log', 'wb'));
require_once(__DIR__ . '/../../../vendor/autoload.php');
class ClientController extends Controller
{
public function index()
{
$pdf = PDF::loadView('pdf'); // temlate in resources/views/pdf.blade.php
$fileContent = $pdf->stream();
$obj = PDFDoc::from_string($fileContent);
$certificatePath = __DIR__ . '/../../../storage/app/test_certificate.pfx';
$password = '';
$obj->set_signature_certificate($certificatePath, $password);
$signedPdf = $obj->to_pdf_file_s();
return response()->streamDownload(function () use ($signedPdf) {
echo $signedPdf;
}, 'export.pdf');
}
}
When I do
cat ./file.pdf
I get file content starting with:
HTTP/1.0 200 OK
Cache-Control: no-cache, private
Content-Disposition: inline; filename="document.pdf"
Content-Type: application/pdf
Date: Sun, 28 Aug 2022 09:37:03 GMT
%PDF-1.7
1 0 obj
<< /Type /Catalog
/Outlines 2 0 R
/Pages 3 0 R >>
endobj
2 0 obj
<< /Type /Outlines /Count 0 >>
endobj
3 0 obj
<< /Type /Pages
/Kids [6 0 R
19 0 R
]
/Count 2
/Resources <<
/ProcSet 4 0 R
/Font <<
/F1 8 0 R
/F2 13 0 R
>>
/XObject <<
/I1 18 0 R
>>
>>
/MediaBox [0.000 0.000 595.280 841.890]
>>
endobj
4 0 obj
[/PDF /Text /ImageC ]
endobj
5 0 obj
<<
/Producer (���d�o�m�p�d�f� �2�.�0�.�0� �+� �C�P�D�F)
/CreationDate (D:20220828113702+02'00')
/ModDate (D:20220828113702+02'00')
/Title (���D���v�k�y�.�P�D�F)
>>
endobj
6 0 obj
<< /Type /Page
/MediaBox [0.000 0.000 595.280 841.890]
/Parent 3 0 R
/Contents 7 0 R
>>
endobj
7 0 obj
<< /Filter /FlateDecode
/Length 919 >>
stream
I have found the problem.
Instead of reading the PDF file content using
$pdf->stream()
we need to save the file using
$pdf->save($fileName);
which does not generate the first 6 lines of a file and probably some more things causing an error with the version.
Thanks for helping #Peppermintology anyway.
I have tried to use pdftk to fill a PDF form with text and images.
Filling out text fields works fine, but it cant seem to add an image to an PDF form image field.
Is there any way to add an image to a form field with pdftk ? Or any other way to do this?
Heres my pdf: https://easyupload.io/b1emej
Heres my code
$templatePath = '/path/to/pdf/clean.pdf';
$fdfHeader = <<<FDF
%FDF-1.2
%,,oe"
1 0 obj
<<
/FDF
<<
/Fields [
FDF;
$formFields = [
'Text3' => 'Test value',
'Billede4_af_image' => '/path/to/image/test.png'
];
$fdfContent = '';
foreach ($formFields as $key => $field) {
$fdfContent .= "<<\n";
$fdfContent .= "/T\n";
$fdfContent .= "($key)\n";
$fdfContent .= "/V\n";
$fdfContent .= "($value)\n";
$fdfContent .= ">>\n";
}
$fdfFooter = <<<FDF
]
>>
>>
endobj
trailer
<<
/Root 1 0 R
>>
%%EOF;
FDF;
$fdfFilePath = '/tmp/fdffile.fdf';
$fdfContent = $fdfHeader . $fdfContent . $fdfFooter;
file_put_contents($fdfFilePath, $fdfContent);
$pdf = System::exec("pdftk $templatePath fill_form $fdfFilePath output - flatten");
header('Content-Type: application/pdf');
header('Cache-Control: private, must-revalidate, post-check=0, pre-check=0, max-age=1');
header('Pragma: public');
header('Expires: Sat, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
echo $pdf;
It is possible to carry an image via FDF however the aim of Forms Data is to carry simple text objects such as text field entries or other comments. So for an image it needs to be as separate annotation stamp and unsure if that can be attached to a field as such.
Here is a stamp added to the "clean" file ( note it is "under" the field entries)
%FDF-1.4
%âãÏÓ
1 0 obj
<<
/FDF <<
/Annots [2 0 R]
/F (clean.pdf)
/ID [<BBB71BA5F45E7149AAF360F13C5FB61A> <B7FE6051163F4F46B31241A24E573F8B>]
/UF (clean.pdf)
>>
/Type /Catalog
>>
endobj
2 0 obj
<<
/AP <<
/N 3 0 R
>>
/C [1 0 0]
/CreationDate (D:20220127132137Z)
/F 4
/IT /Stamp
/M (D:20220127132137Z)
/Name /image.08000006
/NM (1a68adc3-7c8a-45a2-b661dc794cc8ea96)
/Page 0
/Rect [0 399 412 792]
/Subj (Stamp)
/Subtype /Stamp
/T (K)
/Type /Annot
>>
endobj
3 0 obj
<<
/BBox [0 0 412 393]
/Filter /FlateDecode
/Length 34
/Resources <<
/XObject <<
/Im0 4 0 R
>>
>>
/Subtype /Form
/Type /XObject
>>
stream
xÚ+ä214R0...
... continues lots of binary lines ...
(F8F8F1Â1ŠŽŽQ¾KþM
endstream
endobj
trailer
<<
/Root 1 0 R
>>
%%EOF
The image could be a signature and perhaps the stream be converted to a textual stream for simple text transfer or text templating without binary content.
I'm getting this output when using FPDF library to generate a pdf file.
%PDF-1.3 3 0 obj <> endobj 4 0 obj <> stream
x�U��n�0��<�ˁ�7��8'�!Z���q(U~���!B�8��o�e����l���e�&��l�tʙ��:Cl�k||��p�|K����e�'�-9���B���Wj�$F�����V��t���q��3to��XrlQP�%���n-c�X��B_!Sl�����+��
����B�)װ�I����(m�����HV endstream endobj 1 0 obj <> endobj 5 0 obj
<> endobj 2 0 obj << /ProcSet [/PDF /Text /ImageB /ImageC /ImageI]
/Font << /F1 5 0 R >> /XObject << >> >> endobj 6 0 obj << /Producer
(FPDF 1.7) /CreationDate (D:20151013130538) >> endobj 7 0 obj << /Type
/Catalog /Pages 1 0 R >> endobj xref 0 8 0000000000 65535 f 0000000354
00000 n 0000000542 00000 n 0000000009 00000 n 0000000087 00000 n
0000000441 00000 n 0000000646 00000 n 0000000721 00000 n trailer <<
/Size 8 /Root 7 0 R /Info 6 0 R >> startxref 770 %%EOF
My code:
header("Content-Type: application/pdf");
$pdf = new FPDF();
$pdf->AddPage();
$pdf->SetFont('Arial','B',16);
$pdf->Cell(40,10,'Hello World!');
$pdf->Output();
**when i check the header response this is what i get:**
Cache-Control:private, max-age=0, must-revalidate
Connection:Keep-Alive
Content-Disposition:inline; filename="doc.pdf"
Content-Encoding:gzip
Content-Length:708
Content-Type:text/html;charset=UTF-8
Date:Tue, 13 Oct 2015 17:17:47 GMT
Expires:Thu, 19 Nov 1981 08:52:00 GMT
Keep-Alive:timeout=5, max=100
Pragma:public
Server:Apache/2.4.10 (Ubuntu)
Set-Cookie:PHPSESSID=q20auj7ssdj2c1obhbfqu8ha85; path=/
Vary:Accept-Encoding
I added an exit at the end and it works for me.
<?php
require('12345/1234.php');
$pdf=new FPDF();
$pdf->AddPage();
$pdf->SetFont('Arial','B',72);
$pdf->Cell(40,10,'Hello!');
$pdf->Output();
exit;
?>
The following headers and Output command is what I currently use with FPDF:
// Set a filename
$filename = "AppName_Day_".$day1."_gen_".date("Y-m-d_H-i").".pdf";
// Send headers
header("Content-Type: application/pdf");
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");
header('Content-Disposition: attachment; filename="'.$filename.'"');
header("Content-Transfer-Encoding: binary ");
// Blast out the PDF
$pdf->Output('php://output');
It's worth noting, my use case is a dynamic document that could change at the next download, so I never want a browser to cache it. It's also ALWAYS a download and never viewed in the browser, so the content-disposition: attachment may not apply to your use case.
You need to add an exit(); at the end of your code. taken from https://expressionengine.com/forums/archive/topic/188158/pdf-and-http-headers and tested its working with php 7.2 with codeigniter 4.0
I receive a byte array from a third party source that is a PDF. I need to convert that so a file is downloaded to the user. I've implemented the code below and a download does occur but it's just a blank file.
If I echo the content of $fileToDownload, it is correct (starts with %PDF-, etc) and the data is there. Not sure what I'm doing wrong. Thank you in advance!
//GET CONTENT
$fileToDownload = $file->DownloadSignedDocumentResult;
//START DOWNLOAD
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.basename($fileToDownload));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: '.filesize($fileToDownload));
ob_clean();
flush();
readfile($fileToDownload);
exit;
CONTENT OF echo $fileToDownload
(this file contains sensitive information so I'm only pasting a small snippet of the beginning of the file - hopefully that will be helpful):
%PDF-1.4 %���� 2 0 obj <> stream Dx��a/s�, ��v��"��Z�DƸ�1N�?ש�W� �d����A9���>�ˍ�u��Ҭ����F��;.��0ҷ�B;��s&ݩ%�]GP#Xb���I�䃶���8I�۪IJ����cR��!&�Q?ZG"��u7��Ζ�uY{^����[}���-�E�R.���� �r�u�����<���8b� ��a��9�Óㅅ�)1�IJ��/�� �zb����vD�VN�vD�|���ȓ�A�0��Ͻ�o*m���Z�gz�oH��\���V*;�\�Ӌ�=9��y��c������fT�O�����Kr"����Ԁ��������|��m'��% �!�#F ����|�A�j�)9�������g"���^m�Al�1���Bn�C9ύl�p�o{���]�k��x�5^y֡|щ���/�qقu���)�F��n^ɞQ��6�Pc\e�۲]�8f� '�C[\v��U=���f��uIc�e�!�4^�ϻHCy��I��Gv(%�.I>��T�d!�l��R}�����B6k��=�C#���W.<���c��7���U���BI���! ����G�{�꾼L�2�q �I���Q�;;�P*�z�n��d尌(D�����aύ��7�����g�e���2����f�$��q�*�~+�H;R��t�Ofz����~|(�Jl��� l4�q�:�����w6.Z���ql�Њ+��hO��Ɔ�}<���pEs?�4З� h�07�����.���? ��s�F.�=�Z�Rz�9O�Hp��2��FR��nwH��{Lk�A�l{�f�u��g�p �#;���~���G>_n��P���ߪTJӗ�W����$pYJ<�Es�[�3J4=��/i��T)�(�����U�r�Jn��I��}��g��a�t�Ufw+�|�k�pu��� ���#Oy�J��y�\cOu���0[Y�������l~W|�'3-�.�0�AW�*�|��z�l�e��t8іDZ��Mh4dvS���*j���nHn���*��8w��~_��%�S��j7�xM�l�������t�YD#�� � K�(�!�*��P��[�U��(�#����z1S�����c�.9&�4����v�j�[}��F�%}���XS����X6�㕣�X��lV ��<�M>��C(ڼo��t;���i *ʸ-ua��a$�:��ȶ���}�Mz����&H4���&�'[�o�l�C�|�ēM�c��'m$ ��)S�)+��� ̤�f>T0��x�] �w?w%���+˦�����,������]F�����aڲ�:��b���3f�D#��Kg�kL��5V�Ei^c�G_I���H5)$�Ap,�����:���UӧR�J8~�����|�Ev�cUt=iJ)*��� �j��MOB\���m����c�~Q:~��1����Ev���z�H#�H��F+:G}掺 �f�d��f<��>�$�N�m�;��.s]�/S���?R�3�+���'�����Ң�1{6=��g�-��v���|>��x�V��m"�"��̔QC�.Al��:r?���|2�u������Ħё|?^���,u]48���֫���&T~2�x'5����{�8ϋ��� ����WH���s��d2��1�n���?l�Ed�T���T'��Qm�"Y3ԾiZ�9����/G!$��Mj���)�m{m� ����R4_k7�c�a�����"m q~N2b�rí�%���4�����0�+y���㳯̇O�!���.�F�\qZ0�fSZ� �Α�֩��"���ڐYNJ��{�{W���4ԝC�rg���/�-(C�<�O#��oS�,k�ǡ�*�PXz��o���%PfO0�#���l��t�oyw�a#(���A���!�OK��o��½q�8�DZ�Y�X���E�5���8ê��[5�Ƌ���M�)����t~��w��h�P���u?�� �w�kĵ��]"� �*gV�n�����B���4iw-�29�6}��Se����;v��m����F�[|ӥ�x���؋U��$>M���a��vij�܌ �� v����~]�ocf�<��L�䍞���J#(����nik�ث�R�u�"� N��1�}�y�T�S����r��+�b�(9{7�����x��ux�ݚ}�6� �C�=�����v�X�g���;9t�b_���l��am�ODQ��|���,�o禗�#�hkuݑ����t�d�ڐ��F�~*vh2��[���՞=$X� �pqH�_�7Ƒ�&�O�gǹ��I�]F}[%K�0�YN���Y�}����$���˱��i�~�Jk�*�c+{��Ђ���͉�v��u�9R����$�a�\;�N��쮴Tո���7�SMG|��Î�y�U�]]'Z�,MB��H�g#�&�rc��E0��i�����үmy���ONt��)(���)�I�D��;_� ŭ���N�Ks<(���!hE_�0"� ;U�{e2C�X�+��#|D���"�_#�]�Xu�6,Z��2���wNy�(0�z���4�;pn�<� zwpD����1Clh�f���S!Q��C6��1G��'�P����"(�:��F� |aY�h�wL����o�G�tq�Q��,Hr�%(�Z�� ��J���>ŘŢz� u�j��#kг�z�cl��{�{�xRuJn���6��v�H7v �ocr�r����� ��L��%?���-&[r �ƢyF蒦O����v��a�������է������Y�Z�#��n?�i�f>Fh��B��w����}(�u�zm�~}�����!���&�n���]�- ��h9������na�bi�wS��q n#8��Y~��b=�441_����'c�ʠ=�b��wTj2�N*MO�$�}8["ƫg�6}�E�3�,�KE������_�e����dj�O3�n�7u]�<�m���_���a��.���+��&W�'�8�_�e����b���GI| �\�92c�V�[�������*���Q�{(����a#Ğ�ك���Ѧ�j��Ut�S�� ��FM�F�0C�Lr���uS�h��vI+��zC�n�$&��,#l�H����(naKf��f��� endstream endobj 6 0 obj <> endobj 7 0 obj <> endobj 8 0 obj <> endobj 9 0 obj <> endobj 10 0 obj /Creator <1408C602>/Keywords <>/ModDate <075D8656FF7B0721B23ACA5714F625E800F1D85A3259B0>/Producer <0E06D746811B1741A233CB4F1FE822FD7CB48D0F7613B7E5483D7D79CCF00F2321>/Title <0E0ED714A13B587FF622AC0E55A236F00D8289116D39F6CC2C2B7A5082C2052938040A6AC8D9>>> endobj 12 0 obj <> endobj 13 0 obj <> endobj 32 0 obj <> stream �_ Q�"[�-�c��ozĖn¹#�b\���ו�Sn�i����cv��WS��WXi �hc4ŋ�ҳ� �3��/S(&�a�+����9�J����=�u�^N|4�]F��eBa]a� /M��uL���N����WK��dg�Z�^8gH��zEtqhB o<�ӣd�6�������_�B|������ ���XӑH^�q�7��ަ(���}���h�AN�]���o�<�w���p=7��7*�[����������,�=?�{�-K|l֊��tiÞP��r鍪4[����p�b-��8բ� weZ1k��-{)i���=*l�K���~�<.�8_����h������+x> stream �/�ă��3쫩0j|����KQ�����9D~�0ʛdP�*sa�^�!���j��b|μ���V�?�#�F �G��j� D��[��lE�#W+ȗ���+4��>$ "��������?< � _.�7K�j4���<6�+���+ �Y�h�G�'��=��C�������v�>V� ����Q��i�d���=��|#����m�99#{�߾Q2�^GL��X�w6�T(�'y����������K���Μ7U�*��+�NI1�0��z�#�Wn���i��̫���"��IS�ԅ4���|�\T��)/]��%m��b��A�u�V�p.�pD,z�߯u�O��k�.r}�ʚ�n��U�^�����"��ƙXv���WTd�戽v� � �^[~6Lj�w%X��8��2���s��ڜؐ �vZ�7ga j�"O��v=���i8N^�r�����O>����M �������uC��0W��S�#^��������3���]:�t#Pj�ϳ��*�> stream r�V[tg�u�B�0��l���%�ቚ���XM� ��.�0�Y�y�����Rt.�z[����Ή˨tnWUOH�B��'�"��}SI��!Ǿ�7�~OVK�Cv�ѫ�y�� �����l�#y��$h�y�CJ�kq�rϴ��$mCg+�+������'�Сv��2���ԁ�N�����?<�V�58�%�.���ᕎЁ�(�u�i!Չ��fe��|���eq�<^9��ՙѩ'y�jϦ͏?g��D�Sb���rli� q�<��\�kL[J����#�k��ܥ#��s�ͅ����p�!�ZO�I��{����A���уƒ��A�/t�al�"�����GW���>��+��c���-�V�i�6IW�-\R�֨���l�4��f�~��'�к FuA�ԁ3��� ���;h^\˴L-���+�E�G(?s�y�� |�q�͟L�#]J ��[p��|Z��q[��G��A ��;\�����3Y�c��vc�tk�K��a�t�rm(ˆ����F�ĝRנD�6�efQ��3t��Wn���y*j~�P�vkt��6"� �������� ��1�a׆vX����?=���mv�7,��������/J+��E� �� /�N����UyMk�������k2���/����A��e���"C,��RG����Ӑ��J U�����JH�]Q���� endstream endobj 35 0 obj <>
As I understand, $fileToDownload contains the binary data of the PDF, so you should just
echo $fileToDownload;
and also change:
header('Content-Length: '. strlen($fileToDownload));
I am uploading file(pdf for now) like this: (It is uploading content of file in blob field of mysql)
$organizationModel = new Model_Organization_Object( organizationId );
$myFile = file_get_contents( '../path/to/my/file/filename.ext' );
$organizationModel->setOrganizationProfile( $myFile );
$organizationModel->save();
Now I want to get that file from database and want to download. I doing this in controller's action: (I am aspecting pdf file here therefore it is hardcoded below. But in future I want to download any file from blob field)
$organizationModel = new Model_Organization_Object( $organizationId );
$content = $organizationModel->getOrganizationProfile();
header('Content-Type: application/octet-stream');
header("Content-Length: " . strlen($content) );
header('Content-Disposition: attachment; filename=orgProfile.pdf');
$this->view->organizationProfile = $content;
Now in view file I am doing this:
echo $this->organizationProfile;
But above download process print(echo) the content of file in firbug and does not download file in orignal format. My echo output in firebug is like this:
%PDF-1.3
%����
84 0 obj
<<
/Linearized 1
/O 86
/H [ 541 212 ]
/L 958398
/E 11238
/N 27
/T 956600
>>
endobj
xref
84 7
0000000016 00000 n
0000000486 00000 n
0000000753 00000 n
0000000982 00000 n
0000001102 00000 n
0000000541 00000 n
0000000732 00000 n
trailer
<<
/Size 91
/Info 83 0 R
/Root 85 0 R
/Prev 956590
/ID[<0a8d7035bf08791da591e8cae39b8c49><0a8d7035bf08791da591e8cae39b8c49>]
>>
startxref
0
%%EOF
85 0 obj
<<
/Type /Catalog
/Pages 82 0 R
>>
endobj
89 0 obj
<< /S 151 /Filter /FlateDecode /Length 90 0 R >>
stream
H�b```f``�e`b`�f`#\0�.����\\I~aV$�Xƈ�dǪ����bA�Az�lv1o#�{-����1+�ʪG�����N`�b�
>�-��
\0\0D40
endstream
endobj
90 0 obj
106
endobj
86 0 obj
<<
/Type /Page
/Contents 87 0 R
/Parent 79 0 R
/Resources << /XObject << /img0 88 0 R >> /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] >>
/MediaBox [ 0 0 612 792 ]
/CropBox [ 0 0 612 792 ]
/Rotate 0
>>
endobj�#.\0���
endstream
endobj
88 0 obj
<< /Filter /FlateDecode \0\0\0\0\0\0\0\0\0\\
\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\\
\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\\
\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\\
\0\0\0\0\0\0\0\0\0\0\\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\\
\0\0\0\0\0\0\0\0|n�FT*,�
��
�j#Q��uT~r:}\\�_؛�ҵ��v��ϭ8Q�&� ���T�S�I\"�(>Y�ܾ����}H��aj�3��u�h�T�X�Z�-~��c\'P�^��d�ם�ߔ?����]_�ڿ�z��O]�q�����7寋�|�mN%�����̖T�����o�ߓ�sUzT���m�v8ͯq�
��e]�wS���C~Ta���.��[%!������2x]n~�7�Ϫ����6.����K��;c
}����r�)V��
u���*�7�$c\\���m�~���r��)U{�λ�廳˺��ԟ�R��
��D1L_����WUog�>��/������ߦ��~�%���M���}\'�� ;���y��K`�����O�,�߫����<�,0���;3 #��m�v���aZ=�N�u�J`��dwnm;��.Ѣ�k�n�K1-M�7����H&��ʨ���s�C?��
�}Z�1����c�(0�q�_1��7�%���G7U/��h9I������S�Q��4nc�Lq��H6��;�꺒c(/O��2�٫�-�*_����%�I؏/?�I�o����ô�k��<����q��\'��]v�\"��+�˗ݯ�,��ɏ�qxgk�\\\\�6���7��Y���.G��ҽY��8��.��*���M_��J�hu1����z��W�o_��F�/���s�:�Y~��>0�g\\E�l�K5e���&L�/����k$����{ں:\\>�̥Fs?-��l�>c�亪o���Λ�9�V+�2;��}q�4
�zS�|u�A`dK���n~�sΛ��K�hiY�j��#p���S�M\\���0P2䗶\\*�m+?L5Er����[W�>9|�̑�iY�u�j�M�_���n&��7O�f��s��z`.`�,W��#�l��n���s�՛\'�����=��&#�z�M7_����s���x��y�
��u�p�G���0ͨe�G���۸8]{�䓷N�1}��}~Q�[)�XF��_��*? p7iQ����M�(�l�����������f��6����*��Ų;#~\\k�i��w_��*�#�Ւ�^�j�\\�L��/�}�Y�[��V��t~�w�n��a���m�O�(.�n;��ji:��W�ZnQ[9�n=�^��sE9��;�.��u3\"ږ��<�Ļ��y8�<H���g��u��\\�q��Ȥ71p�U��}ם��f`�Y��m3b*C�t{�SX��7m<��6��8K��[Qs��&_��(M��:�Z���W��Հ��W寚
��4d��4�Aڔ�ɪ�lw�e�d�>�
�pCV��h�ŜS�Z�T��4�NӴ,�� �8=-�%ߜ��4�p�a��~��R눥L芈�=J��j}��ʺ��,�(�x����
�]��l�)L��� I8eG#r�dC��;�/C���l���rm�ɽ��͆��e�6�M��fP�4�r��)�!�\\sڹ�?{��!cN��h�֗>�� ��o>��m�dO=&<ɻ�P��xΔ=�͌CC?�M��W[ϟ�v<���S14�����\\C�Z
��g��ݡq:�ǔ�C�k�vc�K�;��\"Y͙t�r]��G�z����w���rӹ����ަ0������e�:��/f�*^�W�Q8WsN��9}*ۥ|��~x)�N�=6J�l����M�b��Ƿ���M45�C�k]��r�uߍ�����r
]
reponse headers in firebug:
Date Thu, 15 Apr 2010 06:21:03 GMT
Server Apache/2.2.11 (Ubuntu) PHP/5.2.6-3ubuntu4.2 with Suhosin-Patch
X-Powered-By PHP/5.2.6-3ubuntu4.2
Expires Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma no-cache
Content-Length 65535
Content-Disposition attachment; filename=evidence.pdf
Keep-Alive timeout=15, max=71
Connection Keep-Alive
Content-Type application/octet-stream
Can someone help that how to download file or I am doing something wrong with uploading process. setOrganizationProfile() and getOrganizationProfile() function are created by our team which are working fine while storing/getting data to/from database.
Thanks
Ok, I think your problem is that you're using AJAX to download file.
It's not possible to download file using AJAX (or rather - JS) in a normal way. You know, there's too big hole for exploits to allow that (I think so) - anyway there's no such possibility.
There are workarounds though. One of them is creating hidden iframe dynamically on the page and then changing its location to your download script. Then you're not using JS to download, but plain browser capabilities.
Another way is described on this page:
http://www.filamentgroup.com/lab/jquery_plugin_for_requesting_ajax_like_file_downloads/
Mybe it'll be a help for you.
You want the Content-type to be application/pdf not application/octet-stream. That will render the pdf file rather than display the 'source' of it.
Cheers