For security reasons, I cannot share the problematic PDF file.
The garbled text originally occurred when using the reader.GetPlainText() method from the demo.
After switching to the following approach:
for i := 1; i <= reader.NumPage(); i++ {
text, e := reader.Page(i).GetPlainText(nil)
if e != nil {
continue
}
if _, e = w.Write([]byte(text)); e != nil {
continue
}
}
to extract the content page by page, the garbled text issue no longer occurs.
For security reasons, I cannot share the problematic PDF file.
The garbled text originally occurred when using the
reader.GetPlainText()method from the demo.After switching to the following approach:
to extract the content page by page, the garbled text issue no longer occurs.