ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 PrintImage - issue
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

graph_man

328 Posts

Posted - Oct 19 2017 :  12:07:14  Show Profile  Reply
PrinterSetupDialog1->Execute();

Size => FitToPage

ImageEnView1->IO->PrintImage(MyPrinter->Canvas,MarginLeft,MarginTop,
MarginRight,MarginBottom,VerticalPos,HorizontalPos,
Size,SpecWidth,SpecHeight,GammaCorrection);


I try to change the paper size in the PrinterSetupDialog1
but the printed pages are the same size


ps
In previous versions of ImageEn, this worked without problems.

graph_man

328 Posts

Posted - Oct 19 2017 :  14:38:39  Show Profile  Reply
TPrinter *MyPrinter;
Go to Top of Page

xequte

39053 Posts

Posted - Oct 20 2017 :  00:38:32  Show Profile  Reply
Hi

There should be no recent changes that affect this. Can you confirm what version you were using previously that worked as expected so I can compare the code.



Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page

graph_man

328 Posts

Posted - Oct 20 2017 :  03:30:55  Show Profile  Reply
this was last year's version

I need to use
PrinterSetupDialog1->Execute();

to choose a printer and paper size
and print using

ImageEnView1->IO->PrintImage

Ho todo that?
Go to Top of Page

graph_man

328 Posts

Posted - Oct 20 2017 :  05:25:51  Show Profile  Reply
Program works again after removing this code (after PrinterSetupDialog1 and before PrintImage):

if (PrintCopies > 0)
{
	Printers::TPrinterOrientation orient2 = MyPrinter->Orientation;

	wchar_t ADevice[MAX_PATH];      // Printer Name                 ADevice[CCHDEVICENAME]
	wchar_t ADriver[MAX_PATH];      // Name of driver               ADriver[MAX_PATH]
	wchar_t APort[MAX_PATH];        // PortName/File/UNC Path       APort[MAX_PATH]
	THandle ADeviceMode;    // Handle to the memory area containing the DEVMODE structure
	PDEVMODE DevMode;       

	MyPrinter->GetPrinter(ADevice, ADriver, APort, ADeviceMode);

	if (ADeviceMode)
	{
		DevMode = (PDEVMODE)GlobalLock((void*)ADeviceMode);  

		if (DevMode != NULL)
		{
			DevMode->dmCopies = PrintCopies;

			if (prn_collate == true)
			{
				DevMode->dmCollate = DMCOLLATE_TRUE;
			}
			else
			{
				DevMode->dmCollate = DMCOLLATE_FALSE;
			}

			if (orient2 == poLandscape) DevMode->dmOrientation = DMORIENT_LANDSCAPE;
			if (orient2 == poPortrait) DevMode->dmOrientation = DMORIENT_PORTRAIT;

			//DevMode->dmFields = DM_COLLATE | DM_COPIES;
			DevMode->dmFields = DM_COLLATE | DM_COPIES | DM_ORIENTATION;

			MyPrinter->SetPrinter(ADevice, ADriver, APort, ADeviceMode);
		}

		GlobalUnlock(DevMode);
	}
}



Why? How to fix it?

I need to change
DevMode->dmCopies
DevMode->dmCollate
DevMode->dmOrientation

Is there other way?
Go to Top of Page

graph_man

328 Posts

Posted - Oct 24 2017 :  14:07:21  Show Profile  Reply
I have found a solution.
Go to Top of Page

xequte

39053 Posts

Posted - Oct 24 2017 :  21:01:27  Show Profile  Reply
Sorry, we were not of more help. Still catching up after our holiday.

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: