PrintNewPage example for C++ 5.0 and later
ILEADRasterIO *pRasterIO=NULL;
ILEADRasterProcess *pRasterProc=NULL;
float HeightFactor, WidthFactor, HeightAllowed, WidthAllowed;
float ControlWidth, ControlHeight;
long MyPrinter=0;
CoCreateInstance(CLSID_LEADRasterIO, NULL,
CLSCTX_ALL, IID_ILEADRasterIO,
(void**)&pRasterIO);
CoCreateInstance(CLSID_LEADRasterProcess, NULL,
CLSCTX_ALL, IID_ILEADRasterProcess,
(void**)&pRasterProc);
//change this to a file on your system
pRasterIO->Load(m_LEADRasterView1.GetRaster(), "v:\\images\\eagle.cmp", 0, 1, 1);
//note, there will be no samples for other platforms, this function is not necessary in other languages):
// Set the variables used for preserving the aspect ratio.
HeightFactor = m_LEADRasterView1.GetRaster().GetBitmapHeight();
WidthFactor = m_LEADRasterView1.GetRaster().GetBitmapWidth ();
// Allow a maximum of 3x3 inches on a 300dpi printer
HeightAllowed = 900.0f;
WidthAllowed = 900.0f;
// Print the LEAD control, preserving the aspect ratio.
// Check to see if using the maximum width will make the image too tall.
// Set the dimensions based on the result.
if(((WidthAllowed * HeightFactor) / WidthFactor) < HeightAllowed)
{
ControlWidth = WidthAllowed;
ControlHeight = (ControlWidth * HeightFactor) / WidthFactor;
}
else
{
ControlHeight = HeightAllowed;
ControlWidth = (ControlHeight * WidthFactor) / HeightFactor;
}
//start the print job
MyPrinter = m_LEADRasterView1.PrintStart ();
m_LEADRasterView1.Render (MyPrinter, 0.0f, 0.0f, ControlWidth, ControlHeight);
//flip the image
pRasterProc->Flip(m_LEADRasterView1.GetRaster());
//start a new page
m_LEADRasterView1.PrintNewPage(MyPrinter);
//print the flipped image
m_LEADRasterView1.Render (MyPrinter, 0.0f, 0.0f, ControlWidth, ControlHeight);
//end the print job
m_LEADRasterView1.PrintEnd (MyPrinter);
pRasterIO->Release();
pRasterProc->Release();