Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Connecting to printer

15 views
Skip to first unread message

SirJohn

unread,
Dec 16, 2009, 10:46:53 PM12/16/09
to
I just moved to Windows 7, which means that I now connect to my
printer via a USB port instead of a serial port. In those FPC
programs which use the printer I changed InitPrinter('LPT1') to
InitPrinter('USB001') however, everything I print is now going to a
disk file named USB001 instead of to the printer. What else do I need
to get this working?

Marco van de Voort

unread,
Dec 17, 2009, 4:20:02 AM12/17/09
to

Which FPC are you using on windows 7? Could be one of the following three
editions: go32v2/win32/win64 ?

Note that go32v2(dos) is not supported/recommended on NT based windowses
(NT4/2k/2k3/xp/vista/w2k8/w7).

Zaphod Beeblebrox

unread,
Dec 17, 2009, 8:00:20 AM12/17/09
to

"SirJohn" <conte...@aol.com> wrote in message
news:dff19abd-9e4d-40c0...@j14g2000yqm.googlegroups.com...

Make sure the printer is shared, and then use the following command to
redirect LPT2 to the printer:

net use LPT2: \\computername\printername /persistent:yes

Replace 'computername' with your computer name, and 'printername' with
the share name of your printer. After you've run the command, you
should be able to use InitPrinter('LPT2') in your program.

BTW, you want to use LPT2 since from what I've read, if the printer
port actually exists, Vista and Windows 7 won't let you redirect to
it.

Hope this helps.

--
Zaphod

Arthur Dent, speaking to Trillian about Zaphod:
"So, two heads is what does it for a girl?"
"...Anything else he's got two of?"


SirJohn

unread,
Dec 27, 2009, 10:35:29 PM12/27/09
to
On Dec 17, 4:20�am, Marco van de Voort <mar...@stack.nl> wrote:

I am using FPC 2.2.4 for i386.

SirJohn

unread,
Dec 27, 2009, 10:58:38 PM12/27/09
to
On Dec 17, 8:00�am, "Zaphod Beeblebrox"
<Zaphod.Arisztid.Beebleb...@gmail.com> wrote:
> "SirJohn" <contest...@aol.com> wrote in message

There is no local network involved. My printer is connected directly
to my PC. I tried that NET command, but it was not recognized.

Marco van de Voort

unread,
Dec 29, 2009, 6:21:29 AM12/29/09
to
On 2009-12-28, SirJohn <conte...@aol.com> wrote:
>> Which FPC are you using on windows 7? Could be one of the following three
>> editions: go32v2/win32/win64 ?
>>
>> Note that go32v2(dos) is not supported/recommended on NT based windowses
>> (NT4/2k/2k3/xp/vista/w2k8/w7).
>
> I am using FPC 2.2.4 for i386.

The one for Dos, or the win32 one?

Zaphod Beeblebrox

unread,
Dec 29, 2009, 11:08:02 AM12/29/09
to

"SirJohn" <conte...@aol.com> wrote in message
news:9e7438a8-bf4a-4bc2...@d20g2000yqh.googlegroups.com...
> On Dec 17, 8:00?am, "Zaphod Beeblebrox"

> <Zaphod.Arisztid.Beebleb...@gmail.com> wrote:
> > "SirJohn" <contest...@aol.com> wrote in message
> >
> > news:dff19abd-9e4d-40c0...@j14g2000yqm.googlegroups.com...
> >
> > >I just moved to Windows 7, which means that I now connect to my
> > > printer via a USB port instead of a serial port. ?In those FPC

> > > programs which use the printer I changed InitPrinter('LPT1') to
> > > InitPrinter('USB001') ?however, everything I print is now going
> > > to a
> > > disk file named USB001 instead of to the printer. ?What else do
> > > I
> > > need
> > > to get this working?
> >
> > Make sure the printer is shared, and then use the following
> > command to
> > redirect LPT2 to the printer:
> >
> > net use LPT2: \\computername\printername /persistent:yes
> >
> > Replace 'computername' with your computer name, and 'printername'
> > with
> > the share name of your printer. ?After you've run the command, you

> > should be able to use InitPrinter('LPT2') in your program.
> >
> > BTW, you want to use LPT2 since from what I've read, if the
> > printer
> > port actually exists, Vista and Windows 7 won't let you redirect
> > to
> > it.
> >
> > Hope this helps.
>
> There is no local network involved. My printer is connected
> directly
> to my PC. I tried that NET command, but it was not recognized.

