Unexpected token T in JSON at position 0

Hi,

I'm started to using PDF Viewer, implemented the c# webapi, like in you documentation, in my dev enviorement works fine, but in published API I receive the error bellow.


That's the AJAX request

{
    "name": "ajaxRequestInitiate",
    "JsonData": {
        "document": "http://mikza.ddns.net:2710/virtuessrs/Pages/ReportViewer.aspx?/vendas/pedido&ServerName=virtue-srv01.database.windows.net&DbName=virtuedb-dfmoveis&PedidoId=235&rs:Format=PDF",
        "zoomFactor": 1,
        "isFileName": true,
        "uniqueId": "Sync_PdfViewer_2fc4bff8-15c6-446e-0c75-3a8ef4a5955c",
        "action": "Load",
        "elementId": "pdfViewer"
    }
}

Can you help me?


1 Reply

VS Vasugi Sivajothi Syncfusion Team December 2, 2021 11:31 AM UTC

Hi Benjamim, 
  
Thank you for contacting Syncfusion support. 
  
We suspect that issue is due to the write access permission denied in the environment. We will create the pdfium.dll based on the operating system at the runtime. So, could you please try copying the below provided x64 and x86 folder and paste inside the folder into your project to resolve the issue or enable the write permission for that folder?
  
 
    
Note:    
· Kindly use both the client and server-side of the same version in your project    
· Ensure whether the Pdfium dll will be created in your project during runtime. Else we can also place the pdfium assemblies in any of the production environment locations and refer to the path by using the ReferencePath API.    
    
For example:     
   
If the Pdfium assembly is available in this path C:\Pdfium\x64 or D:\Pdfium\x86, the reference path should be PdfRenderer.ReferencePath = "C:/";     
    
The parent folder has to be provided as the path in the ReferencePath API.     
Note: Provide this path in the Load method of the PDFViewerController.cs     
PdfRenderer PdfRenderer = new PdfRenderer();     
PdfRenderer.ReferencePath = @"C:/";     
  
Steps to refer the Pdfium.dll:   
  
1.Extract the given file (Pdfium folder) and copy it in the sample’s root directory (parallel to Controllers folder)   
  
2. Right-click on the pdfium.dll (both the X64 andX86 folder) and then choose the “Copy to Output Directory” property from the property window and set its value to “copy always”. This setting will ship the pdfium.dll assembly to the published location.    
   
Screenshot:    
     
   
3. Provide this path in the Load method of the PDFViewerController.cs      
  
Note: You need to refer the ParentFolder up to x64/x86 folder.   
  
PdfRenderer.ReferencePath = _hostingEnvironment.ContentRootPath + \\Pdfium\\ 
   
4. Build and publish the application.   
  
   
Also please install only the package related to that OS, then build and run the project in that platform. For Windows, Linux and OSX operating systems, use the following corresponding libraries:   
  
  • Syncfusion.EJ2.PdfViewer.AspNet.Core.Linux
  • Syncfusion.EJ2.PdfViewer.AspNet.Core.Windows          
  • Syncfusion.EJ2.PdfViewer.AspNet.Core.OSX
  
Kindly try this and let us know if the issue resolves or not. If not, please share the network tab response details while loading the PDF document, and published environment details. This will be helpful to investigate further and provide the solution at the earliest.   
   
Regards, 
Vasugi 


Loader.
Up arrow icon