{"id":120,"date":"2006-07-11T03:45:29","date_gmt":"2006-07-10T19:45:29","guid":{"rendered":"http:\/\/kenshinjeff.jp\/wordpress\/2006\/07\/11\/interesting-joomla-tips-like-print-and-pdf\/"},"modified":"2006-07-11T03:45:29","modified_gmt":"2006-07-10T19:45:29","slug":"interesting-joomla-tips-like-print-and-pdf","status":"publish","type":"post","link":"https:\/\/kenshinjeff.jp\/2006\/07\/11\/interesting-joomla-tips-like-print-and-pdf\/","title":{"rendered":"Interesting Joomla tips like print and pdf"},"content":{"rendered":"

If you take a look at the default Joomla installation with data, you’ll find that there are links which will allow you to create a “print” page and a “pdf” page easily.<\/p>\n

So using that as a reference, I dug somemore, and found that it is freaking easy to create one with your own components.<\/p>\n

Say for example the url you want to print looks like this:
\nhttp:\/\/localhost\/index.php?option=com_yourcomponent&task=showdetails&cid=12345<\/p>\n

To make Joomla actually show a printable page without the rest of the stuff, your url should look like this:
\nhttp:\/\/localhost\/index2.php?option=com_yourcomponent&task=showdetails&cid=12345<\/p>\n

Easy eh? How about pdf you say?
\nhttp:\/\/localhost\/index2.php?option=com_yourcomponent&task=showdetails&cid=12345 &do_pdf=1<\/p>\n

Why does this work? A closer look at index2.php shows that it does all the standard stuff, takes in some parameters ( $option, $ItemId, $no_html, $act, $do_pdf ), and loads your template’s index2.php if available.<\/p>\n

So technically, you could make Joomla auto print if you wanted to with your own index2.php if you don’t want to bork up Joomla’s code.<\/p>\n

Well anyway, I really had to come up with an auto print in a hurry so I had to edit the original index2.php. So there’s a file you have to replace and this is the url you have to call.
\nhttp:\/\/localhost\/index2.php?option=com_yourcomponent&task=showdetails&cid=12345 &auto_print=1<\/p>\n

Modified index2.php for auto printing<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"

If you take a look at the default Joomla installation with data, you’ll find that there are links which will allow you to create a “print” page and a “pdf” page easily. So using that as a reference, I dug somemore, and found that it is freaking easy to create one with your own components. […]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[22],"tags":[],"_links":{"self":[{"href":"https:\/\/kenshinjeff.jp\/wp-json\/wp\/v2\/posts\/120"}],"collection":[{"href":"https:\/\/kenshinjeff.jp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kenshinjeff.jp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kenshinjeff.jp\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/kenshinjeff.jp\/wp-json\/wp\/v2\/comments?post=120"}],"version-history":[{"count":0,"href":"https:\/\/kenshinjeff.jp\/wp-json\/wp\/v2\/posts\/120\/revisions"}],"wp:attachment":[{"href":"https:\/\/kenshinjeff.jp\/wp-json\/wp\/v2\/media?parent=120"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kenshinjeff.jp\/wp-json\/wp\/v2\/categories?post=120"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kenshinjeff.jp\/wp-json\/wp\/v2\/tags?post=120"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}