Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Wed Sep 09, 2020 11:47 am

We are using Spire.PDF in different culture scenarios, it works fine except for Norwegian culture (nb-NO)
This exception is thrown:
Invalid date string, after time" source="Spire.Pdf" detail="spr᜞: Invalid date string, after time at sprᜳ.ᜀ(String A_0, spr᜔ A_1) at sprᝤ.ᜁ(Nullable`1 A_0) at Spire.Pdf.PdfDocumentInformation.set_ModificationDate(DateTime value) at sprᣃ.ᜁ(Stream A_0) at


We are not setting any modification date, so I guess it is some internal function firing when doc is saved to MemoryStream - doc.SaveToStream(memStream);

Could you give us a hint what might be causing the issue?

Currently V 6.7.12 is used in our PROD environment.

jseibert
 
Posts: 11
Joined: Wed Jul 29, 2020 7:36 am

Thu Sep 10, 2020 6:57 am

Hello,

Thank you for your inquiry.
I tested your scenario but did not reproduce your issue. Since you are not using the latest version, I suggest you download the latest Spire.PDF Pack(Hot Fix) v6.9.0 and try again.
If the issue persists after trying, please provide your input PDF file and your full test code to help us investigate further. You can upload your file here or send them to us([email protected]) via email. Also, please tell us your OS information (E.g. Windows 7, 64 bit). Thanks in advance.

Sincerely,
Elena
E-iceblue support team
User avatar

Elena.Zhang
 
Posts: 279
Joined: Thu Jul 23, 2020 1:18 am

Thu Sep 10, 2020 1:16 pm

Hi Elena,
we tried the hotfix, but with the same results.
Can you tell us, what string is used in this case, so we can try to fix it on the system? The error is only on one of multiple servers present.

Thanks,
Peter

SYZYGYTech
 
Posts: 1
Joined: Thu Jul 30, 2020 6:55 am

Thu Sep 10, 2020 3:32 pm

Well, the culprit is, it works locally. Only on web server the issue occurs.
We are using Windows Server 2016, Version 1607 (OS Build 14393.3866). server culture: en-US
Site is served by IIS 10

The server does have multiple sites set up, on other sites the same code works without any issues.
Only Norwegian web is throwing, that's why our initial thought was it could be the Thread Culture.

Update: I've uploaded exact same PDF used in Norwegian site to another site (same physical server) and it works. So it seems to strip down to that special web and set up - back to cultureInfo?

jseibert
 
Posts: 11
Joined: Wed Jul 29, 2020 7:36 am

Fri Sep 11, 2020 9:53 am

Hi all,

Thanks for your more information.
According to your description, I tested your scenario on Windows Server 2016, but I was still unable to reproduce your issue. This is my test project for your reference, you can run it directly on your side.
If your code is different from mine, please share it with us. Also, please let me know whether this issue only occurs in a specific PDF file. If yes, please provide the corresponding file and then we will do further analysis.
Moreover, I recommend you can try to set the thread culture like the following code.
Code: Select all
CultureInfo cc = Thread.CurrentThread.CurrentCulture;
Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
//Your code…
Thread.CurrentThread.CurrentCulture = cc;


Sincerely,
Elena
E-iceblue support team
User avatar

Elena.Zhang
 
Posts: 279
Joined: Thu Jul 23, 2020 1:18 am

Fri Sep 11, 2020 10:51 am

Thanks for testing, I do not know what exactly causes that behaviour, the server is not managed by us.

But:
Code: Select all
      using (var memStream = new MemoryStream())
      {
        var uiCulture = Thread.CurrentThread.CurrentUICulture;
        var culture = Thread.CurrentThread.CurrentCulture;
        Thread.CurrentThread.CurrentUICulture = CultureInfo.InvariantCulture;
        Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
        doc.SaveToStream(memStream);

        Thread.CurrentThread.CurrentUICulture = uiCulture;
        Thread.CurrentThread.CurrentCulture = culture;
        return memStream.ToArray();
      }


when I do it that way, PDF saving works.

jseibert
 
Posts: 11
Joined: Wed Jul 29, 2020 7:36 am

Mon Sep 14, 2020 6:50 am

Hello,

Glad to hear that your issue was finally solved by setting the thread culture!
But regarding the specific cause of this issue, based on the information available at this time, our side are unable to reproduce your issue, so we cannot analyze it further and locate the issue. Please provide us with additional information (as I mentioned above) to help us better reproduce your issue.

Sincerely,
Elena
E-iceblue support team
User avatar

Elena.Zhang
 
Posts: 279
Joined: Thu Jul 23, 2020 1:18 am

Return to Spire.PDF

cron