windows c ++将图像发送到打印机,(打印)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2332701/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 14:01:30  来源:igfitidea点击:

c++ sending image to printer , (PRINT)

c++windowsimageprintingmfc

提问by Armen Khachatryan

this is code which i use to make image.

这是我用来制作图像的代码。

Bitmap bitmap;
bitmap.CreateBitmap(715, 844,1,1, NULL);

CDC memDC;
memDC.CreateCompatibleDC(NULL);
memDC.SelectObject(&bitmap);

CString SS="Sun Goes Down";
 memDC.TextOutA(1,2,SS);

        CImage image;
        image.Attach(bitmap);
        image.Save(_T("C:\test.bmp"), Gdiplus::ImageFormatJPEG);

and all is ok , now all i want is to send that image to print...

一切都好,现在我只想将该图像发送到打印...

i use

我用

    DWORD pcchBuffer=100;

  char * pszBuffer=new char[100];

 GetDefaultPrinter(pszBuffer,&pcchBuffer);

again all is ok.

再次一切正常。

to get defaulet printername , for print i know WritePrinter function, but that fonction gives argumens LPVOID buffer to print , how can i send my image to print? Many many Thanks!

要获得默认的打印机名称,对于打印,我知道 WritePrinter 函数,但是该函数为参数 LPVOID 提供了打印缓冲区,我如何发送图像进行打印?非常感谢!

回答by Patrick

Instead of making the image, saving it, then printing it, you should:

而不是制作图像,保存,然后打印它,您应该:

Look for all the detailed steps on MSDN.

在 MSDN 上查找所有详细步骤。