1

Trying to remove html elements when I copy paste in Tinymce. This code below removes html from web browsers, but it doesn't work when I copy paste text from PDF files. How do I remove junk from PDF files?

<script>
    tinymce.init({
    plugins : 'paste',
    paste_as_text: true,
    paste_remove_styles_if_webkit: true,
    paste_enable_default_filters : true,
    paste_block_drop : false,
    paste_retain_style_properties : "none",
    paste_strip_class_attributes : "all",
    paste_remove_spans : true,
    cleanup_on_startup : true,
    fix_list_elements : false,
    fix_nesting : false,
    fix_table_elements : false,
    paste_use_dialog : true,
    enter code here`  paste_auto_cleanup_on_paste : true,

  paste_preprocess : function(pl, o) {
            // Content string containing the HTML from the clipboard
            var str = o.content;
            var ta = document.createElement("textarea");
            ta.innerHTML = str.replace(/</g,"&lt;").replace(/>/g,"&gt;");
            o.content = CleanWordHTML(ta.value);
 },
 paste_postprocess : function(pl, o) {
}

});
</script>
Maca
  • 1,659
  • 3
  • 18
  • 42
  • what gets inserted if you insert pdf conent? can you show us, what o.content holds then? – Thariama May 09 '14 at 11:36
  • I use this pdf file as sample http://partners.adobe.com/public/developer/en/xml/AdobeXMLFormsSamples.pdf and I copy paste the title – Maca May 09 '14 at 12:22
  • The pasted result is '

    Adobe PDF/XML Architecture - Working Samples

    '
    – Maca May 09 '14 at 12:23
  • have a look at this SO thread: http://stackoverflow.com/questions/4122451/tinymce-paste-as-plain-text/4122969#4122969 – Thariama May 09 '14 at 13:32

0 Answers0