It's pretty easy if you remember what "dpi" actually means: "Dots per inch." Dots = pixels (sorta, but for these purposes it's close enough). So if you have A4, which is 8.3" x 11.7", you need to know how many "dots" (pixels) fit into that area. 300 dots per 8.3" is 300 x 8.3 = 2490. That's only if you can print all the way to the edge, though, so probably plan on losing at least half an inch in each direction, making it more like 7.8 x 11.2.

7.8 x 300 = 2340
11.2 x 300 = 3360

Those would be your maximum pixel dimensions for A4 with a quarter-inch margin printed at 300dpi. You do have to make sure the printer driver honors that resolution, though. It may not be carried along in the metadata of the image for one reason or another, or the printer may ignore it. If the print resolution is not read from the file and you use some default, it may print at 100 dpi or even as low as 72 if the printer assumes an ancient Macintosh screen standard, resulting in a much larger print than you expected. If you force the printer to 300dpi mode, though, it should print at the expected size.

Just make sure that the paper you're using can handle that ink load. Ordinary copy paper will be saturated at that resolution; colors will run, and the paper will warp.