[FX.php List] [off] Anyone familiar w/ mPDF who could help?

Bob Patin bob at patin.com
Fri Jan 13 13:55:46 MST 2012


Leo,

Thanks for the pointers; what you're saying makes complete sense.

In my case I'm generating a variable called $html, so there's no file to speak of. That being the case, where would I get the values for $filename and $documentFilesize?

Just for grins I added just hte first header line but that didn't get it yet…

Thanks for the help!

Bob


Bob Patin
Longterm Solutions LLC
bob at longtermsolutions.com
615-333-6858
http://www.longtermsolutions.com
FileMaker 9, 10 & 11 Certified Developer
Member of FileMaker Business Alliance and FileMaker TechNet
--
Twitter: bobpatin
Google+: http://www.longtermsolutions.com/plus
AIM: longterm1954
iChat: bobpatin
--
Expert FileMaker Consulting 
FileMaker Hosting for all versions of FileMaker

On Jan 13, 2012, at 2:47 PM, Leo R. Lundgren wrote:

> Yeah, it's exactly what is going on.
> 
> I haven't seen their code and not yours either, so I can't say how they differ, I just know you need to output some HTTP headers to instruct the client to download the file instead of showing the source of it.
> 
> Try doing this to output the file to the client:
> 
> header('Content-type: application/pdf');
> header('Content-Disposition: attachment; filename="' . basename($filename) . '"');
> header('Content-Length: ' . $documentFilesize);
> header('Content-Transfer-Encoding: binary');
> readfile($filename);  // Or whatever is appropriate in your case
> 
> I believe this should allow the client to view the file if that's the default behavior, while if you change the "application/pdf" up there to "application/octet-stream" instead, the client should download the file instead of opening it. Disclaimer; It's been a while since I did this, but that's what I recall. The rationale is that with the latter the client doesn't know it's a PDF, hence doesn't know how to open it, and should therefore download the file.
> 
> 
> 13 jan 2012 kl. 21.34 skrev Bob Patin:
> 
>> Well, that does describe what it's doing, but with their examples you *do* see the output in your browser.
>> 
>> Check out this:
>> 
>> http://ga.longtermsolutions.com/examples/example01_basic.php
>> 
>> Now, go to this site and login using test/test:
>> 
>> http://ga.longtermsolutions.com
>> 
>> click on TEST RESULTS, click SELECT ALL, then click PRINT SELECTED RESULTS.
>> 
>> You'll see it immediately… :)
>> 
>> Thanks for any help…
>> 
>> Bob Patin
>> Longterm Solutions LLC
>> bob at longtermsolutions.com
>> 615-333-6858
>> http://www.longtermsolutions.com
>> FileMaker 9, 10 & 11 Certified Developer
>> Member of FileMaker Business Alliance and FileMaker TechNet
>> --
>> Twitter: bobpatin
>> Google+: http://www.longtermsolutions.com/plus
>> AIM: longterm1954
>> iChat: bobpatin
>> --
>> Expert FileMaker Consulting 
>> FileMaker Hosting for all versions of FileMaker
>> 
>> On Jan 13, 2012, at 2:25 PM, Leo R. Lundgren wrote:
>> 
>>> Just off the top of my head; Could the problem be that you have your generated PDF content, and want to give it to the client, but instead of "getting a file" they see the PDF output right in the browser? A sign of that could be if the junk characters start with "PDF" in the first characters.
>>> 
>>> 13 jan 2012 kl. 21.23 skrev Bob Patin:
>>> 
>>>> I'm trying to use mPDF for the first time; my tests work fine, but when I try to render my actual page, I get trash characters.
>>>> 
>>>> If anyone has experience using it and wants to earn some $$ helping me out, please let me know.
>>>> 
>>>> Thanks,
>>>> 
>>>> Bob Patin
>>>> Longterm Solutions LLC
>>>> bob at longtermsolutions.com
>>>> 615-333-6858
>>>> http://www.longtermsolutions.com
>>>> FileMaker 9, 10 & 11 Certified Developer
>>>> Member of FileMaker Business Alliance and FileMaker TechNet
>>>> --
>>>> Twitter: bobpatin
>>>> Google+: http://www.longtermsolutions.com/plus
>>>> AIM: longterm1954
>>>> iChat: bobpatin
>>>> --
>>>> Expert FileMaker Consulting 
>>>> FileMaker Hosting for all versions of FileMaker
>>>> 
>>>> _______________________________________________
>>>> FX.php_List mailing list
>>>> FX.php_List at mail.iviking.org
>>>> http://www.iviking.org/mailman/listinfo/fx.php_list
>>> 
>>> 
>>> 
>>> -|
>>> 
>>> _______________________________________________
>>> FX.php_List mailing list
>>> FX.php_List at mail.iviking.org
>>> http://www.iviking.org/mailman/listinfo/fx.php_list
>> 
>> _______________________________________________
>> FX.php_List mailing list
>> FX.php_List at mail.iviking.org
>> http://www.iviking.org/mailman/listinfo/fx.php_list
> 
> 
> 
> -|
> 
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.iviking.org/pipermail/fx.php_list/attachments/20120113/f85ca916/attachment.html


More information about the FX.php_List mailing list