|
다음과 같이 프린트하도록 프로그램을 했는데요.
이것을 파일로 저장하려면 어떻게 해야 하나요.-일반파일이 아니면 이미지 파일이라도
저장하고 싶은데 어느 부분을 고쳐서 해결이 되나요.
TPrinterOrientation OldOrientation;
OldOrientation=Printer()->Orientation;
Screen->Cursor = crHourGlass;
try
{
TPrinter* p = Printer();
TCanvas* c = p->Canvas;
Graphics::TBitmap *bmap = new Graphics::TBitmap;
Graphics::TBitmap *bmap2 = new Graphics::TBitmap;
bmap->LoadFromFile(ExtractFileDir(ParamStr(0))+String("\\이미지\\hh.bmp"));
bmap2->LoadFromFile(ExtractFileDir(ParamStr(0))+String("\\이미지\\bottom.bmp"));
//Printer()->Orientation=poLandscape; // <-- Force Horizontal paper
p->Orientation = poLandscape;
p->BeginDoc();
try
{
HDC dc = c->Handle;
int XPI = GetDeviceCaps(c->Handle,LOGPIXELSX);
int YPI = GetDeviceCaps(c->Handle,LOGPIXELSY);
SetMapMode(dc,MM_ANISOTROPIC);
SetWindowExtEx(dc,1000,1000,NULL);
SetViewportExtEx(dc,XPI,YPI,NULL);
SetViewportOrgEx(dc,-GetDeviceCaps(dc,PHYSICALOFFSETX),-GetDeviceCaps(dc,PHYSICALOFFSETY),NULL);
c->Rectangle(200,200,11500,8000);
TRect MarkPos;
MarkPos=Rect(200,200,11500,1000);
c->StretchDraw(MarkPos,bmap);
.......................
p->EndDoc();
}
catch (...) {
p->Abort();
p->EndDoc();
throw; // <-- rethrow the exception !!!
}
|