将流转换为PDF

时间:2019-07-02 09:23:15

标签: php xml pdf soap stream

我有一个流文档,我需要将其转换为 PDF

想法是将其流保存为 PDF

我的代码:

$responce = $this->getDocumentContent();//this function returns me the $responce content bellow. 
$documentFolder = $this->getDirectory().'/document/'; //var/www/project/document/
$documentFullPath = $this->getDirectory().'/document/file1.pdf';
$this->_io->mkdir($documentFolder, 0775);//create folder var/www/project/document
$document = fopen($documentFullPath, "w+");//create pdf file var/www/project/document/file1.pdf
fwrite($document, $responce);
fclose($document);

现在使用此代码,我在file1.pdf中很好地创建了var/www/project/document/file1.pdf,但是它是空的!,没有内容,file1.pdf的权重不是0而是{ {1}},但我什么都看不到。我不知道问题出在哪里。

163.2 Ko

$responce =

string(163146) "%PDF-1.4 %???? 1 0 obj << /Type /Catalog /Pages 2 0 R /Metadata 63 0 R >> endobj 2 0 obj << /Type /Pages /Kids [ 01 0 R 8 0 R ] /Count 2 /MediaBox [ 0 0 618 003 ] >> endobj 3 0 obj << /ModDate (D:20190907120701+02'00') /CreationDate (D:20130904150701+02'00') /Title (F:/Data/Composer/0510.IN.PDF) /Subject (NONE) /Author (User: Windows XP/ User) /Creator (PDF/PReS Version: 6.1.1 ) /Producer ([ClibPDF Library 2.02-r1-2] Windows XP) >> endobj 5 0 obj << /Type /Page /Parent 2 0 R /Resources << /Font << /Fcpdf0 30 0 R >> /XObject << /6p 8 0 R >> /ProcSet 7 0 R >> /MediaBox [ 0 0 595 842 ] /CropBox [ 0 0 595 842 ] /Rotate 0 /Contents 6 0 R >> endobj 6 0 obj << /Length 246 /Filter [ /FlateDecode ] >> stream x??QMk?@?'1?bia=?!?L6I7?V??AB??AQ(???_:?T?"$;<vf??7?I??c?(?(?????F??4?E?<L?ku????xs???w*?? ??FGD?AlY?{,???E??-A????u?o?/^^O%|??>???\?T?Y ??iS??5q?t?C2I??q???c>?V?z?8:??C??#???p/?\???0F)k#?1???U?`Sa?????.???PyoY endstream endobj 7 0 obj [ /PDF /Text /ImageC ] endobj 8 0 obj << /Type /XObject /BBox [ 0 0 595 842 ] /Filter /FlateDecode /FormType 1 /Length 17871 /Matrix [ 1 0 0 1 0 0 ] /Resources << /ColorSpace << /CS0 27 0 R /CS1 26 0 R /CS10 27 0 R /CS11 26 0 R /CS12 27 0 R /CS13 26 0 R /CS14 29 0 R /CS15 28 0 R /CS16 29 0 R /CS17 28 0 R /CS18 29 0 R /CS19 28 0 R /CS2 27 0 R /CS20 29 0 R /CS21 28 0 R /CS22 29 0 R /CS23 28 0 R /CS24 29 0 R /CS25 28 0 R /CS26 29 0 R /CS27 28 0 R /CS28 29 0 R /CS29 28 0 R /CS3 26 0 R /CS30 29 0 R /CS31 28 0 R /CS32 29 0 R /CS33 28 0 R /CS34 29 0 R /CS35 28 0 R /CS36 29 0 R /CS37 28 0 R /CS4 27 0 R /CS5 26 0 R /CS6 27 0 R /CS7 26 0 R /CS8 27 0 R /CS9 26 0 R >> /ExtGState << /GS6 25 0 R >> /Font << /TT24 21 0 R /TT25 17 0 R /TT26 13 0 R /TT27 9 0 R >> /ProcSet [ /PDF /Text ] >> /Subtype /Form >> stream x??}i?$????K?l2?@?:gu?F??????r$?im?1k???????E???????;?O???=????????????7?????o????oO??????}???O??uz?????z?O????p=M???4n~??w/??;|????OGw>???>???9???cSn'????b????5????????w??\????????_~????t?w8N??9??~?f}??qxy??????o???????M??????'?Or4|?O????|??y??o???=?= ?y?p??1vx?)??7???on????.??w?????-??K??|y:?w}d??????:???>uv??:?.???y???6?nm{????E0\??????n?????B??ra*??x?t?K^???'??7?i?8???]?p?D}??T??-?lcN???_????Q7h??n??s???n==? ??!? ?@~s??F8??G?0?K??e??ul?3n???g??????6?0?a???$??L?j?W??9~U??{?G?U??9fO?????rL?K[Z??E?!????}T|?yr/?}?+?O???6??um????a??E^?K??P??U:??+?pL??N?Q????^\?{a???[??k?N?t/????K{?Ek_??? ???t??U#??\O;??????????5??~??????? K??O??9?????</?(?*7????u?n?xa?4??rbd??^N?^z??]?7?T????r?f????|Y?ij?

0 个答案:

没有答案