protected void doWriteHeader(COSDocument doc) throws IOException {
        String headerString;
        if (fdfDocument != null) {
            headerString = "%FDF-" + doc.getVersion();
        } else {
            headerString = "%PDF-" + doc.getVersion();
        }
        getStandardOutput().write(headerString.getBytes(StandardCharsets.ISO_8859_1));

        getStandardOutput().writeEOL();
        getStandardOutput().write(COMMENT);
        getStandardOutput().write(GARBAGE);
        getStandardOutput().writeEOL();
    }
This will write the header to the PDF document.

@param doc The document to get the data from.
@throws IOException If there is an error writing to the stream.
tika-fuzzing/src/main/java/org/apache/tika/fuzzing/pdf/EvilCOSWriter.java