my doc file with cyrillic do not converting to PDF properly, all words in paragraph are joined to one
Source:
Result:
Code example
- Code: Select all
import java.io.ByteArrayOutputStream
import com.spire.doc.{ Document, FileFormat }
import com.spire.pdf.{ PdfDocument, PdfPageBase }
import scala.jdk.CollectionConverters._
object SpireDocToPDFExample extends App {
val pathToDoc = "/home/pavel/template.doc"
def test(): Unit = {
val document = new Document(pathToDoc)
document.getLastSection.addParagraph().appendText("четыре пять шесть")
println(document.getText)
val baos = new ByteArrayOutputStream()
document.saveToStream(baos, FileFormat.PDF)
val doc = new PdfDocument(baos.toByteArray)
val headPage = doc.getPages.iterator().asScala.collect { case p: PdfPageBase => p.extractText() }.toList
headPage.foreach(println)
}
test()
}
Programmatically added paragraph converted correct
Thanks
spire.doc.free 3.9.0
spire.pdf.free 3.9.0