There might be a fancier way, but one way to deal with this is to preprocess the html and replace the path to the css with something like `getClass().getResource("/templates/css/stylesheet.css").toExternalForm()` (or getServletContext().getRealPath() if you are in a servlet)
e.g.
final ITextRenderer renderer = new ITextRenderer();
var cssPath = getClass().getResource("/templates/css/stylesheet.css").toExternalForm();
renderer.setDocumentFromString(html.replace("classpath:templates/css/stylesheet.css", cssPath));
renderer.getFontResolver().addFontDirectory(properties.fonts(), EMBEDDED);
renderer.layout();
final ByteArrayOutputStream pdf = new ByteArrayOutputStream();
renderer.createPDF(pdf);
write(properties.output(), pdf.toByteArray());