Silverfrost Forums

Welcome to our forums

Output to Printer

23 Oct 2014 5:29 #14922

I've been experimenting with PRINTER_OPEN and HTML_PRINTER_OPEN, and after a few hours of experimenting, I have a couple of questions.

  1. Does HTML_PRINTER_OPEN perform the appropriate rendering based on the HTML commands? I don't see that when writing through the Adobe PDF driver, nor when writing directly to either my PS or PCL6 printer driver.

  2. If I'm willing to keep life 'simple' and use PRINTER_OPEN, how do I specify the font size to be used (and by extension, line spacing) and orientation (portrait or landscape)? The latter might be selected at the invocation of the printer driver, which is OK, but the font size default is HUGE!

Thanks in advance, Bill

24 Oct 2014 7:24 #14924

The native ClearWin+ HTML engine uses a subset a a subset of HTML. See ftn95.chm under FTN95->Win32 platform->ClearWin+->Hypertext windows.

As far as I know, you should be able to set the font and font size for printer output but I have not tested this for you.

24 Oct 2014 9:43 #14926

If you happened to have a parallel port and a printer attached to it that wasn't a 'Windows printer', then using OPEN with LPT: works - at least it used to. (Haven't used it since Windows 2000!) It's some time since I had such a printer or even a parallel port.

You then have 3 types of printer options:

  1. Printing HTML, but remember only a subset of HTML is supported and the font control is weak),
  2. Using your printer as a graphics device, which requires you to find its metrics, then position everything on the page. The full range of Clearwin+ graphics is available, so you can mix text and graphics, select fonts etc. This is where you get with functions OPEN_PRINTER@ and OPEN_PRINTER1@ (The OpenGL printer options work in the same way - but I've never tried them).
  3. Using the printer for FORMATted output. This is where you have to use the standard callback PRINTER_OPEN or PRINTER_OPEN1 to a Clearwin+ menu or button, which allows you to associate a Fortran device number with a specific printer (or use the default printer).

In my view, 2 and 3 are a bit topsy-turvy, because unless you have Clearwin+ windows 2 is pointless, and 3 is inaccessible!

SET_PRINTER_ORIENTATION@ sets the initial orientation for the page, but the user can reset this in the printer selection dialog, and your choice cannot be relied upon!

The following is a simple (but awful) example of getting device 99 associated with a printer for FORMATted output.

      PROGRAM PRINT
      INCLUDE <WINDOWS.INS>
      EXTERNAL NULL
      I=WINIO@('%ca[Print]Hello World%2nl%6^bt[Print]',
     &         'PRINTER_OPEN',99,NULL)
      WRITE(99,'('Hello World')')
      CLOSE (99)
      END
      INTEGER FUNCTION NULL()
      NULL = 0
      RETURN
      END

The example uses the standard printer's default font.

Eddie

(But watch the continuation line position of & if you copy the above - it seems to have gained an extra space in front of it).

24 Oct 2014 2:32 #14929

Thanks for the response. I was afraid that it might not be quite what I was looking for. The existing code relies very heavily on formatting via Fortran print codes (i.e. 1,+,0, etc.). I actually have a customer that has maintained a parallel port system with a dot-matrix printer for this software package. But, I want to get past those days!

What I may be forced to do is link to my PDF generator code (C++) and perform the page creation there, then automatically print the resulting PDF (or let the user chose to do it).

Nothing is easy anymore! 😄

24 Oct 2014 2:41 #14930

You can also read this forum post:

Direct printer access from FTN95 program

The example I wrote above follows the Fortran carriage control sequences, I was just too idle to write them. You could get the association between the printer and the device number by having a Clearwin+ sequence like in my example, associating it with a %sc startup code instead of a button.

Eddie

2 Jan 2015 11:36 #15275

This is to close out this thread.

I was able to completely integrate my PDF generation software, and now have a DRIVER method for generating PDF files that the user can later print.

While it has a couple of minor limitations, it works very well and the interface is very simple for FORTRAN formatted output.

Please login to reply.