Click here to Skip to main content
15,900,429 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Copy From System to USB or USB to Sustem Pin
Le@rner4-Aug-08 23:31
Le@rner4-Aug-08 23:31 
GeneralRe: Copy From System to USB or USB to Sustem Pin
NewVC++4-Aug-08 23:42
NewVC++4-Aug-08 23:42 
GeneralRe: Copy From System to USB or USB to Sustem Pin
Le@rner5-Aug-08 0:15
Le@rner5-Aug-08 0:15 
QuestionQuick Newbie question about naming conventions Pin
Megidolaon4-Aug-08 21:51
Megidolaon4-Aug-08 21:51 
AnswerRe: Quick Newbie question about naming conventions Pin
_AnsHUMAN_ 4-Aug-08 22:11
_AnsHUMAN_ 4-Aug-08 22:11 
AnswerRe: Quick Newbie question about naming conventions Pin
not_in_use5-Aug-08 11:37
not_in_use5-Aug-08 11:37 
AnswerRe: Quick Newbie question about naming conventions Pin
Megidolaon5-Aug-08 20:41
Megidolaon5-Aug-08 20:41 
QuestionPrinting bitmap to PDF, but it gets clipped because of virtual printer's paper size Pin
sashoalm4-Aug-08 21:42
sashoalm4-Aug-08 21:42 
Hi,

I've got this problem and I can't solve it - I either have to rescale the image or somehow make the printer use page size equal to the image size - it should be able to do so, it's a virtual printer and not constrained by real paper sizes.

I think that using SetMapMode on the printer HDC can make it fit into the page size (like an implicit rescaling) but I don't know how to do it.

So is there any way to avoid this clipping? Any help would be greatly appreciated.

Here is the code I use (it makes clipped images):

ULONG_PTR m_gdiplusToken;
Gdiplus::GdiplusStartupInput gdiplusStartupInput;
Gdiplus::GdiplusStartup(&m_gdiplusToken, &gdiplusStartupInput, NULL);

Image* img = Image::FromFile(wstrFileName);

HDC hPrinterDC;
hPrinterDC = CreateDC("WINSPOOL\0", szVirtPrn, NULL, NULL);
if (hPrinterDC)
{
	DOCINFO di = {0};
	memset( &di, 0, sizeof(DOCINFO) );
	di.cbSize = sizeof(DOCINFO);
	di.lpszDocName = "DocName";
	di.lpszOutput = (LPTSTR) NULL;
	di.lpszDatatype = (LPTSTR) NULL;
	di.fwType = 0;
	
	int nResult = StartDoc(hPrinterDC, &di);
	if (nResult > 0)
	{
		nResult = StartPage(hPrinterDC);
		if (nResult > 0)
		{
			Graphics* g = Graphics::FromHDC(hPrinterDC);
			g->DrawImage(img, 0, 0);
			
			nResult = EndPage(hPrinterDC);
		}	
	}
	
	nResult = EndDoc(hPrinterDC);
	DeleteDC(hPrinterDC);
}


There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal

AnswerRe: Printing bitmap to PDF, but it gets clipped because of virtual printer's paper size Pin
SandipG 4-Aug-08 23:08
SandipG 4-Aug-08 23:08 
GeneralRe: Printing bitmap to PDF, but it gets clipped because of virtual printer's paper size [modified] Pin
sashoalm4-Aug-08 23:25
sashoalm4-Aug-08 23:25 
GeneralRe: Printing bitmap to PDF, but it gets clipped because of virtual printer's paper size Pin
SandipG 4-Aug-08 23:31
SandipG 4-Aug-08 23:31 
GeneralRe: Printing bitmap to PDF, but it gets clipped because of virtual printer's paper size Pin
sashoalm4-Aug-08 23:39
sashoalm4-Aug-08 23:39 
GeneralRe: Printing bitmap to PDF, but it gets clipped because of virtual printer's paper size Pin
SandipG 4-Aug-08 23:48
SandipG 4-Aug-08 23:48 
QuestionConverting ASCII file format to unicode file format. Pin
Ahmad Zubair4-Aug-08 21:08
Ahmad Zubair4-Aug-08 21:08 
AnswerRe: Converting ASCII file format to unicode file format. Pin
sudhir_Kumar4-Aug-08 22:03
sudhir_Kumar4-Aug-08 22:03 
AnswerRe: Converting ASCII file format to unicode file format. Pin
krmed5-Aug-08 0:52
krmed5-Aug-08 0:52 
GeneralRe: Converting ASCII file format to unicode file format. Pin
Ahmad Zubair5-Aug-08 1:02
Ahmad Zubair5-Aug-08 1:02 
GeneralRe: Converting ASCII file format to unicode file format. Pin
krmed5-Aug-08 7:48
krmed5-Aug-08 7:48 
Questionproblem with ReceiveFrom() function Pin
sunny_vc4-Aug-08 20:38
sunny_vc4-Aug-08 20:38 
AnswerRe: problem with ReceiveFrom() function Pin
Varghese Paul M4-Aug-08 21:23
Varghese Paul M4-Aug-08 21:23 
GeneralRe: problem with ReceiveFrom() function Pin
sunny_vc4-Aug-08 21:27
sunny_vc4-Aug-08 21:27 
AnswerRe: problem with ReceiveFrom() function Pin
sudhir_Kumar4-Aug-08 22:11
sudhir_Kumar4-Aug-08 22:11 
GeneralRe: problem with ReceiveFrom() function Pin
sunny_vc4-Aug-08 22:19
sunny_vc4-Aug-08 22:19 
GeneralRe: problem with ReceiveFrom() function Pin
sudhir_Kumar4-Aug-08 22:37
sudhir_Kumar4-Aug-08 22:37 
GeneralRe: problem with ReceiveFrom() function Pin
sunny_vc4-Aug-08 22:48
sunny_vc4-Aug-08 22:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.