为有中文需求的客户提供多渠道中文技术支持.

Tue Aug 31, 2021 9:07 am

spire for java, convert pdf to docx

I integrate the SDK to springboot. When we request the api first time when the server starting, the code will report an error. And when we request the api the second time or more... , it works normal. I don't know why? Anyone can help?

Code: Select all
  @Async
  @Override
  public void docConvStartAsync(Params p) {
     docConvStart(p);
  }


  @Override
  public File docConvStart(Params p) {
     return pdf2docx(p);
  }

private File pdf2docx(Params p) {
   try {
      String fileName = "xxx.pdf";
      doc = new PdfDocument();
      doc.loadFromFile(myFileDir + "/" + fileName);

      String targetFileName = "xxx.docx";
      String targetFilePath = myFileDir + "/" + targetFileName;
      doc.saveToFile(targetFilePath, com.spire.pdf.FileFormat.DOCX);
      File outFile = new File(targetFilePath);
      return outFile;
   } catch(Exception e) {
     log(e) // we will get error in this place
   }
}




Code: Select all
Error Message:

com.spire.office.packages.sprdce: Neutral cultures cannot be used in formatting and parsing and therefore cannot be set as the thread's current culture

spirelsqswl
 
Posts: 1
Joined: Tue May 11, 2021 9:22 am

Tue Aug 31, 2021 9:42 am

Hello,

Thanks for your inquiry.
Please set the default locale as follows.
Code: Select all
            Locale newLocale = Locale.ROOT;
            Locale.setDefault(newLocale);


If the issue persists after trying, to help us investigate further, please provide your OS information (e.g. Win7 64bit), your region setting (e.g. China, Chinese) and your input file. You can send them to us (support@e-iceblue.com) via email. Thanks in advance.

Sincerely,
Brian
E-iceblue support team
User avatar

Brian.Li
 
Posts: 1252
Joined: Mon Oct 19, 2020 3:04 am

Wed Sep 08, 2021 2:34 am

Hello,

Greetings from E-iceblue!
How is your issue now? Could you please give us some feedback at your convenience?

Sincerely,
Brian
E-iceblue support team
User avatar

Brian.Li
 
Posts: 1252
Joined: Mon Oct 19, 2020 3:04 am

Return to 中文技术支持

cron