Skip to content

Commit

Permalink
Fix bug related to whitespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
JonathanLink committed Dec 11, 2018
1 parent c918261 commit 0778122
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
7 changes: 3 additions & 4 deletions PDFLayoutTextStripper.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Author: Jonathan Link
* Email: jonathanlink[d o t]email[a t]gmail[d o t]com
* Date of creation: 13.11.2014
* Version: 2.2.2
* Version: 2.2.3
* Description:
*
* Version 2.1 uses PDFBox 2.x. Version 1.0 used PDFBox 1.8.x
Expand All @@ -21,7 +21,7 @@
*
* The MIT License (MIT)
*
* Copyright (c) 2014-2017 Jonathan Link
* Copyright (c) 2014-2019 Jonathan Link
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -428,8 +428,7 @@ private boolean isCharacterCloseToPreviousWord(final TextPosition textPosition)
return false;
}
double numberOfSpaces = this.numberOfSpacesBetweenTwoCharacters(previousTextPosition, textPosition);
int widthOfSpace = (int) Math.ceil(textPosition.getWidthOfSpace());
return (numberOfSpaces > 1 && numberOfSpaces <= widthOfSpace);
return (numberOfSpaces > 1 && numberOfSpaces <= PDFLayoutTextStripper.OUTPUT_SPACE_CHARACTER_WIDTH_IN_PT);
}

private boolean isCharacterPartOfPreviousWord(final TextPosition textPosition) {
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,6 @@ public class test {
## Contributors
Thanks to

* Dmytro Zelinskyy for reporting an issue with its correction (v2.2.3)
* Ho Ting Cheng for reporting an issue (v2.1)
* James Sullivan for having updated the code to make it work with the latest version of PDFBox (v2.0)
* Ho Ting Cheng for reporting an issue (v2.1)

0 comments on commit 0778122

Please sign in to comment.