473,756 Members | 3,973 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

TPrinter with network printer

Hello everyone!

I have a problem with using TCanvas Printer and network printer HP
LaserJet
It print just first page and throws blank all the rest.
WinNT with Borland Builder 5.

All works fine with my HP 3820 with USB printer (WinXP)
I pasted my code.

//------------------------------
void __fastcall ThPrintChart::E xecute()
{
if( MessageBox(0,"P rint ?", "Text", MB_YESNO | MB_ICONQUESTION ) ==
IDYES)
{ Printer()->Orientation = poLandscape;
Printer()->Title = "Title";
int iPrinterH = Printer()->PageHeight;
int iPrinterW = Printer()->PageWidth;
int iSizeW = iPrinterW - 1;
int iSizeH = iPrinterH - 1;
PrinterRect = Rect( 0, 0, iSizeW, iSizeH);
PrinterCanvas = Printer()->Canvas;
PageCanvas = PageImage->Canvas;
AnsiString sFileName;
Printer()->BeginDoc();
while(*bStop != true)
{ try
{
if(!bPrintToFil e)
DisplayIt();
if((!bPrintToFi le) && Printer()->Printing)
{

PrinterCanvas->CopyMode = cmSrcCopy;
PrinterCanvas->CopyRect( PrinterRect, PageCanvas,
pRect->PageRect);

}
else
{
sFileName = IntToStr(pChart Info->iActivePage) + ".bmp";
PageImage->Picture->SaveToFile(sFi leName);
}
if((pChartInfo->iActivePage) >= (pChartInfo->iPageCount))
*bStop = true;
else
{
if(!bPrintToFil e )
Printer()->NewPage();

ScrollIt();
}
}
catch(Exception & EPrinter)
{
}
}
if(!bPrintToFil e) Printer()->EndDoc(); //08.04.2004
}

PageImage->Visible = false;
}

//---------------------------------------------------------------------------
void __fastcall ThPrintChart::D isplayIt(void)
{
PageImage->Canvas->CopyMode = cmWhiteness;
PageImage->Canvas->CopyRect( pRect->PageRect, PageImage->Canvas,
pRect->PageRect);

PageImage->Visible = false;
ChartView->PrintPartialCa nvas( PageImage->Canvas, pRect->ChartRect);

PageImage->Canvas->TextOut(pTex t->iTextLeft, pText->iTextBottom,
pText->sText1);
PageImage->Canvas->TextOut(pTex t->iTextLeft, pText->iTextBottom +
pText->iSize, pText->sText2);
PageImage->Canvas->TextOut(pTex t->iTextLeft, pText->iTextBottom +
2*pText->iSize, pText->sText3);

pText->sText4 = IntToStr(pChart Info->iActivePage +
pChartInfo->iFirstPage - 1) + " (";
pText->sText4 += IntToStr(pChart Info->iMaxPage);
pText->sText4 += ")";
PageImage->Canvas->TextOut(pTex t->iTextLeft, pText->iTextBottom +
3*pText->iSize, pText->sText4);
PageImage->Visible = true;
}
//---------------------------------------------------------------------------
void __fastcall ThPrintChart::S crollIt(void)
{
pChartInfo->iActivePage = pChartInfo->iActivePage + 1; //13.04.2004
ChartView->BottomAxis->Scroll(pChartI nfo->iSamplesPerPag e, false);
}
//---------------------------------------------------------------------------

It sometimes works better when I add two Sleep(1000); lines before and
after CopyRect line...

Any suggestions? Thank you for your answers

Sorry for my English :-)
Daniel
Jul 22 '05 #1
2 3195
Daniel Iwan wrote:
WinNT with Borland Builder 5.


Daniel,

You've posted to the wrong group.. You're more likely to get an answer
in the Borland or Win32 newsgroups.

Good luck,
Steve
Jul 22 '05 #2
Daniel Iwan <wi****@op.pl > spoke thus:
I have a problem with using TCanvas Printer and network printer HP
LaserJet
It print just first page and throws blank all the rest.
WinNT with Borland Builder 5.


Your post is off-topic for comp.lang.c++. Please visit

http://www.slack.net/~shiva/welcome.txt
http://www.parashift.com/c++-faq-lite/

for posting guidelines and frequently asked questions. Thank you.

--
Christopher Benson-Manica | I *should* know what I'm talking about - if I
ataru(at)cybers pace.org | don't, I need to know. Flames welcome.
Jul 22 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
4721
by: Maileen | last post by:
Hi, I have 2 questions : 1. - I want to print from my ASP page directly to my network printer. For this i use the following code, but everytime, my document to print is sent to local and physical port LPT1 not to network printer :( '---- to print report on network printer ---
0
3280
by: KohlerTommy | last post by:
In my application I need to give the user the ability to print duplex if the selected printer supports duplex printing. Many of the printer options do not make much sense in my application, and many of the settings in the common printer dialog would have a negative impact on my printing process. To handle this strict printing constraint on which my application imposes I do not want to show the common print dialog. I want to be able to...
4
7348
by: cvopicka | last post by:
i have found many refrences to access being slow over a netowrk but my boss and i just found this and i was hoping to get some help. on the local machine we have the Access 2000 format database open in access 2k3. this is also the machine that the database lives. we then from a tool bar in access call an external program to manipulate the database. and the process time is about 5.5 minutes then if we disable the network connection...
1
1928
by: Maileen | last post by:
Hi, We have a little problem in 1 of our ASP page :( on this page, we can add new printers (local or network) and to print a report on a selected (by default) printer. We we do the test on a local printer, it works perfectly. Unfotunately, when we try to print the same report on one of our network printers, it fails.
0
3254
by: Tessa | last post by:
Is there any security reason why you cannot print to a network printer from ASP.NET under IIS6 on Windows 2003 server? I'm using ASP.NET code to print to a server print queue using PrintDocument.Print() (.NET framework v 1.1) I can print to a local printer plugged into LPT1 on the web server, but not to a network printer. The same printing code to a network printer works in a .NET web app when
3
4018
by: NewToNetworks | last post by:
Hi, hello, help! I am new to networking so please forgive me if this is a simple question. I have been at this for hours to no avail. I"m trying to network my Mac G5, running OSX 10.4.7 Tiger, a PC laptop running Windows 2000, and an HP Laserjet 4500, with a Linksys Wireless-G router. All are set up with network cords running to the router. The router is working since I can access the internet on both computers. I followed the...
0
1863
by: jigsmshah | last post by:
i am working on a project (windows service using VB.Net and C#) which gets the check details and check images from the database and prints the check to a printer. Printer name is configured in a XML file. Printer names are names which are available to the system on which the service is running. Printers used are network printers and are added using Printers and Faxes -> Add a printer. To validate the printer I am using the following...
1
9637
by: ekynox | last post by:
Hi guys, have been playing with WMI to add a network printer connection to a Windows XP pc. My environment consists of a server running Windows Server 2003 and Visual Studio 2005 and a test pc running windows xp. Further, I have setup a full domain controller environment. I have managed to write the code to add the network printer and it works fine when installing the printer on the same machine the code is executing from i.e the server or...
2
2867
by: jawaid alam | last post by:
Hi all forum Member, I am facing very tropical type of problem. I devoloped a intranet web project. I want to print crystal report by selecting network printer. I accessed all network printer in dropdownlist in crystal report page. when i run crystal report page directly by set as startup page. Dropdownlist shows all network printer. but when i run my project through IIS Dropdownlist shows only localhost printers. its not showing
0
9455
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9708
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8709
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7242
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5140
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5302
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3805
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3354
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2665
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.