D Declan Well-Known Member Licensed User Longtime User Apr 19, 2022 #1 Hi, I am using the following code to take a Snapshot of a panel that is 200 X 110. I then print the image to a printer. B4X: MainForm = Form1 MainForm.RootPane.LoadLayout("2") 'Load the layout file. MainForm.Show Dim m As Image = MainForm.RootPane.Snapshot Dim cv As Canvas cv.Initialize("") cv.DrawImage(m,0,0,200,100) Dim P As Printer = Printer_Static.GetDefaultPrinter Dim PJ As PrinterJob = PrinterJob_Static.CreatePrinterJob2(P) PJ.PrintPage(cv) PJ.PrintPage(pnlQR) PJ.EndJob This works great. However, the printed image is large and I must reduce the size of the image printed to fit onto the label. Is there a function that will allow me to Scale or Resize the image prior to printing?
Hi, I am using the following code to take a Snapshot of a panel that is 200 X 110. I then print the image to a printer. B4X: MainForm = Form1 MainForm.RootPane.LoadLayout("2") 'Load the layout file. MainForm.Show Dim m As Image = MainForm.RootPane.Snapshot Dim cv As Canvas cv.Initialize("") cv.DrawImage(m,0,0,200,100) Dim P As Printer = Printer_Static.GetDefaultPrinter Dim PJ As PrinterJob = PrinterJob_Static.CreatePrinterJob2(P) PJ.PrintPage(cv) PJ.PrintPage(pnlQR) PJ.EndJob This works great. However, the printed image is large and I must reduce the size of the image printed to fit onto the label. Is there a function that will allow me to Scale or Resize the image prior to printing?
TILogistic Expert Licensed User Longtime User Apr 20, 2022 #2 ? B4X: Dim m As Image = MainForm.RootPane.Snapshot.As(B4XBitmap).Resize(200,100,True) Dim cv As Canvas cv.Initialize("") cv.DrawImage(m,0,0,m.Width,m.Height) Upvote 0
? B4X: Dim m As Image = MainForm.RootPane.Snapshot.As(B4XBitmap).Resize(200,100,True) Dim cv As Canvas cv.Initialize("") cv.DrawImage(m,0,0,m.Width,m.Height)
D Declan Well-Known Member Licensed User Longtime User Apr 20, 2022 #3 Omar Parra A. said: ? B4X: Dim m As Image = MainForm.RootPane.Snapshot.As(B4XBitmap).Resize(200,100,True) Dim cv As Canvas cv.Initialize("") cv.DrawImage(m,0,0,m.Width,m.Height) Click to expand... many thanks - sorted Upvote 0
Omar Parra A. said: ? B4X: Dim m As Image = MainForm.RootPane.Snapshot.As(B4XBitmap).Resize(200,100,True) Dim cv As Canvas cv.Initialize("") cv.DrawImage(m,0,0,m.Width,m.Height) Click to expand... many thanks - sorted