|
My Epson LX 300 Printer Print Only in Right Side How to Solve The Problum
|
|
|
|
|
I use this Printer class successfully in my application. There one thing I need add and I don't know how. Sometimes when I start printing from the application the network printer is not configured or is disconnected. Looks like the printing code does not see it and goes through without errors. Is there any way to detect in code that printer is unavailable and inform the user.
Thanks.
|
|
|
|
|
hi all
In SDI application i am drawing graphics
by using lines the problem is that print
preview and print output is small image
not actuall image size. can any one provide
code to fx the problem.
|
|
|
|
|
tnx for your work....
quistiun
|
|
|
|
|
One of the info fields (cbSize) is not initialized.
BOOL CPrinter::StartPrinting()
{
DOCINFO info;
::ZeroMemory(&info, sizeof(info));
info.cbSize = sizeof(DOCINFO); //<---ADD THIS LINE!
info.lpszDocName = AfxGetAppName();
SetPrinterFont();
dc->StartDoc(&info);
docStarted = TRUE;
TEXTMETRIC tm;
dc->GetTextMetrics(&tm);
lineHeight = tm.tmHeight + tm.tmInternalLeading;
pageVMargin = dc->GetDeviceCaps(LOGPIXELSY) / 2;
pageHMargin = dc->GetDeviceCaps(LOGPIXELSX) / 2;
pageHeight = dc->GetDeviceCaps(VERTRES);
pageWidth = dc->GetDeviceCaps(HORZRES);
Y = pageVMargin;
return TRUE;
} // CPrinter::StartPrinting
|
|
|
|
|
When I use arabic font in Visual C++, it appear correct in view but in printpreview window arabic characters overlaped to each other. I use This statement
CFont ffont;
ffont.CreateFont(-18,0,0,0,700,0,0,0,178,3,2,1,2,"Arial");
mapmode is MM_LOENGLISH
I need help. Any body have the solution pleas send to my email
thanks
|
|
|
|
|
I can understand -18, 0, 0, 0, but what is 700? Oh, you meant FW_BOLD. 0, 0, 0 you probably meant FALSE, FALSE, FALSE. What the hell is 178? 3? 2? 1? 2? Those numbers are completely meaningless! Perhaps by 178 you meant ARABIC_CHARSET? If so, why didn't you write that? And I haven't a clue as to what those other numbers could possibly mean. The code may or may not be correct, but I have no idea if it is or not.
When the code is written intelligibly, I might have a fraction of chance of guessing what is wrong. Or maybe not. But something this unintelligible is not something I would even offer an opinion on. Note that once it is rewritten, I may not see anything wrong, but I can't tell anything from such a piece of incorrect code.
|
|
|
|
|
From : Bushka
to : Mr.Joseph M. Newcomer
Very Thanks to email me and I'm sorry for numbers in function CreateFont this mean the number
CreateFont( int nHeight, int nWidth, int nEscapement, int nOrientation, int nWeight, BYTE bItalic, BYTE bUnderline, BYTE cStrikeOut, BYTE nCharSet, BYTE nOutPrecision, BYTE nClipPrecision, BYTE nQuality, BYTE nPitchAndFamily, LPCTSTR lpszFacename );
You can find more detail in MSDN and for the number 178 this ARABIC_CHARSET
My problem in PrintView with arabic only, English no problem with it. printing like view with no any problem.
Also I use only function OnDraw
thanks again and i hope to find answer
I can send the source code but where ???
I use number
|
|
|
|
|
Hi,
I need some help in doing my current task involving printing. The requirement is to listen in a paricular folder and ANY files coming to that folder has be sent to a default network printer, after taking note of the pagecount of that file.I tried with a dummy printer connection. It worked.But,when taking it to a real printer, the "GetPrinter" function is not returning the actual job count.
The simple function i used to print is "ShellExecute" with "print" as the operation parameter.
Regards,
Franklin
|
|
|
|
|
I've never used GetPrinter; so I have no experience to suggest what might be happening.
joe
|
|
|
|
|
Plz help me as i need to know urgently ,how can i print multiple pages in java.Plz reply with source code
|
|
|
|
|
nice job, it works but what about this:
printer = new CPrinter(&dc);
i'm quite a newbie... but to make it work:
CPrinter * printer = new CPrinter(&dc);
its not a problem for me but real beginner may have a problem with it
|
|
|
|
|
Hello,
I have tried to print a long string(using Roger Allen class) and looking at
your print methods I was wondering if there is a way to print combination of
character(lower and upper case) , numbers in few columns and row pattern and line them
up so then don't look twisted.
I don't suppose the text formating would work beacuse I tried and it really didn't.
any suggestion to correct this problem is appreciate it.
thanks
vd
|
|
|
|
|
My printing class was intended to do simple things. For serious printing, while many of the techniques apply, you are pretty much on your own for layout.
Unless you use a fixed-pitch font, you need to do some layout geometry. Depending on how you want to do this (allowing for user-selected fonts and the like), this can be reasonably straightforward, or incredibly complex. But there are no really simple answers to this.
For example, I would compute the column width of the maximum content of each column, then given the horizontal positions (in pixels), I'd simply do TextOut calls, left justified, right justified, or centered, as I want.
|
|
|
|
|
I have used the sample code attached with this mail and done necessary changes. Problem is that my printer goes on Spooling instead of doing printing.
What is the problem??
WHen i have debugged the code i found that it works fine upto dc->StartDoc(&info); line of StartPrinting() of CPrinter class. Degubber doesn't come out of this line.
What is wrong??
Pls. help me very urgent
|
|
|
|
|
For those interested: I changed the PrintLine function so it would Automatically wrap long lines. Could be done better (rather silly right now), but don't have time to improve it...
void CPrinter::PrintLine(const CString & s)<br />
{<br />
if (dc->GetTextExtent(s).cx > pageWidth - pageHMargin)<br />
{<br />
CString stringtoprint = s;<br />
while (dc->GetTextExtent(stringtoprint).cx > pageWidth - pageHMargin)<br />
{<br />
CString sub = stringtoprint;<br />
while (dc->GetTextExtent(sub).cx > pageWidth - pageHMargin)<br />
{<br />
sub = sub.Left(sub.GetLength() - 1);<br />
}<br />
PrintLine(sub);<br />
stringtoprint = stringtoprint.Right(s.GetLength() - sub.GetLength());<br />
}<br />
PrintLine(stringtoprint);<br />
}<br />
else<br />
{<br />
if(!pageStarted || Y > pageHeight - pageVMargin)<br />
{ <br />
if(pageStarted)<br />
{<br />
dc->EndPage();<br />
}<br />
dc->StartPage();<br />
pageNumber++;<br />
Y = pageVMargin;<br />
pageStarted = TRUE;<br />
PageHeading();<br />
} <br />
dc->TextOut(pageHMargin, Y, s);<br />
Y += lineHeight;<br />
}<br />
}
-----------------------
New and improved: kwakkelflap.com
My second CP article: MAP files[^]
while (!:bob:.IsDrunk())<br />
{<br />
:bob:.Drink( :beer: );<br />
}
|
|
|
|
|
There was a problem if your line exceeded more than two lines. I also included a spacer function that will backoff to a space break if found.
void CPrinter::PrintLine(const CString & s)
{
if (dc->GetTextExtent(s).cx > pageWidth - pageHMargin*2)
{
CString stringtoprint = s;
while (dc->GetTextExtent(stringtoprint).cx > pageWidth - pageHMargin*2)
{
CString sub = stringtoprint;
while (dc->GetTextExtent(sub).cx > pageWidth - pageHMargin*2)
{
int len = sub.GetLength() - 1;
int newlen = len;
while (TRUE) {
sub = sub.Left(newlen);
if (sub.Right(1) == ' ') {
break;
}
if (newlen <= 0)
{
sub = sub.Left(len);
break;
}
newlen--;
}
}
// Call ourself multiple times till all chars are printed
PrintLine(sub);
stringtoprint
= stringtoprint.Right(stringtoprint.GetLength() - sub.GetLength());
}
// Also print the last line
PrintLine(stringtoprint);
}
else
{
if(!pageStarted || Y > pageHeight - pageVMargin)
{ /* new page */
if(pageStarted)
{
dc->EndPage();
}
dc->StartPage();
pageNumber++;
Y = pageVMargin;
pageStarted = TRUE;
PageHeading();
} /* new page */
dc->TextOut(pageHMargin, Y, s);
Y += lineHeight;
}
}
The first post for myself
|
|
|
|
|
I am using your code in a separate class to print reports from many places in my CFormView app and it works great. Thanks for doing this. But when I access Print Setup from the menu and change a setting, like number of copies to two, this setting is ignored when I call your function. I'm guessing it is because it's a different instance of the CPrintInfo. Is there a way to use Print Setup with your function in such a situation?
|
|
|
|
|
Surprisingly, I seem to do very little printing. I'm sure it is because there are different instances of the print info structure. It has been so long since I've looked at printing that I'm not sure what the best remedy would be, but I'm somewhat limited in the time I have for the next week or three and don't have time to give a good answer right now.
|
|
|
|
|
Ok, thanks for the quick response. I'll keep plugging away at it.
|
|
|
|
|
Like your article. I'm having a strange problem with the CPrintDialog. All works fine in w2k. But in NT (SP6), when I select the printer properties, the program crashes. Any idea what I'm doing wrong here?
New and improved: kwakkelflap.com
|
|
|
|
|
Hi!
This sample is great, but recently i found something very disturbing. I'm working on Win2000 platform, and this sample program causes "Debug Assertion Failed" error when i press Cancel on Printing Properties Dialog. What's the problem and how can i solve it?
Thanks,
Kristijan
|
|
|
|
|
I see that you call SetPrinterFont(); when printing, and this sets the font to 'ANSI_FIXED_FONT', but when it prints it is not a fixed width font.. any suggestions?
-dz
|
|
|
|
|
I have the same problem. Create your own font object and attach it and you are home free. You have to use Fixed font.
Here is the code
//In your Header File
CFont m_font;
m_font.CreateFont(
12,
0,
0,
0,
FW_NORMAL,
FALSE,
FALSE,
0,
ANSI_CHARSET,
OUT_TT_PRECIS,
CLIP_TT_ALWAYS,
0,
FF_DONTCARE,
"Courier");
m_richEdit.SetFont(&m_font);
|
|
|
|
|
Thanks for providing the printer class and the example (tracelog) that shows how to use it. I could start printing almost as quickly as using the DOS redirection >LPT1.
One hint, since our specs call for no user intervention: The dlg.DoModal()(CPrintDialog) can be replaced with dlg.GetDefaults(), so that no user input is needed.
|
|
|
|