That code is for sending
raw printer data to a printer, effectively bypassing the printer driver which normally translates it into something the printer hardware can understand. It expects that the data it reads from a file is already compatible with the exact make and model of printer you are using.
A PDF file is not, it's a general purpose file description language, which needs to be translated and sent via the printer driver.
What you are doing at the moment is effectively passing a Japanese-to-Swahili dictionary to a Swedish speaker and expecting him to understand the story... :laugh:
If you want to print a receipt (with an image or not) look at using a
PrintDocument[
^] instead - the link includes an example.