Spire.PDFViewer is a powerful PDF Viewer component for .NET. It allows developers to load PDF document from stream, file and byte array.

Thu Apr 26, 2012 8:10 am

When trying to export pdf to image (even using the example code that came with the download) I get the following error "Input string was not in a correct format."

Version is Spire.Office 2.1 (2012-03-01).

Example code (from Spire.Office download):
"C:\Program Files (x86)\e-iceblue\Spire.Office\Demos\PdfViewerDemos\CS\WinForms\01_PdfDocumentViewer\Export" line 125.

Code: Select all
Bitmap[] images = this.pdfDocumentViewer1.SaveAsImage(fromPage, toPage);

I have tried with a number of different pdf's including the one that came with the demo code.

Thanks for your help.

Posts: 1
Joined: Thu Apr 26, 2012 7:00 am

Thu Apr 26, 2012 9:44 am

Hi ,

Thanks for evaluating Spire.office and your inquiry.

According to your description, the issue may be caused by that the Regional and Language of your OS is not compatible english. Is the Regional and Language Options on your computer is not compatible with english? Is it right?

Anyway, please try to add the following code:
Code: Select all
System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
in the method which using Spire.office functions.

This is a workaround which can enable the program to work on your machine no matter which Regional and Language Options is configured. At the meantime, we will do more research on this issue. Once we have any better solution, you'll be surely notified.

If this can't work, would you please tell us more information(your OS environment, the original PDF file etc) to help us reproduce it?

Thanks in anvance.

Have a great day.
Best regards
e-iceblue support
User avatar

Posts: 154
Joined: Thu Oct 20, 2011 2:53 am

Return to Spire.PDFViewer