This topic is locked
[SOLVED]

 print from view page

9/17/2017 10:25:43 AM
PHPRunner General questions
loveuppal author

Hi I have added a button on view page which I want to redirect to that record's print page. how can i do that?
i tried adding ........_print.php?printid1=2 but no luck
here is a screenshot
https://www.flickr.com/photos/151482029@N04/shares/88QmWj

admin 9/18/2017

What if you just print this View page?

loveuppal author 9/18/2017



What if you just print this View page?


Then all the buttons and controls would also gets printed which is not required. Is there anyway to access a print page from view or edit or add page?






admin 9/18/2017

Add Custom CSS that hides buttons and other View page stuff while printed. See good examples at https://benfrain.com/create-print-styles-using-css3-media-queries/
Another option is to teach printer friendly page understand parameters passed via URL. Most likely you will need to use 'Print page: Before SQL Query' event for this purpose.

loveuppal author 9/19/2017



Add Custom CSS that hides buttons and other View page stuff while printed. See good examples at https://benfrain.com/create-print-styles-using-css3-media-queries/
Another option is to teach printer friendly page understand parameters passed via URL. Most likely you will need to use 'Print page: Before SQL Query' event for this purpose.


thanks I like 2nd option, however can you guide me with sql query on printer friendly page. does printer friendly page has getcurrentrecord() feature?

admin 9/19/2017

There is no such thing as getcurrentrecord() on printer-friendly page.
You need to read parameters from the URL and modify WHERE clause (strWhereClause variable) so it only points to that single record. When you proceed to this event in PHPRunner in Event Editor you can find more info about parameters.

loveuppal author 9/19/2017



There is no such thing as getcurrentrecord() on printer-friendly page.
You need to read parameters from the URL and modify WHERE clause (strWhereClause variable) so it only points to that single record. When you proceed to this event in PHPRunner in Event Editor you can find more info about parameters.


Got it thanks after 2 hours of various combinations
this is what i did
get current record on view page from button

save it in result[txt]

set is as a session variable

then over other printer friendly page "before sql query" - $strWhereClause = "id = ".$_SESSION["your_variable"];