You don't need a local network for that approach to function (but you
do need file and printer sharing turned on), and the it was designed
for printers connected directly to a PC so it should work for your
situation. That said, I would have expected the NET command to give
an error rather than not being recognized (unless it gets installed
when file and printer sharing is enabled or some such). I don't have
a Windows 7 computer immediately available to check, so I can't really
say what might be happening. In XP and Vista, it "just works" for me.

--
Zaphod

Arthur: All my life I've had this strange feeling that there's
something big and sinister going on in the world.
Slartibartfast: No, that's perfectly normal paranoia. Everyone in the
universe gets that.


SirJohn

unread,
Dec 30, 2009, 2:37:28 PM12/30/09
to
On Dec 29, 6:21�am, Marco van de Voort <mar...@stack.nl> wrote:

The version for WIN32.

SirJohn

unread,
Dec 30, 2009, 2:56:31 PM12/30/09
to
On Dec 29, 11:08�am, "Zaphod Beeblebrox"
> universe gets that.- Hide quoted text -
>
> - Show quoted text -

I am a little mystified by all of this. Printing works from every
other program, from Notebook, PE32, Internet Explorer, Microsoft
Office, and FTPrint. It is only my FPC programs that can't print. I
would have thought that if the problem was with my home network then
nothing would print.

SirJohn

unread,
Dec 30, 2009, 2:59:55 PM12/30/09
to
On Dec 17, 8:00�am, "Zaphod Beeblebrox"
<Zaphod.Arisztid.Beebleb...@gmail.com> wrote:
> "SirJohn" <contest...@aol.com> wrote in message

I found out what my computername is, but I don't know where or how to
find out or to assign the printername

Marco van de Voort

unread,
Dec 30, 2009, 6:42:24 PM12/30/09
to
On 2009-12-30, SirJohn <conte...@aol.com> wrote:
>
> I am a little mystified by all of this. Printing works from every
> other program, from Notebook, PE32, Internet Explorer, Microsoft
> Office, and FTPrint.

They don't try to print through a legacy TP Dos interface.

> It is only my FPC programs that can't print. I
> would have thought that if the problem was with my home network then
> nothing would print.

How did you get the USB001 name? Because for this to work, a USB001 dos
compatibility device must have been created.

Chris Burrows

unread,
Dec 30, 2009, 6:49:48 PM12/30/09
to
"SirJohn" <conte...@aol.com> wrote in message
news:e08f2799-fe14-49e2...@k17g2000yqh.googlegroups.com...

> I found out what my computername is, but I don't know where or how to
> find out or to assign the printername

Windows Start > Control Panel > Printers and Faxes

--
Chris Burrows
CFB Software
http://www.cfbsoftware.com

SirJohn

unread,
Dec 30, 2009, 8:33:10 PM12/30/09
to
On Dec 30, 6:42�pm, Marco van de Voort <mar...@stack.nl> wrote:

I went to Control Panel, Dwevices and Printers, (my printer),
Customize Your Printer, and then clicked on the Ports tab. It had a
list of LPT1, LPT2, LPT3, COM1, etc, but none of those were associated
with any printer, then it had USB0001 marked "Virtual port for (my
printer)" Since that was the only port associated with a printer, I
selected that one.

I tried running a test program without InitPrinter and with InitPrinter
('LPTx') and InitPrinter('COMx') for all the possible values of x, but
every one of those runs bombed. The only value I found that did not
crash the program was 'USB001'. That caused the output to go to a
file named USB001.

SirJohn

unread,
Dec 30, 2009, 8:42:36 PM12/30/09
to
On Dec 30, 6:49�pm, "Chris Burrows" <cfbsoftw...@hotmail.com> wrote:
> "SirJohn" <contest...@aol.com> wrote in message

That tells me the make and model of my printer. I already know that
information from the decals on the front of the printer. I thought
the printername needed in the NET command is its virtual name within
the local network. Or am I making a wrong assumption?

Chris Burrows

unread,
Dec 31, 2009, 5:00:04 AM12/31/09
to
"SirJohn" <conte...@aol.com> wrote in message
news:d7c4eecc-bbe7-4839...@21g2000yqj.googlegroups.com...

> That tells me the make and model of my printer. I already know that
> information from the decals on the front of the printer. I thought
> the printername needed in the NET command is its virtual name within
> the local network. Or am I making a wrong assumption?

