Stop printing with GPIO's

Hey, I'm new and hope to get some help.
I've searched for this topic but couldn't find something, sorry if it already has been discussed.
I would love to stop the print with a button on the GPIO's, but don't know how the command should look like and where to integrate it.

Would appreciate your help!

Greetings from Germany!