Print Form

jo joaoantonio 21 Mar, 2014
It is possible to create an option to print the form you just filled the User?
Br Breakbeatz 03 May, 2014
where an how could I set some css to my printform?
Could you give me an example please?
{
    var html, css, csss_file, printWin;
    css = \"\";
    css = \"<style type='text/css'>\"+css+\"</style>\";
    css_url = '';
    if ( css_url !== '' ) {
        css_url = \"<link rel='stylesheet' type='text/css' href='\"+css_url+\"' media='print' />\";
    }

Whrer I have to fill in the css-file or direct styles?
Thanks a lot!
Gr GreyHead 03 May, 2014
Hi Breakbeatz,

As a text string here css = \"\";

Or from a file with a url set here css_url = '';

Bob
Br Breakbeatz 03 May, 2014
But how?:-)
could you give me an example?
Gr GreyHead 03 May, 2014
Hi Breakbeatz,

css = ".some_class { border: 1px solid blue; }";


css_url = JURI::root().'some_folder_path/some_file_name.css';


Bob
Br Breakbeatz 04 May, 2014
Hi Bob,
both doesn't work correct and hide the Printbutton...
And I cant print it at this time, the preview is correct in the windows, but if I'll print it, its just a blanc page:
http://www.uptodate-24.de/index.php?option=com_chronoforms&chronoform=Basisformular-Copy
Br Breakbeatz 04 May, 2014
Print works! I forgot to delete something from my tests, but I want to have alle my fields in a horizontal row, like on the webpage, at this time all ist vertical...
Br Breakbeatz 04 May, 2014
Its the old problem, I can't get the same css in the printview like in the form...
Gr GreyHead 04 May, 2014
Hi Breakbeatz,

I don't see a question there?!

Bob
Br Breakbeatz 04 May, 2014
Sorry, you got right.
I can't include the css in the print-view.
If css_url = JURI::root().'some_folder_path/some_file_name.css'; the Print-Btton is gone and I need to give the print-div the global css-style, but it don't work.
Could you take a look on the page?
http://www.uptodate-24.de/index.php?option=com_chronoforms&chronoform=Basisformular-Copy
Max_admin Max_admin 05 May, 2014
In the code you have earlier, just replace "css_url" with the link to your print css file, in order to test that link, you can simply paste it in the browser's address bar!

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Br Breakbeatz 05 May, 2014
Hi Max,
sorry, I don't know which link do you mean. Could you gave me an example, how I'll put the css-link to the link, which I have to copy into the adressbar?
Max_admin Max_admin 05 May, 2014
Ok, first way, please use code like below in a "custom code" action:

$doc =& JFactory::getDocument();
$doc->addStyleSheet( 'http://www.example.com/css/mystylesheet.css', 'text/css', 'print' );


2nd solution, just use a "load CSS" action with a code like this:

@media print {
  form { 
    font-size: 12pt;
    font-color: #000000; 
  }
}


Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Br Breakbeatz 05 May, 2014
I tried all, but the first solution doesn't change anything, the second killed my Print Button...
<?php
$doc =& JFactory::getDocument();
$doc->addStyleSheet( 'http://www.uptodate-24.de/components/com_chronoforms/css/frontforms_tight.css', 'text/css', 'print' );

@media print {
  form { 
    font-size: 18pt;
    font-color: #000000; 
  }
}
$script = "
function printPage2()
{
    var html, css, csss_file, printWin;
    css = \"\";
    css = \"<style type='text/css'>\"+css+\"</style>\";
    css_url = '';
    if ( css_url !== '' ) {
        css_url = \"<link rel='stylesheet' type='text/css' href='\"+css_url+\"' media='print' />\";
    }
    html = '<html><head>'+css+css_url+'</head>'+$(id).innerHTML+'</html>';

    printWin = window.open('', '', 'left=100, top=100, width=600, height=400, toolbar=0, scrollbars=0, status=0' );
    printWin.document.write(html);
    printWin.document.close();
    printWin.focus();
    printWin.print();
    printWin.close();
}
var id;
window.addEvent('domready', function() {
    id = 'angebot_div';
    $('print_angebot').setStyle('visibility', 'visible');
    $('print_angebot').addEvent('click', printPage2);
});
";
$doc->addScriptDeclaration($script);
?>



I know that I'm doing anything wrong, but I don't know what...
By the way: Great support! Thanks a lot!
Max_admin Max_admin 05 May, 2014
Why not simply use the code in the FAQ then and just change this line:

css_url = 'http://www.uptodate-24.de/components/com_chronoforms/css/frontforms_tight.css';

Please follow the code in FAQ since you are using it to add the button as well!

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.