I believe so - just try renaming it. It makes sense for the system to give
the printer a default name which enables you to identify it easily. You can
rename it to something more 'friendly' if you like in the same sort of way
as you can rename a file in Windows Explorer. e.g. click on the name and
overwrite it, select 'Rename' from the context-sensitive menu etc. etc.


SirJohn

unread,
Jan 1, 2010, 2:37:47 AM1/1/10
to
On Dec 31 2009, 5:00�am, "Chris Burrows" <cfbsoftw...@hotmail.com>
wrote:
> "SirJohn" <contest...@aol.com> wrote in message

HAPPY NEW YEAR TO ALL!

I found the place where you could set the printer name, and figured
out how to make the NET command work. Then I printed a sample file
containing underlines, bold text, superscripts and varied fonts. It
printed! A little faint, but it printed correctly, and all the
features worked. Hooray! I was ready to send you all bottles of
champagne.

Then I tried printing an actual document, and just like that success
turned back to failure. The document printed, but half-sized. The
page image is squeezed into the upper left corner of the sheet of
paper. So I tried various control codes for adjusting the font size:
Esc 2, Esc P, nothing worked. Then I tried setting the font size
using the buttons on the printer, but Windows overrode them. Next I
tried changing the printer settings in Control Panel, but none of them
helped.

How could it work once and then just stop?

SirJohn

unread,
Jan 1, 2010, 3:03:41 AM1/1/10
to

Sorry, I may have panicked too soon. I have been experimenting with
the order of the printer control codes and getting better results.

I suspect that Windows is not using the fonts and other capabilities
of my printer. It is laying the page out as a bit image, and then
sending that to the printer, so controls work a little differently
than they used to.

However, this should be something I can figure out myself. Thanks to
everyone for your help.

Marco van de Voort

unread,
Jan 1, 2010, 10:51:37 AM1/1/10
to
On 2010-01-01, SirJohn <conte...@aol.com> wrote:
>> helped.
>>
>> How could it work once and then just stop?
>
> Sorry, I may have panicked too soon. I have been experimenting with
> the order of the printer control codes and getting better results.
>
> I suspect that Windows is not using the fonts and other capabilities
> of my printer. It is laying the page out as a bit image, and then
> sending that to the printer, so controls work a little differently
> than they used to.

Note that if you use FPC/win32 you could simply use the printer over the GDI
windows API interface. Specially in Delphi circles there should be examples
for that.

