Software Archive
Read-only legacy content
17061 Discussions

fortran_winprint.f90 not working with a printer

kvrichardson
Beginner
1,362 Views
Hello.
In one of my programs I print well to a HP Deskjet but a Ricoh LP1200 just prints out a line of strange dots (jibberish).

Can anyone help me understand how the Ricoh would mis-interpret the standard Windows calls in winprint but HP would do fine?

The online documentation for Ricoh is horrible (apparently the best tech docs are in Japanese on Japanese site).

Thanks,
Keith
0 Kudos
8 Replies
kvrichardson
Beginner
1,362 Views
ooops...I meant to say Ricoh AP2100 not LP1200...thanks.
Keith
0 Kudos
kvrichardson
Beginner
1,362 Views
Interesting...my implementation of fortran_winprint works on HP and Epson but not on Ricoh and Lexmark. I have a feeling it's the Fortran carriage control...I'll try it off.

I found out the Ricoh AP2100 is a large format printer not entirely compatible with Windows calls (MS Access has troubles printing to it, and requires removal of Ricoh driver and installtion of HP Laserjet II/III/4 driver instead).

Any additional info would be helpful.

Keith
0 Kudos
Steven_L_Intel1
Employee
1,362 Views
I don't think this is a Fortran issue. Fortran_WinPrint just calls the Win32 API to do the printing. My guess is that the problem printers don't support bitmap printing properly. Fortran_WinPrint assumes that the printer is bitmap-capable - I'll look at adding tests for that to see if it can detect non-bitmap printers and do something useful with them.

Steve
0 Kudos
kvrichardson
Beginner
1,362 Views
Thanks, Steve. That got me off the hook quite a bit. It's ironic that I'm failing with this customer on this issue...I've spent quite a while working with DOS printer-compatibility issues across all customers, only to find the same thing in a move to Windows (I create a file then call the a winprint-based console print program to print it, using spawnlp under MS Fortran 5.1).

They bought the Ricoh for my users. So far my fortran_winprint print program prints great under Win 95 and 98 to HP Deskjet and an Epson (not sure what model they're using). But it fails with Ricoh AP2100 and with a Lexmark(also not sure what model). They just get a strange black line across the top of the page.

I went to the Ricoh site and it mentioned MS Access printing problems with the AP2100 using MS Access....they suggested using either of the HP Laser ii/iii/4 printer drivers instead...but it didn't work either.

The Ricoh PCL6 printer driver (Postscript driver also available- should I use it?) has the following settings as default under the printer properties "PRINT QUALITY" tab:

Resolution 600 dpi
Edge Smoothing ON
Tone Saver OFF
Graphics Mode VECTOR (raster avail)
TrueType Mode - DOWNLOAD AS TRUETYPE (download as bitmap available)
Use Print Fonts YES
Print All Text as Black NO

It would be useful to know which if any settings above would affect the problem we're having. I plan to suggest to customers to lower resolution to 300 (in case it's a memory issue) and change Truetype to bitmap. Do you suppose any other settings above would apply?

I'll have another look at MS site and newsgroups on this issue and let you know if I find anything. Ricoh online info is very general (i.e. useless).

Thanks,

Keith
0 Kudos
Steven_L_Intel1
Employee
1,362 Views
I don't think printer settings will be an issue. My guess is that it has something to do with the attempt to use a selected font, and that these printers don't support that. There is a "machine font" option in the calls for printing somewhere, but I don't have the time right now to track it down. (I'm going to be in training through the middle of next week!)

You might try, as an experiment, commenting out the call to CreateFont and making sure that hFont remains 0.

Steve
0 Kudos
kvrichardson
Beginner
1,362 Views
Thanks. I searchs on "machine font" and got nothing in help or API. Perhaps you're referring to "system_font" which I found in "choosefont" section of Programming Windows 5th Ed ?

Here is my call to winprint:
iv = Print_Unit (8, Default_Printer=.FALSE.,Fortran_CC=.FALSE., Font="MS Linedraw",Orientation=FWP_ORIENTATION_PORTRAIT)

I modified winprint slightly to give me OEM_CHARSET for MS-Linedraw (added it to declarations and put in new create font call):

font_width=line_width/135

if (Wfont(1:11).ne.'MS Linedraw') then

hFont = CreateFont (0, font_width, 0,0, FW_NORMAL, FALSE,FALSE,FALSE, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH .OR. FF_DONTCARE, Wfont)

else !OEM for line drawing

hFont = CreateFont (0, font_width, 0,0, FW_NORMAL, FALSE,FALSE,FALSE, OEM_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, FIXED_PITCH, Wfont)

ENDIF

I'm posting this in case there is an error in this change to fortran_winprint.

Thanks,

Keith
0 Kudos
kvrichardson
Beginner
1,362 Views
I tried the following on Ricoh to no avail:

line_width = page_width - (2*initial_x)
font_width=line_width/135

hfont=GetStockObject(OEM_FIXED_FONT)
!select it
hOldfont = SelectObject(hdc,hfont)

!get logical font info
iv = GetObject(hfont,sizeof(lfont),loc(lfont))
Font%lfHeight = 0
lFont%lfWidth = font_width
hfont=CreateFontIndirect(lFont)

I'm sorry - I don't remember how to post code with better formatting.....please advise.

Anyway, the font above selected ok and worked on my Canon and HP's, just didn't print on the Ricoh. They switched out the RIcoh thankfully and put in an HP 4V.

But I think the problem with the Ricoh was the PCL6 language it accepts...many places I saw it recommended to move to a HP II/III/4 printer driver on the Ricoh, and I had them try that. But I didn't have them play with the settings.

I probably should have, because Fortran_Winprint didn't work with the HP 4V initially, either...until I had them open the printer properties and turn on "Print Fonts as Graphics" on the Print Quality tab (fyi - that option not available until you select Graphic Quality High and Raster Graphics Mode). None of these are the defaults for that printer.

So settings do matter!

Thanks for the help.
Keith
0 Kudos
kvrichardson
Beginner
1,362 Views
Hi-
In Steve's second response, he says there is a call to a machine font for non-bitmap printers which would correct my problem of no output using fortran_winprint.....can anyone tell me what that is? I tried getting oem_fixed_font with getstockobject to no avail, so I'm hoping there is another way.

Thanks,
Keith
0 Kudos
Reply