Java reads a pdf file using PdfBox, and uses the following code for branching
String[] lineContent = substring.split("\r\n");
Running and testing in win, there is no problem, but after deploying to the linux system, there is a branch error. The reason for the error is that the line break in the linux system is different from that in win. In linux, it should be branched like this
String[] lineContent = substring.split("\n");
Comparing line breaks in Linux, Windows, and Mac
For the line feed action, there is generally only one 0x0A for line feed ("\n") under Unix, and 0x0D and 0x0A are generally two characters under Windows, that is, 0D0A ("\r\n"), Mac OS (MAC OS system) Then use the carriage return character CR to indicate the next line ("\r").
1. In the Unix system: the end of each line is only "<line feed>", that is, "\n";
2. In the Windows system: the end of each line is "<carriage return><line feed>", that is, "\r\n";
3. In the Mac system: the end of each line is "<carriage return>", that is, "\r".