When you are purchasing the HP printer, in the Box or in Printer Specifications, it will be mentioned in it. If you are using Windows XP, then in that case it is important to check out that whether it will work or not. Whereas in all the windows higher versions, HP printers will be compatible, if you are still unable to connect your printer with your PC, then in that case visit the following webpage:
and feed your HP model number and select your operating system and download the printer driver, then install it. After that the printer will get connected to your PC.