-
Notifications
You must be signed in to change notification settings - Fork 152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
where is isSameSentence() ? #17
Comments
I have the same question too! |
I'm not sure what's the actual intended behaviour, but this worked for me at some level (although I ended up manually parsing the text output of func isSameSentence(text pdf.Text, lastTextStyle pdf.Text) bool {
return (text.Font == lastTextStyle.Font) && (text.FontSize == lastTextStyle.FontSize) && (text.X == lastTextStyle.X)
} |
For future visitors, the above It might be useful to say that something is of the same sentence if it has the same font and font-size. In which case the function definition you'd want would be func isSameSentence(text pdf.Text, lastTextStyle pdf.Text) bool {
return (text.Font == lastTextStyle.Font) && (text.FontSize == lastTextStyle.FontSize)
} That really isn't true to the definition of "sameSentence" here, so you may want to check to see if a period was present in lastTextStyle before return true and effectively adding on the character to the text that get's printed along-side it's text style. func isSameSentence(text pdf.Text, lastTextStyle pdf.Text) bool {
return (text.Font == lastTextStyle.Font) && (text.FontSize == lastTextStyle.FontSize) && strings.Contains(lastTextStyle, ".")
} |
No description provided.
The text was updated successfully, but these errors were encountered: