Hi, I'm Rodrigo and I will help you.
The "Microsoft Print to PDF" PDF printer does not have an option to set custom paper sizes, you will need to use a third-party PDF printer to achieve this custom paper size.
CutePDF is a free PDF printer option that allows setting a custom paper size, download it at the link below:
https://www.cutepdf.com/download/CuteWriter.exe
Standard Disclaimer: This is a non-Microsoft website. The page appears to be providing accurate, safe information. Watch out for ads on the site that may advertise products frequently classified as a PUP (Potentially Unwanted Products). Thoroughly research any product advertised on the site before you decide to download and install it.
During the installation, it will ask to install another software; it is needed to make CutePDF work. Select yes to install.
To set the custom paper size, select the CutePDF Writer printer > Printer Properties > Advanced... > On "Paper Size", select Postscript Custom Page Size > Set the page size dimension > OK > OK > OK.