(I'd look at lazarus/win32 printers4lazarus package, synedit among others)

SirJohn

unread,
Jan 1, 2010, 10:08:05 PM1/1/10
to
On Jan 1, 10:51�am, Marco van de Voort <mar...@stack.nl> wrote:

I'm afraid I have no idea what "GDI windows API interface" means. I
did a search of the FPC manuals, and could find no mention of GDI,
except in some imbeddings like LongDiv.

Marco van de Voort

unread,
Jan 2, 2010, 7:59:57 AM1/2/10
to
On 2010-01-02, SirJohn <conte...@aol.com> wrote:
>> Note that if you use FPC/win32 you could simply use the printer over the GDI
>> windows API interface. Specially in Delphi circles there should be examples
>> for that.
>>
>> (I'd look at lazarus/win32 printers4lazarus package, synedit among others)
>
> I'm afraid I have no idea what "GDI windows API interface" means. I
> did a search of the FPC manuals, and could find no mention of GDI,
> except in some imbeddings like LongDiv.

(putting "gdi" in google would have yielded the answer on the first hit btw)

GDI is the part of the win32/64 api that is responsible for painting the
screen, but the printing support is also based on it.

It is mostly done via the calls in the OS specific windows unit, which, like
all OS specific headers, are not documented in FPC, but in the OS vendors
documentation. In this case Microsoft's MSDN.

However it's easier to search for Delphi examples. They are easier adapted
(if needed at all) to FPC.

SirJohn

unread,
Jan 3, 2010, 6:49:17 PM1/3/10
to
On Jan 2, 7:59�am, Marco van de Voort <mar...@stack.nl> wrote:

The GDI you mean comes up seventh in Google, after Gardner Denver Inc,
God-Damned Independent, and various other choices.

GDI seems to be exactly the opposite of what I want. I want an
interface that transmits the sequence of characters and control codes
produced by my program directly to the printer without any
modification whatsoever.

The last thing I want is for the interface to create an image, and
then send that image to the printer. That produces a double
degradation of the print quality.

Using the shared-printer LPT2 interface is doing that double-mapping,
resulting in undersized lumpy text, dashed horizontal lines, wavy
vertical lines, and irregular gaps. My printer is capable of far
better.

Optimally, the program and the printer should be in direct contact, so
I can control the printing as it's happening, instead of going back
and rerunning the whole job if there is a printing problem.

SirJohn

unread,
Jan 13, 2010, 12:30:13 AM1/13/10
to
> and rerunning the whole job if there is a printing problem.- Hide quoted text -

>
> - Show quoted text -

Just to be clear here, I am not complaining because I dislike change,
I am complaining because I can't use the features of my programs that
control the printing. In the old days, if something went wrong during
printing, like a misfeed, I could press a key and backup and restart
the printing from the misprinted item. Now, the printing doesn't
start until my program finishes, and the best I can do after a misfeed
is to reprint the entire job. That wastes forms, ink or toner, and
above all, time.

Chris Burrows

unread,
Jan 13, 2010, 7:39:10 PM1/13/10
to
"SirJohn" <conte...@aol.com> wrote in message
news:d32ed77a-20a4-4cd1...@v25g2000yqk.googlegroups.com...

> Now, the printing doesn't
> start until my program finishes, and the best I can do after a misfeed
> is to reprint the entire job. That wastes forms, ink or toner, and
> above all, time.

See if there is a PDF driver available for your printer and use it to allow
your program to print to a PDF file. Then if your printer misfeeds you can
just print the bad page separately using Acrobat Reader. An added bonus of
this technique is that you have a machine-readable copy of your program's
output that you can email to others, archive, reprint later if required etc.
etc.

SirJohn

unread,
Jan 14, 2010, 12:37:09 AM1/14/10
to
On Jan 13, 7:39�pm, "Chris Burrows" <cfbsoftw...@hotmail.com> wrote:
> "SirJohn" <contest...@aol.com> wrote in message

I found two programs that seem related, WIN2PDF and DESKPDF. Are
these what you mean? They both say that they let you create a PDF
from any Windows application, but it is not clear if it is possible to
use them from an FPC program. Creating a PDF might help with the
print quality, but it complicates the process by making printing a
multistep process. First I run my program, then I use Adobe Reader to
print the output. But the printing is still spooled, so there still
no way to control the printer during the run.

Chris Burrows

unread,
Jan 14, 2010, 1:24:42 AM1/14/10
to
"SirJohn" <conte...@aol.com> wrote in message
news:b0d70fe3-a404-4460...@o28g2000yqh.googlegroups.com...

> I found two programs that seem related, WIN2PDF and DESKPDF. Are
> these what you mean? They both say that they let you create a PDF
> from any Windows application, but it is not clear if it is possible to
> use them from an FPC program.

I believe there are a few around but haven't had experience with either of
those. I use the driver that is included with the full version of Adobe
Acrobat.

> But the printing is still spooled, so there still
> no way to control the printer during the run.

That all depends on your printer and its drivers. Check to see what options
you have in Windows Control panel. Both my inkjet and laser printers allows
me to specify 'Print directly to the printer' / 'Spool print documents so
program finishes printing faster'.

If you select 'Spool' you have a couple of additional options: 'Start
printing after last page is spooled' / 'Start printing immediately'.

You might be able to have some sort of control over a slower inkjet printer
but I would not be optimistic about a fast laser printer. They usually have
several pages already stored in their buffers in addition to the one that is
currently printing. I normally have to switch mine off on the rare occasions
when it goes berserk.

Chris


Dr Engelbert Buxbaum

unread,
Jan 14, 2010, 7:44:36 AM1/14/10
to
Am 13.01.2010, 20:39 Uhr, schrieb Chris Burrows <cfbso...@hotmail.com>:


> See if there is a PDF driver available for your printer and use it to
> allow your program to print to a PDF file.

A universal printer driver, that does that, is available free from Adobe.
Once you have installed it, and set its properties to "print to file", you
can choose to print to your printer or to a pdf-file in the print-dialogue
of any windows-application.

SirJohn

unread,
Jan 16, 2010, 5:19:00 PM1/16/10
to
On Jan 14, 1:24�am, "Chris Burrows" <cfbsoftw...@hotmail.com> wrote:
> "SirJohn" <contest...@aol.com> wrote in message

It looks like we have come full circle. I had tried pretty much every
possible combination of the settings in Control Panel before I made my
first post on this subject.

0 new messages