Canvas print A4

Hello group, I have a form with a CANVAS where I upload some images. Is it possible to print the image in A4 format? or, open the image with the windows viewer and then print it?

You may want to learn about printing in the Xojo documentation:

Once you get the graphics object for a printer, you can draw the picture you have there.

I have the image on Canvas with the PATH on a textbox. I would like to use the Windows PAINT to modify it, turn it over and save it. But it doesn’t work … I have read the documentation I have at least managed to open the paint, but I cannot load the photo.

My Code:

Dim s As Shell
s = New Shell
s.Execute("%windir%\system32\mspaint.exe -ls ",PathImmagine)

Where i wrong ?

Hello, nothing, I’ve been trying for a few days and I can’t find any documentation. I have to open a file with paintbruwh of Windows, and I can’t.

Check the folderitem class.
Either Launch or Open method.

What exactly is in PathImmagine ?
Maybe it is the wrong path format.
Maybe it needs quotes’

s.Execute("%windir%\system32\mspaint.exe -ls ", chr(34) + PathImmagine + chr(34) )

Just turning the image back to front / upside down and saving , doesn’t really need Paint.
Are you adding other details?

I would like to use PAINT to retouch the images, even as an exercise, because that’s what I want to do but I can’t. Now I place the Path of the image and the error that gives me when I try to open the Path

Next time, it might be useful for me to open a txt file or an xls file for example.
1 Path
2 Errore

if I write:

Dim s as new shell 

I open the image with the default windows viewer, but I would like to open it with Paint.
If i write:

s.Execute("%windir%\system32\mspaint.exe -ls ", chr(34) + PathImmagine + chr(34) )

retunr an error because not open a file.

Have you tried

s.Execute("%windir%\system32\mspaint.exe -ls")

Does it launch the Paint app ?

What is the content of PathImmagine ? Could you post it ?

What is this -ls supposed to do?

Seems to work fine for me without that…

no, return an error .

@Federico_Giannetti AGAIN:

Have you tried


Does it launch the Paint app ?

What is the content of PathImmagine ? Could you post it ? Could you post the code ?

What error exactly?
What is the content of PathImmagine ?
We shouldn’t need to guess.

When I used

%windir%\system32\mspaint.exe mypic.png

it opened.

Only when I used
%windir%\system32\mspaint.exe -ls mypic.png

I get the error that -ls.png is not found.

1 Like

Si, pensavo di averlo scritto prima.
Quando lancio Dim s as new shell
s.Execute(“%windir%\system32\mspaint.exe”) si apre il Paintbrush.
Ma non capisco come far aprire la Path dell’immagine. La path dell’immagine che vorrei aprire è: C:\Users\Federico\Desktop\TEST XOJO\MioMagazzino\BozzeDisegniProgetti\146_Fruttagel.jpg

Hi Jeff. Sorry, I thought that among the information written before there was all the data of my problem. The problem is that I can launch PaintBrush, but I cannot launch it with the image whose Path I know. The path, for example, is of the type: C:\Users\Federico\Desktop\TEST XOJO\MioMagazzino\BozzeDisegniProgetti\146_Fruttagel.jpg

Writing: s.Execute("%windir%\system32\mspaint.exe "+PathImmagine) paintbrush opens but does not open the image to me.

Ok guys, don’t hate me :slight_smile: While I was writing to you, it occurred to me to go and peek at an old project written in VB6. The syntax I used to open an image with paint was the following: Shell “mspaint.exe” & Space (1) & Chr (34) & tempFilename & Chr (34), vbMaximizedFocus

I changed the Xojo code to:

s.Execute (“% windir% \ system32 \ mspaint.exe” + Chr (34) + PathImage + chr (34))
and that’s how it works.
[/code ]

I write it in case someone needs it.
As always, thank you for your time and support.

1 Like

just one question, there is something in Xojo to maximize the window opening. In VB6 it was vbMaximizedFocus.


Yeah, I think you’ll find I mentioned that this morning… :slight_smile:

just one question, there is something in Xojo to maximize the window opening.

Xojo doesnt have that.
Internet search suggests you MIGHT have some success using something like this (untested)

“START /MAX %windir%\system32\mspaint.exe” + Chr (34) + PathImage + chr (34)

Yes Jeff, I used your code, but there was something wrong, it opened the paint and told me something about the command -ls, not over, maybe the spaces … the important thing is that now it works :slight_smile:

And: s.Execute("START /MAX %windir%\system32\mspaint.exe "+Chr(34) + PathImmagine + chr(34)) WORK FINE !!! Thanks !!!