When I use it fist time in procedure it create new page but next time it just print text on the same page. First page is OK but on second page I have 5 (and more) pages one over other. What is the problem?
Well this is the code from my project, and it doesn't work. Can you tell me where is problem? I always get 2 page. First is great but second ((((
Sorry for the format an comments in code but it's just Copy-Paste
Dim startXL 'Pocetak x sa leve strane
Dim startXR 'pocetak x sa desne strane
Dim startY ' pocetak Y
Dim Rb As Long ' redni broj linije koju stampa
Dim r As Boolean ' da li stampa u desnoj koloni
Dim NewDoc As Boolean 'da li je pocetak novog dokumenta
Set Base = OpenDatabase("h:\My Documents\Project\VB Project\MonSoft\base97.mdb")
Set rc = Base.OpenRecordset("select * from istorija") ' where panelID = 4444")
If rc.RecordCount = 0 Then MsgBox "Nema podataka za stampanje": Exit Sub
rc.MoveLast
rc.MoveFirst
Firma = rc!Objekat
rc.MoveNext
If Printer.CurrentY > Printer.Height - 2000 Then
If r = True Then
Printer.CurrentX = 9000
Printer.CurrentY = 15500
Printer.Print "Strana: " & Printer.Page
Printer.EndDoc
r = False
GoTo startPage
Else
r = True
GoTo groupHeader
End If
Else
End If
Loop
i think it's your 1st "Printer.EndDoc" near the end or your code
VB Code:
If r = True Then
Printer.CurrentX = 9000
Printer.CurrentY = 15500
Printer.Print "Strana: " & Printer.Page
' Printer.EndDoc (remove this line)
r = False
GoTo startPage
Else
r = True
GoTo groupHeader
End If
The ".EndDoc" should only come at the end of processing. It's telling your program...OK, I'm done talking to the printer, now release it and print. You should really only need one of these right at the end of your processing.
I think that's your problem, try it out...hopefully you get the results you're looking for....
I havn't looked at this carefully, I'm about to fall asleep it's 2315 here, but I think the enddoc's the problem. It literally means, the End of the Document...
I'm sorry but I put .EndDoc when I saw that .NewPage isn't working and forgot to change it back . I just want to see if I can do it that way (by the way it works fine just I have 5 print jobs with 1 page instead 1 with 5 page's on it) . Now I tried this code in New VB Project
The code you have there on that last post looks good. Unfortuantly I think you may have some sort of local printer compatability issue. Unless someone else sees something that I don't I think you're out of luck on this one.....
What may be causing the problem is that you are moving the printer pointer position as you print (using CurrentX,Y) so I think even though you reset the position to a new page you are moving it back again with the CurrentX,Y code. Try running the code we posted and see if that works. If it does then its probably not a printer thing but a code thing and the difference in your code and ours is the Current X,Y.
I've tried before to do like you are doing and make a 'Report' using the printer object and thats what happened to me anyway.
If yo ucan get the length of the page maybe you could increment any place where you Set the CurrentX or Y (CurrentX=1000 +PageLength) with the value plus the length of a page so then you'd be setting the height for the next page.
But I am not sure what the report is supposed to look like.
Right now I get the first page as just the headers and a second page with all the values under the header.
So maybe I was wrong about adding the length of the page???
I wouldn't install your OS over this....Edneeis has a good point, if that doesn't work, I'd suggest looking toward something like Crystal Reports. But that's a whole nother animal altogether!
Vujke says the problem occurs with this simple code:
VB Code:
Printer.print "Me"
printer.NewPage
Printer.print "Test 1"
printer.NewPage
printer.print "Sample text"
printer.NewPage
printer.print "Another samle text"
printer.EndDoc
and I don't get the same symptoms in either PCL or PS.
So I think vujke should print to file and let others try the print to say LPT: with a copy command from dos. Or if it's PCL which it seems to be, look at the pages in a PCL viewer.
Or print to file and look at the file in a hex editor: look for formfeeds or showpages.
Let's try and isolate one thing at time
Last edited by Jim Brown; Sep 29th, 2001 at 11:33 PM.
I'd print to file with the printer & driver you're using already. Change the printer's port from LPT: or its ip address to FILE: by going into the printer's properties in Start/Printers.
When you print, it'll prompt you for a file name. Zip the file up and post it here: I'll look at in a PCL Interpreter and print it out.
Don't forget to change the printer port back again! I nearly always forget.
Well here at home I don't have printer but I use 5D PDF Creator. I'll send You 3 files.
HP 5L PCL print file
5D PDF Creator print file and
5D PDF Creator PDF file so You can see my result
I don't have driver for HP DeskJet 640 so I can't send you his prn file
I opened the PCL file in my PCL Interpreter, and yes, it only has 2 pages just like your PDF. That indicates to me that the PCL itself is being generated with 2 pages: so the problem originates in the driver almost certainly, not at the printer itself.
I'm on leave from work, but I will be popping into the office tomorrow for a short while and I'll ask our PCL guru if there's anything in the PCL which looks unusual.
Perhaps in the meanwhile you should look at the window which the driver gives you at print time, to see if there's a check-box or a radio-button you might have overlooke which could have a bearing on this?