Wouldn't It Be Nice If...

Often abbreviated WIBNI...

Tk had the built-in ability to generate PDF from the text widget?

It would more-or-less negate the need for a printing solution, as our apps could generate PDF and spawn an external program to print. Almost equally compelling would be to be able to take a text widget and convert it to valid HTML+CSS, but I like the idea of a single file PDF more.

escargo 09 Jan 2008 - While being able to generate PDF is useful, being "able to take a text widget and convert it to valid HTML+CSS," would greatly simplify the creation of web page (and potentially web site) editors.

EKB: There appears to be a nice start at Text2PDF. It only does the text, not the formatting, but it seems like a very good place to start.

Martyn Smith: This is exactly the approach I used in my editor [L1 ] using the pdf4tcl library, the code can be viewed/edited from within MSEdit by typing 'pedit PrintFile' and 'pedit PDFNewPage' in the internal tcl console (F12), I think the only changes I made to pdf4tcl were to add the A4R and A3R paper sizes. The printing prints either the whole file or the current selection to a file then starts up the default PDF viewer on windows or the chosen viewer on Linux.

EKB Nice! Nice web site, too. Very straightforward, attractive, and clear layout. Unfortunately, the PDF generation feature didn't work for me (under Windows). It opened a command window, but then it sat there.

Martyn Smith: What did you download ? Try downloading the zip and unzip it to a new directory then run the editor, I just tried the Kit and effectivly there is a problem I will look into it. The editor does not touch the registry and only installs into the MSEditConfig directory (diff.exe, ctags.exe) in the same directory as the Kit/executable. Sorry for the problem.

The problem is using paths/files with spaces (The kit startup defaults to 'Documents and settings') The simple solution is to change the settings to always generate the PDFs in a 'safe' directory. The kit also does not contain the TCL help file. The fix is to change in PrintFile

  eval exec [auto_execok start] [list $fname] &


  exec {*}[auto_execok start] [file attributes $fname -shortname] &

then save as (Patch-PrintFile.mspatch)

I will update this in the next release.