By emitting a laser through heat-resistant glass, it is possible to perform marking on high-temperature workpieces directly after they have been removed from the die-casting machine. Easy-to-read 2D codes can be marked regardless of workpiece temperature.