NetTalk Central

Author Topic: Printing HTML created with TinyMCE  (Read 7521 times)

kingja

  • Sr. Member
  • ****
  • Posts: 261
    • View Profile
    • Email
Printing HTML created with TinyMCE
« on: September 09, 2012, 05:51:48 PM »
Bruce,

     I have started a Jobs Database with NT 6.44.  I allow employers to create a job description and Job Seekers to enter resumes, both using TinyMCE.  This works very well and the HTML documents are stored in a large string.
     I now want to allow Job Seekers to search job listings, view the HTML document and print if desired.  I saw in another post that a way to do this might be to use a new NetWebPage procedure and pass the stored HTML to this procedure.  I should be able to call this procedure by URL and open in a "_blank" window.  The user should then be able to print from the browser print button.
     So, how would one pass the HTML to the new procedure?  Also, I would appreciate other suggestions on how to accomplish this.

Thanks,

Jeff King

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Printing HTML created with TinyMCE
« Reply #1 on: September 09, 2012, 10:07:36 PM »
Hi Jeff,

>> I now want to allow Job Seekers to search job listings,

sounds like a browse (on the "non html fields")

>> view the HTML document [and print if desired].

Let's concentrate on the "view" part. The user can obviously print any page from their browser so the print part is superfluous. If the page is well laid out they can obviously print it.
 
Given that the HTML is stored in a string, I would probably make a form and just put the string on it as a display field.

Cheers
Bruce

ianburgess

  • Full Member
  • ***
  • Posts: 119
    • View Profile
    • Email
Re: Printing HTML created with TinyMCE
« Reply #2 on: September 09, 2012, 11:43:31 PM »
What if you wanted the formatted HTML to be part of a PDF report?

kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll
Re: Printing HTML created with TinyMCE
« Reply #3 on: September 09, 2012, 11:56:47 PM »
you can get 3rd party tools that convert HTML to PDF - just google HTML to PDF. Most have a time limited free version so you can test.

ianburgess

  • Full Member
  • ***
  • Posts: 119
    • View Profile
    • Email
Re: Printing HTML created with TinyMCE
« Reply #4 on: September 09, 2012, 11:59:02 PM »
Thanks. I was actually thinking along the lines of creating a standard Clarion report which contains a HTML text field.

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Printing HTML created with TinyMCE
« Reply #5 on: September 10, 2012, 05:20:56 AM »
standard clarion reports don't have access to an HTML control. They can do RTF, but then you'd need an engine to convert the html to RTF.

cheers
Bruce

kingja

  • Sr. Member
  • ****
  • Posts: 261
    • View Profile
    • Email
Re: Printing HTML created with TinyMCE
« Reply #6 on: September 10, 2012, 09:09:19 AM »
Bruce,

     I want to have this look like a report, with no page header, footer, menu etc. so I thought a NetWebPage would be better.  On the browse, AfterBrowseRowClicked, I try to set a session variable as follows:

p_web.SSV('HTMLData', pos:position_description)

The position_description field contains the HTML code.  Then in the XHTML tab of the NetWebPage, I included <!-- Net:s:HTMLData -->

I call the NetWebPage procedure from the form Tab, advanced button (manual URL) with a target of _blank.  The page appears but there is no HTML displayed.
I explicitly set the HTMLData variable then it does show on the new page.  So I think I need help with the structure od the SSV method.  I have tried using a GetValue and GSV for the pos:position_description field but no luck.  Any suggestions?

Thanks,

Jeff



Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Printing HTML created with TinyMCE
« Reply #7 on: September 10, 2012, 09:23:53 PM »
>> On the browse, AfterBrowseRowClicked, I try to set a session variable

that's too late. The button has already been clicked by the time this code runs.

AND - at the point the row is selected, pos:position_description has no value. So it doubly won't work.

Rather you should tick on "include row id" for the button.

Then in the called procedure (the page) the row id of the browse will be in the parameter list. So you can load the whole record from there. And then include the field you want.

Cheers
Bruce

kingja

  • Sr. Member
  • ****
  • Posts: 261
    • View Profile
    • Email
Re: Printing HTML created with TinyMCE
« Reply #8 on: September 11, 2012, 06:44:37 AM »
Bruce,

     I can't find where I should tick on "include row id" for the button.  Where is this set?

     Also, is it possible to hide all but the preview and print buttons on the TinyMCE editor?  If so, I can use the editor to display the position description.  The user will not be able to do any editing but could view and print. 

Thanks,

Jeff

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Printing HTML created with TinyMCE
« Reply #9 on: September 11, 2012, 06:52:49 AM »
Hi Jeff,

I think I'm not completely with you.

What "trigger" are you using for the user to print? ie do they press an "in-row" button to go to the printable page?

cheers
Bruce

kingja

  • Sr. Member
  • ****
  • Posts: 261
    • View Profile
    • Email
Re: Printing HTML created with TinyMCE
« Reply #10 on: September 11, 2012, 08:14:01 AM »
Bruce,

     The "trigger" is what I'm struggling with.  I have not experimented with an in-row button yet.  Perhaps that is what I want but I'm not sure.
     I have HTML stored in a field, created with the TinyMCE editor.  I want to get this HTML to a browser so that it can be viewed and/or printed.  As you mentioned in an earlier response, the print part is easy, once the page is displayed in the browser.   When the page displays, I want it to appear like a pop-up, over the main application.  Then once viewed or printed, this page goes away and I'm back at my NT application.
     The TinyMCE editor has a preview button and a print button, among many others.  The preview button causes a smaller browser window to open over the main app, displaying the HTML contents of my field.  Thus it is like a report preview, showing the "report" and all its formatting, etc.  This smaller browser window has no tool bars, menus etc.  The TinyMCE print button sends the HTML contents directly to a printer.  I would like to duplicate this preview/print functionality. 
     Ideally I would like to do it via the templates but if possible, perhaps this can be done by modifying the TinyMCE editor tool bar/menu so that only the print and preview buttons are available.
     I think the best method is to get the HTML contents of my field to a new smaller browser window, with all the normal menus etc. displayed.  Calling this from an in-row button would do nicely.  Then the user can choose to print at this point.  I hope this helps. 

Thanks,

Jeff






kingja

  • Sr. Member
  • ****
  • Posts: 261
    • View Profile
    • Email
Solved - Re: Printing HTML created with TinyMCE
« Reply #11 on: September 11, 2012, 10:58:10 AM »
Bruce,

     After reading your responses and a few older postings, I think I have a solution.  I added an in-row button with an action set to "other".  This turned on the option to "include row ID".  I call my NetWebPage via a URL with a target of "_blank".  In the NetWebPage Procedure setup embed, I use the passed Row ID to directly access the file and get the contents of the Position_Description field.  I place this data into a session variable (HTMLData) and then call this session variable in the XHTML tab of the NetWebPage procedure.  Note that I use <!-- Net:x:HTMLData --> to have the HTML code from the field display properly.
     This works great and I now have the HTML in the field, displayed in a new browser tab.  The user can read and then print if desired.
     There are a few minor issues with TinyMCE in IE 9 and I'll post these questions on another thread.  But for now I'm a happy camper!  Thanks for all the help.

Jeff