PDF is a binary format, and reading binary data into a string depending on the encoding assumed in that reading can damage the binary data.
Thus, if possible, don't retrieve the data as a string but instead as a byte array or byte buffer and store these bytes as they are.
As you confirmed in a comment,
I just received a array buffer and then wrote to file. It's working now!
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…