We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

PDF Viewer - Problem with Error 400 - Bad Request when using the search words

We implemented the PDF viewer using Vuejs as FRONT and C# as BACK. We follow the following tutorial to implement the server:

https://www.syncfusion.com/kb/11063/how-to-create-pdf-viewer-web-service-in-net-core-3-0-and-above


However, after doing this implementation on the server, we had difficulties with the 400 error that was given after we sent the parameters for the request. Because some values ​​were passed as INT and this was not expected on the server, it caused the BAD REQUEST error. The alternative we had was to convert all the values ​​that were sent to the server as a String. This palliative alternative worked for a while, however we ran into a serious problem recently.

Unfortunately, the search for words, which is a widely used feature, only works for words that have already been loaded in the user's field of view. All the words that are on other pages that haven't gone through RenderPDFPages don't work. For some reason, when I try to use this word search course, it completely ignores the conversion configuration we set up and causes the 400 error.


Do you have any alternative for this kind of problem?


Attachment: pdfViewerBadRequest_ad6eddff.rar

1 Reply 1 reply marked as answer

CK Chinnamunia Karthik Chinna Thambi Syncfusion Team March 24, 2023 01:21 PM UTC

We have added a few properties in the JSON model class in our latest version that cause this issue. We have shared the updated JSON model class in the below file. And also we have shared a sample in the latest version below,


JSON model class file: https://www.syncfusion.com/downloads/support/directtrac/general/ze/JsonPropertiesModelClass37368240.zip


Vue Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/Vue_quickstart_21.1.35-1944251949.zip


Web service sample:  https://www.syncfusion.com/downloads/support/directtrac/general/ze/WebService21.1.35-1003948304.zip


Could you please confirm whether you have added the below lines in the Startup.cs file in the web service. If not, Kindly add the below lines. This code snippet is used to configure NewtonsoftJson for JSON support.



 

    builder.Services.AddControllers().AddNewtonsoftJson(options =>

    {

        // Use the default property (Pascal) casing

        options.SerializerSettings.ContractResolver = new DefaultContractResolver();

    });


Kindly try this and let us know if this helps.


Marked as answer
Loader.
Up arrow icon