Forum > FV/Textmode IDE
Printing Using the Textmode IDE
Elap:
Having used Turbo Pascal for many years I am quite happy using the textmode version of Free Pascal - but, out of curiosity, is it possible to access my Windows printer by using the Printers unit?
I love learning from manuals but I haven't managed to find anything so far.
Could some kind soul point me in the right direction?
Graeme:
Take a look at the Free Pascal Text IDE (fp.exe) - it has printing support. The FP IDE code is obviously available too, so browse and learn. ;-) The joins of open source software.
Thaddy:
The very basics looks like this and prints to the default printer:
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---program Project2;{$APPTYPE CONSOLE}uses printers;var prnFile:Textfile;begin AssignPrn(prnFile); try Rewrite(prnFile); writeln(prnFile, 'Hello, Printer World'); finally CloseFile(prnFile); end;end.
this also works with a windows printer.
rvk:
--- Quote from: Thaddy on December 07, 2015, 01:00:46 pm ---The very basics looks like this and prints to the default printer:
--- End quote ---
Does this work in FP.EXE ???
Printers.pas is part of LCL.
Is that available to FPC?
(did you try this code in FP.EXE ?)
(we are in the Textmode IDE-subforum so no Lazarus here :))
Thaddy:
@Rik: You obviously didn't try my code (again). >:D
I have a Lazarus installation , so that might be the case, but that unit should not be there in that case, because it is even TP compatible.. I'll have a quick check later.
[edit]
Yes it is LCL. (Which it should not be: it should contain simple text/textfile redirects.)
In that case it should be RTL but I have to check the content. Maybe it is too feature rich.
It is not very difficult to write a printers.pp for the RTL.
Navigation
[0] Message Index
[#] Next page