Link to home
Start Free TrialLog in
Avatar of lusfernandos
lusfernandos

asked on

tinymce printing with pagebreak

Hi,
  I am using the tinymce component to edit/print; and I am trying to print a document with a pagebreak and for some reason I am not able to...
  I browse the internet and found some people with a way to do pagebreak, however it is not working for me. ( http://stackoverflow.com/questions/2969317/tinymce-and-printing-with-page-breaks )
  The solution was to add: <div style=\"page-break-before: always; clear:both\"/></div> in the configuration for pagebreak.

My output is:
 
<p>oi</p>
<p><DIV style="page-break-after:always"/>Ola</p>
<p><DIV style="page-break-after:always"/>Outra</p>

Open in new window


My configuration for tinymce is this one:
  The important configurations here are:  
      :pagebreak_separator => "<DIV style=\"page-break-after:always\"/>",
      :plugins => %w{... pagebreak ...}
 
 
def tiny_mce_options(image_list,user_options={})
    options = {:theme => 'advanced',
               :mode => "textareas",    
               :browsers => %w{msie gecko},
               :relative_urls => false,
               :remove_script_host => true,
               :document_base_url => "http://#{request.host_with_port}",
               :pagebreak_separator => "<DIV style=\"page-break-after:always\"/>",               
               :theme_advanced_toolbar_location => "top",
               :theme_advanced_toolbar_align => "left",
               :theme_advanced_statusbar_location => "bottom",
               :theme_advanced_resizing => true,
               :theme_advanced_resize_horizontal => true,
               :theme_advanced_resizing_min_width => 620,
               :theme_advanced_resizing_max_width => 620,
               :theme_advanced_buttons1 => %w{save newdocument preview print separator undo redo | search replace | cut copy paste pastetext pasteword separator tablecontrols},
               :theme_advanced_buttons3 => %w{formatselect fontselect fontsizeselect bold italic underline strikethrough separator justifyleft justifycenter justifyright justifyfull separator forecolor backcolor separator bullist numlist help},
               :plugins => %w{noneditable safari pagebreak style layer table save advhr advlink emotions inlinepopups insertdatetime preview searchreplace print contextmenu paste directionality fullscreen noneditable visualchars nonbreaking xhtmlxtras},
                             }
    if (image_list.present?)
      options[:external_image_list_url] = image_list
      options[:theme_advanced_buttons2] = %w{blockquote outdent indent  ltr rtl sub sup cleanup removeformat | image link unlink insertdate inserttime charmap emotions advhr pagebreak separator insertlayer moveforward movebackward absolute visualaid separator code styleprops fullscreen}
    else
      options[:theme_advanced_buttons2] = %w{blockquote outdent indent  ltr rtl sub sup cleanup removeformat | link unlink insertdate inserttime charmap emotions advhr pagebreak separator insertlayer moveforward movebackward absolute visualaid separator code styleprops fullscreen}
    end
    # the user options will prevale against default.
    logger.debug "Options #{user_options}"
    options.merge!(user_options)
    logger.debug "Options #{options}"

    return options
  end

Open in new window



Please help me.
ASKER CERTIFIED SOLUTION
Avatar of mreuring
mreuring
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of lusfernandos
lusfernandos

ASKER

There still a problem with tinymce ...