Skip to content

Commit

Permalink
Merge pull request #20 from anastaciocintra/fix-writeLF
Browse files Browse the repository at this point in the history
Fix write lf
  • Loading branch information
anastaciocintra authored Oct 2, 2019
2 parents 1e3a82c + edf8087 commit 6eace74
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ public EscPos write(String text) throws UnsupportedEncodingException, IOExceptio
*/
public EscPos writeLF(Style style, String text) throws UnsupportedEncodingException, IOException {
write(style, text);
feed(1);
write(10);
return this;
}

Expand Down Expand Up @@ -399,11 +399,15 @@ public EscPos feed(Style style, int nLines) throws IOException, IllegalArgumentE
if (nLines < 1 || nLines > 255) {
throw new IllegalArgumentException("nLines must be between 1 and 255");
}
byte[] configBytes = style.getConfigBytes();
write(configBytes, 0, configBytes.length);
write(ESC);
write('d');
write(nLines);
if(nLines == 1){
write(LF);
}else {
byte[] configBytes = style.getConfigBytes();
write(configBytes, 0, configBytes.length);
write(ESC);
write('d');
write(nLines);
}
return this;

}
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<packaging>pom</packaging>

<properties>
<revision>2.0.0</revision>
<revision>2.0.2</revision>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
Expand Down

0 comments on commit 6eace74

Please sign in to comment.