In Delphi 7, I have a library that uses the TCanvas component to output some information. The resulting image is about 4800 * 6000 pixels, and I would like to print it and save it as .jpeg.
To achieve this, I created TBitmap and passed it Canvas as a parameter to the library, and then assigned the jpeg bitmap. Apparently, this takes up too much memory, because I get an exception when I try to set the width and height of the bitmap, saying: "There is not enough memory to process this command."
Printer.BeginDoc();
doPrint(Printer.Canvas);
Printer.EndDoc();
bmp := TBitmap.Create;
bmp.Width := Printer.PageWidth;
bmp.Height := Printer.PageHeight;
doPrint(bmp.Canvas);
jpg := TJPEGImage.Create;
jpg.Assign(bmp);
jpg.SaveToFile('...');
bmp.Free();
jpg.Free();
What am I doing wrong? Can I save Printer.Canvas directly as a file .jpeg?
: 2000 * 2000 4800 * 6000