aiyou Posted December 26, 2008 Share Posted December 26, 2008 Hello. I'm a newby to PHP, but manage to follow existing code pretty well. So, I'm not a developer, but can muddle my way through things. Here's what I would like to accomplish: I have an OSCommerce site, and I'm looking to streamline some functionality. I have packing slips and invoices which I typically print. However, on occassion, I generate a PDF for emailing. I would like to have a a unique filename generated, so I don't have to manually rename the page during the Print To PDF dialog. Something like: PackingSlipOrderNo-YYYYDDMM (current date).pdf I'm using CutePDF, and this defaults to the TITLE value. Thanks in advance. --Rob Quote Link to comment https://forums.phpfreaks.com/topic/138489-solved-print-to-pdf-dynamic-file-name/ Share on other sites More sharing options...
Mchl Posted December 26, 2008 Share Posted December 26, 2008 CutePDF is not a PHP application. It's not actually a web application from what I see. It seems to be a Windows app, that installs as additional printer and allows users to 'print' PDF files. Quote Link to comment https://forums.phpfreaks.com/topic/138489-solved-print-to-pdf-dynamic-file-name/#findComment-724109 Share on other sites More sharing options...
aiyou Posted December 26, 2008 Author Share Posted December 26, 2008 Thanks...I was thinking that this might have beens something that was inherited from the page itself, and therefore something that I could modify. I'll pose the same question out on a CuteFTP forum, and see if they have any suggestions. Quote Link to comment https://forums.phpfreaks.com/topic/138489-solved-print-to-pdf-dynamic-file-name/#findComment-724115 Share on other sites More sharing options...
Mchl Posted December 26, 2008 Share Posted December 26, 2008 Does it take TITLE value, as in page title (the one that is displayed in your browser's title bar)? If so, then yes, you could affect it. Quote Link to comment https://forums.phpfreaks.com/topic/138489-solved-print-to-pdf-dynamic-file-name/#findComment-724116 Share on other sites More sharing options...
aiyou Posted December 26, 2008 Author Share Posted December 26, 2008 I've tried modifying Title (i.e. MySite) so that it displays something like MySitePackingSlip0001. That value now displays on the browser, but when I select File-->Print, and select the CutePDF printer, it defaults to a file name of just MySite. I was hoping that it was just another attribute in the page that wasn't being set.. Quote Link to comment https://forums.phpfreaks.com/topic/138489-solved-print-to-pdf-dynamic-file-name/#findComment-724118 Share on other sites More sharing options...
Mchl Posted December 26, 2008 Share Posted December 26, 2008 This might be something along these lines. Check for other places in your HTML where MySite is present. Trial and error... maybe will give you results. Quote Link to comment https://forums.phpfreaks.com/topic/138489-solved-print-to-pdf-dynamic-file-name/#findComment-724119 Share on other sites More sharing options...
aiyou Posted December 26, 2008 Author Share Posted December 26, 2008 With a bit more playground time, i found an answer... The print to file name was indeed coming from the Title value. However, my Title included the ".com" extension. So, while I was passing in MySite.comPackingSlip, the value populated in the filename dialog box only up to the point of the decimal/period. I would like to clean up my code a bit, so that it is more dynamic for others, but for now, the following works with a bit of hardcoding <title>MySitePackingSlip<?php echo (int)$oID; ?></title> Thanks for taking the time to provide some feedback, as it ended up sending me in a workable direction....just needed someone to bounce it against, I guess... --Rob Quote Link to comment https://forums.phpfreaks.com/topic/138489-solved-print-to-pdf-dynamic-file-name/#findComment-724144 Share on other sites More sharing options...
Mchl Posted December 26, 2008 Share Posted December 26, 2008 Good work. Glad I could poke you in general direction Quote Link to comment https://forums.phpfreaks.com/topic/138489-solved-print-to-pdf-dynamic-file-name/#findComment-724148 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.