|
hi,
I want to implement a print function , but i dont know how to do .
I select the sql data ,and the result is in a Recordset and I use the DataGrid to show them on a dialog.
then at this dialog ,I want to add a button which can let me print the data on paper
Could you give me some advice ?
thanks ,
Jane
|
|
|
|
|
Howdy,
I see that the code tests if the printing is OK based on whether the dc.EndPage() function returns > 0.
Say for example my OnPrint function fails to to a StretchBlt - I'd like to somehow make the EndPage return zero.
--- Is there a way to do this, or should I just call dc.AbortDoc()? ---
Calling AbortDoc seems to be incorrect, as the bPrintingOK flag then tells us to AbortDoc anyway.
Cheers,
Dave
|
|
|
|
|
what is AFX_IDS_APP_TITLE? How can i set this value.
My Application is dialog based. I want to print some set of documents without opening.
I have the documents names only in my application. Where can i set these documents name in this program? How can i get print dialog and settings for these documents?
Waiting for reply.
Thank You.
|
|
|
|
|
kamal wrote: what is AFX_IDS_APP_TITLE? How can i set this value.
Did you read the article? See the text in bold.
CString strTitle;
strTitle.LoadString(AFX_IDS_APP_TITLE);
AFX_IDS_APP_TITLE, is the resource constant for the Application's title.
I'd love to help, but unfortunatley I have prior commitments monitoring the length of my grass. :Andrew Bleakley:
|
|
|
|
|
thanks!..... but,
1. i want to print a document by location name like d:\abcd.doc
2. i want to set the properties for that document and printer also.
3. my application is fully dialog based.
reply me.
|
|
|
|
|
kamal wrote: 1. i want to print a document by location name like d:\abcd.doc
So what does this have to do with your original question?
Word Documents are in a propriety format, if you want to print a word document your going to need to delve into word /office automation.
I'd love to help, but unfortunatley I have prior commitments monitoring the length of my grass. :Andrew Bleakley:
|
|
|
|
|
hi douglas,
i used word/office automation in my application.
its solved all my needs. thanks......
bye.
kamalraj.m
|
|
|
|
|
kamal wrote: its solved all my needs. thanks......
Your welcome.
I'd love to help, but unfortunatley I have prior commitments monitoring the length of my grass. :Andrew Bleakley:
|
|
|
|
|
Hi,
This is really a wonderful sample. It worked very well with my application. I have a small question. I have integrated the code given in my application and called my painting function for printing. Then used Adobe Professional as printer to print the output to a pdf file. When I opened the file, I could see the text only at 1000% or above. The font is so small that, I could not see anything at 100% zoom. Can anybody know why is this happening like this? I could see it properly on screen (I mean, when the dc is being drawn with paintdc).
Thanks,
KVRN Kiran Kumar.
|
|
|
|
|
Hi there!
Do you know how can I print a CRichEditView from a CWinThread (not the main thread)?
The idea is to have a thread pool, to perform some tasks, one of them can be printing a document in RTF, and to do this I'm using the CRichEditView, so I can count pages, format text, etc.
I'm using a Print function in my RichEditView class, that does something like:
CFrameWnd *pFrame=new CFrameWnd;
if (!pFrame->Create(NULL, "Frame_Report"))
return;
if (Create(NULL, "Report", WS_CHILD|WS_VISIBLE, CRect(0,0,1,1), pFrame, 0))
{
SendMessage(WM_COMMAND,(WPARAM)ID_FILE_PRINT_DIRECT,0);
}
In the debug version I get several asserts, in the release the app crashes... The good thing is that I get the doc printed!
Do you have any suggestion?
ALMC
|
|
|
|
|
Hi,
Refering to Chris Maunder's article "Printing without the Document / View Framework", in the OnPrint(CDC* pDC, CPrintInfo* pInfo) function he states to "do your drawing/printing exactly as you would in a CView::OnDraw() function". But the first thing CMyView::OnDraw function does is CMyDocument pDoc=GetDocument() (which I need to access the path of the document). When I try this in Chris Maunder's OnPrint(CDC* pDC, CPrintInfo* pInfo) the application compiles but it bombs during linking. Does anyone see where I'm confused?
Buck
|
|
|
|
|
Hi Chris,
When I do a printing using CDC::StartPage()/CDC::EndPage(), the printer will not starting printing until the it hits/executes CDC::EndDoc(). Whereas when you are using StartPagePrinter()/EndPagePrinter(), the printer will start printing as soon as it hits EndPagePrinter().
That means if I have 1000page spool file and my printer is set to "Start Printing Immediately"; using CDC::StartPage()/CDC::EndPage(), I have to wait until 1000page is completely spooled before it starts printing. However, if I am using StartPagePrinter()/EndPagePrinter(), as soon as the first page is completely spooled, it starts printing.
Is there any way I can force to do immediate printing using CDC::StartPage()/CDC::EndPage()?
Thanks for your help in advance...
Cheers...
|
|
|
|
|
Hy,
This code sniplet working good in my application.
Also I would call just the PREVIEW part of Print/Preview.
How can I call directly the preview?
Regards,
Zoltan
|
|
|
|
|
How, specifically do I specify which printer to use. I don't want the default printer, I don't want the user to specify it, and I've tried using the EnumPrinter class, which doesn't work for the code above. Well I shouldn't it doesnt work. It does change the default printer within the App class, but not in this printer class or system wide. There must be a couple lines of code that will do this. Please somebody must know how to do this.
|
|
|
|
|
Try this:
<br />
CPrintDialog printDlg(FALSE);<br />
printDlg.DoModal();<br />
Hope it helps
Cheers...
|
|
|
|
|
I want to change my page size to 89mm x 24mm, for printing labels. Currently, if I want to just pring one label, i have to print off an entire 11" sheet (due to the default page size being 8.5 x 11). I want the dot matrix printer to stop after 24mm. I want the program to do this so that the user doesn't have to. I'd also like to specify which printer to use. How specifically do I do this, and based upon the functions above, where do i put the code? Thanks.
|
|
|
|
|
|
Hi, how can I change the values on the CPrintDialog box. I will select another type of paper or the orientation automaticaly, and at the moment this selection must to be manualy every time that a document was printed.
|
|
|
|
|
There are two errors in this article
after the line
if (printDlg.DoModal() == IDCANCEL)
return;
you must put
info.SetMinPage(info.GetFromPage());<br />
info.SetMaxPage(info.GetToPage()); or the selected range of pages will not print correctly
in the line
for (UINT page = Info.GetMinPage();<br />
page <= Info.GetMaxPage() && bPrintingOK; <br />
page++)
you must add && info.m_bContinuePrinting so you cen stop printing in OnPrint function when you don't know max number of pages
|
|
|
|
|
Hi,
I am having a csrollview where some data is being rendered. I want this data to be printed..I am unable to find anything on it.. can anyone help me out.. there is also a small problem.. like I have the vertical and horizontal scrollbars attched to the same.. but the vertical scrollbar is not working the way it should.. I mean if i drag the bar by mouse it either goes up (max) or below (min). I want to drag it by mouse and remain there where i leave.. Hope that both can be solved.. Looking forward to a solution from you people. Thanks a lot in advance..
Regards,
Himanshu
|
|
|
|
|
hai
I have set of graphs in one tabbed window.
I have to print all of these graphs. At present
i can print graphs by keeping print option
for each graph. My need is i have to print
all of these graphs in one click. I tried it. But
i am getting print dialog box each time before
printing each graph.How to avoid print dialog box
appearing each time.
Regards
sakthi
|
|
|
|
|
Hi Sakthi,
Do you mind to shoot some sample code? If yes, you might want to pay attention on DoModal() function.
For example:
<br />
CPrintDialog printDlg(FALSE);<br />
printDlg.DoModal();
Cheers...
|
|
|
|
|
Just do this:
<br />
CPrintDialog printDlg( FALSE );<br />
printDlg.GetDefaults();<br />
<br />
dc.Attach( printDlg.GetPrinterDC() );
|
|
|
|
|
Thanks, I was scouring the internet looking for just that solution. "printDlg.GetDefaults()" is supper important if you want to run without the dialog.
|
|
|
|
|
Hey,
I am using this code, and when I print on a regular printer it prints fine, but when I try to print on a laster printer, it prints all wrong, text gets pushed close together and text gets printed on top of each other.
Is there something the matter with my code or does it have to do with Laser Printers?
|
|
|
|