"The input string was not in a correct format" when trying to open PDF.

Hi,


I'm getting an exception when trying to open my PDF file: 

Message = "The input string '1.00' was not in a correct format." The PDF in question is created using Syncfusion Pdf. The file loads until I add the below code. If that code is part of the Pdf creation, then SfPdfViewer can't load the PDF.

Edit: The file is still being created and I can open it with Acrobat Reader.

            //Sidebar section A
            x =0;
            y += arialRegularFont.Height+ lineSpace +4;
            RectangleF sidebarSectionA =new(x, headerHeight, sectionSpace, y - headerHeight);
            graphics.DrawRectangle(borderPen, lightYellowBrush, sidebarSectionA);


            PdfGraphicsState state = graphics.Save();
            graphics.TranslateTransform(x, y);
            graphics.RotateTransform(-90);
            graphics.DrawString("SECTION \"A\"", arialBoldFont, blackBrush,newRectangleF(0,0, y - headerHeight, sectionSpace), format);
            graphics.Restore(state);

3 Replies 1 reply marked as answer

DR Deepika Ravi Syncfusion Team May 15, 2024 07:11 AM UTC

Hi Piet Snyman,


We tried to replicate the reported issue when creating the PDF document using Syncfusion PDF library and loading those PDF documents in SfPdfViewer. However, the document loaded properly in SfPdfViewer on our side. We have attached a sample along with the output screenshot for your reference. It can be downloaded from the attachment.


If you are still able to replicate the issue in the shared sample, kindly modify the reproducing issue in the shared sample and share the updated sample with us. This will be helpful for us to provide a prompt solution at earliest.


Regards,

Deepika R


Attachment: MauiApp1_b6b1db9f.zip

Marked as answer

PS Piet Snyman replied to Deepika Ravi May 15, 2024 07:31 AM UTC

Thank you for your response. The problem does not occur when running my code in your app. There must be something else wrong. I have decided to use a workaround where the text is not rotated but the characters are stacked on top of each other.


Thanks for your help.



DR Deepika Ravi Syncfusion Team May 16, 2024 06:08 AM UTC

Hi Piet Snyman,


Thank you for the update. We are glad to know that your issue has been resolved at your end. Please let us know if you need any further assistance with this.


Regards,

Deepika R


Loader.
Up arrow icon