1. Printing on preprinted forms

Hello everybody, I am not an Euphoria user (yet). I have developped with a windows only language a data centric application that prints out on pre printed forms. I need to rewrite the application with a simple fast multi platform open language and I am looking around for such a language. Tcl/Tk fits the bill but is too slow. Euphoria seems to have all that I need: the database, the user interface, the ease and the speed but I have not seen how to format and print a report. I need to print in the system printer text variables to specific x y position in a simple way. Can anyone pont me in the right direction? Thanks

new topic     » topic index » view message » categorize

2. Re: Printing on preprinted forms

Hi,
I have done something similar in the past; I had to create the page as a large sequence and write it out.
Not difficult, but tedious because you have to keep track of the number of lines per page and then do
the writing of new report headers per page. And if your report was like mine, the footer of the report
had totals too. I can dig that code out, clean it up and post it here if you want?
There may be better examples from others on the forum.
Regards,
Alan

new topic     » goto parent     » topic index » view message » categorize

3. Re: Printing on preprinted forms

Thank you for the offer. Certainly if yo could send me the code it would be quite an help. giancarlo

new topic     » goto parent     » topic index » view message » categorize

4. Re: Printing on preprinted forms

I had a similar requirement some years ago, and produced an include file called GrPrint.ew which is in the User Contributions. It allows you to print at defined positions, attitudes, font, whatever. All sorts. You can define the units as inches or millimetres or even percentage, etc. It gets the printer parameters from Windows. So it won't work with Linux...

It includes a demo program to show how it all works. It was done in 2005 for Euphoria 3 but I hope that it will still work. Needs Win32Lib, as I used it with Judith Evans IDE (called EuVIDE). I use this library all the time for printed outputs. But then I still use Eu3!

Andy

new topic     » goto parent     » topic index » view message » categorize

5. Re: Printing on preprinted forms

Hi, I could not find my code - but here is how I did it, if memory serves :)
The included file I sill have, see below.

include win32lib.ew   
include printer.e    -- printer support, Irv Mullins version 
sequence sw_ver = "1.6" 
sequence header, s1, doc  
object result 
result = getPrinter()  -- dialog, select printer 
if length(result) = 0 then 
         return              -- dialog cancelled 
end if 
header = {} -- ensure empty header to start with 
header = append(header," ") 
s1 = "                             <<<< Program title here " 
s1 = s1 & " v" & sw_ver & " >>>> " 
header = append(header,s1)  
-- loop here adding content to sequence "doc"  
-- finally, send the data to the printer 
printDoc(header, doc, "document title here") 
result = endDoc()    -- must finish print with endDoc   
 
 
 
-- included printer.e  Irv Mullins 
global integer printErr, pageNo 
global constant TRUE = 1, FALSE = 0 
 
---------------------------------------------------------- 
global function printPage (sequence header, sequence doc) 
---------------------------------------------------------- 
integer pageY, fontY, posY 
object result 
 
if length(doc) = 0 then -- nothing left to print 
   return {} 
end if 
 
if not startPage() then -- can't access printer 
   printErr = True 
   return {} 
end if 
 
------------------------------------------------------------ 
-- use Win32Lib routines to determine size of font and page 
----------------------------------------------------------- 
 result = getFontSize(Printer)   -- returns font {width, height} 
 fontY = result[2] 
 result = getSize(Printer)  -- returns page {width, height} 
 pageY = result[4] 
 posY  = 0   -- set current print position to top 
 
------------------------------------------------------------ 
--Insert the current page number into fhe header (line 1) 
--and prepend the header to the (remaining) doc text 
------------------------------------------------------------ 
 
for i = 1 to length(header) do 
    setPenPos(Printer, 0, posY)  -- locate to beginning of next line 
    wPuts(Printer,header[i]) 
    posY += fontY 
end for 
 
--------------------------------------------------------- 
--Print lines until end of page or end of document 
-------------------------------------------------------------- 
while TRUE do    -- print a line 
 
  if length(doc) = 0 then  -- nothing left to print 
    setPenPos(Printer,0,pageY-fontY) -- to end of page 
    wPuts(Printer,sprintf("Page number %d",pageNo)) 
    pageNo += 1 
    return doc 
  end if 
 
  if posY + fontY +fontY > pageY then 
     setPenPos(Printer, 0, pageY-fontY) 
     wPuts(Printer,sprintf("Page number %d",pageNo)) 
     pageNo +=1 
     if not endPage() then 
        if message_box("Printer problem","Print Error",MB_ICONERROR) then 
        end if 
     end if 
     return doc 
  end if 
 
  setPenPos(Printer, 0, posY)  -- locate to beginning of next line 
  wPuts(Printer,doc[1])  -- print the first line 
  doc = doc[2..length(doc)] -- remove the printed line 
  posY += fontY   -- add the font height to the current position 
 
end while 
 
if not endPage() then -- endPage sends formfeed 
   printErr = True 
end if 
 
return doc  -- return remaineder of document 
end function 
 
---------------------------------------------------------------------------- 
global procedure printDoc (sequence header, sequence doc, sequence jobname) 
---------------------------------------------------------------------------- 
pageNo = 1  -- reset for new document 
 
if length(doc) = 0 then -- nothing to print 
   return 
end if 
 
if not startDoc(jobname) then -- show printer dialog 
   printErr = TRUE 
end if 
 
while length(doc) > 0 do -- more left to print? 
 doc = printPage(header,doc) 
end while 
 
if not endDoc() then -- close printer 
  printErr = TRUE 
end if 
 
end procedure 
new topic     » goto parent     » topic index » view message » categorize

6. Re: Printing on preprinted forms

Sorry for the delay. I was out of town. Thank you for the support. I will use your suggestion. I have found the missing file in the archive. Thank again

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu