[Gambas-user] Printing from GTK

charlesg charles at ...1784...
Sat Apr 5 09:12:51 CEST 2008


As a certified LinKlux specialising in serving 'programme a la paysanne', I
hesitate to offer solutions because I am sure somebody will reply: "you
idiot, why didn't you just...".

Anyway, I have been trying to work around the problem of GTK not printing
(yet!) :)

I reckon I can get enough report control for my database based projects
through HTML (funny that: 'control' and 'html' are not normally used in the
same sentence.). I have generated a basic html file by hand in the sample
although this could be dynamically generated from live data.

I have used htmldoc (www.htmldoc.org, I did sudo apt-get install from Ubuntu
7.10)) to convert this to a pdf and then printed the pdf file with lpr. I
guess you could view the reports from a browser as well. Somebody brighter
than me could probably pipe one shell into the other?

' Gambas class file
PUBLIC hFile AS File

PUBLIC SUB Form_Open()
  
  hfile = OPEN "/home/c/Documents/tfc.htm" FOR OUTPUT CREATE 
  
  PRINT #hFile, "<html>"
  PRINT #hFile, "<body topmargin = '3' leftmargin = '3' marginheight = '3'
marginwidth = '3'>" 
  PRINT #hFile, "<table>" 
  PRINT #hFile, "<tr>" 
  PRINT #hFile, "<td> 1 </td>" 
  PRINT #hFile, "<td> Fred Folly </td>" 
  PRINT #hFile, "<td> 02 / 03 / 2007 </td> "
  PRINT #hFile, "</tr>" 
  PRINT #hFile, "<tr>" 
  PRINT #hFile, "<td> 2 </td>" 
  PRINT #hFile, "<td> Jane Jones </td>" 
  PRINT #hFile, "<td> 05 / 06 / 2007 </td>" 
  PRINT #hFile, "</tr>" 
  PRINT #hFile, "</table>" 
  PRINT #hFile, "</body>" 
  PRINT #hFile, "</html>"
  hFile.Close
  
  SHELL "htmldoc --bodyfont Sans --outfile /home/c/Documents/tfc.pdf
--webpage /home/c/Documents/tfc.htm" WAIT
  SHELL "lpr /home/c/Documents/tfc.pdf" WAIT 
  
END
-- 
View this message in context: http://www.nabble.com/Printing-from-GTK-tp16510279p16510279.html
Sent from the gambas-user mailing list archive at Nabble.com.





More information about the User mailing list