Cannot get pdf content

Posted by: andrew on 28 February 2019, 7:04 pm EST

    • Post Options:
    • Link

    Posted 28 February 2019, 7:04 pm EST

    Hello. I encountered a problem when i called to get the pdf content from the web api service.

    In the device which encountered the problems, when i go to : http://localhost/MYWEB/api/pdf/pdfViewer/e6a54256-acce-4231-91c5-f86fe2b25a8e.pdf/$pdf

    i got this :

    {“loadedDateTime”:“2019/03/01 15:37:35”,

    “expiredDateTime”:“2019/03/01 15:50:13”,

    “path”:“pdfViewer/e6a54256-acce-4231-91c5-f86fe2b25a8e.pdf”,

    “pageSettings”:{“paginated”:true,“height”:“11in”,“width”:“8.5in”,“topMargin”:“1in”,“leftMargin”:“1in”,“rightMargin”:“1in”,“bottomMargin”:“1in”,“landscape”:false,“paperSize”:1},

    “features”:{“nonPaginated”:false,“paginated”:true,

    “textSearchInPaginatedMode”:true,“pageSettings”:false},“status”:{“expiredDateTime”:“2019/03/01 15:50:13”,“hasOutlines”:false,

    “status”:“Loaded”,“errorList”:,“progress”:0.0,“pageCount”:1},

    “statusLocation”:“http://localhost/MYWEB/api/pdf/pdfViewer/e6a54256-acce-4231-91c5-f86fe2b25a8e.pdf/$pdf/status”,

    “featuresLocation”:“http://localhost/MYWEB/api/pdf/pdfViewer/e6a54256-acce-4231-91c5-f86fe2b25a8e.pdf/$pdf/features”}

    but when i go to :

    http://localhost/MYWEB/api/pdf/pdfViewer/e6a54256-acce-4231-91c5-f86fe2b25a8e.pdf/$pdf/export?_=1551425664732&format=html&paged=true&outputRange=1

    it has an error :

    {“Message”:“An error has occurred.”,“ExceptionMessage”:“Specified cast is not valid.”,“ExceptionType”:“System.InvalidCastException”,“StackTrace”:" at C1.Util.DX.ComObject.QueryInterface(Guid guid, IntPtr& outPtr)\r\n at C1.Util.DX.ComObject.QueryInterfaceT\r\n at C1.Win.C1Document.Util.C1DXTextLayout…ctor(IC1DXTextLayoutOwner owner)\r\n at C1.Win.C1Document.Util.C1DXExportGraphics.CreateTextLayout()\r\n at C1.Win.C1Document.Util.C1DXExportGraphics…ctor()\r\n at C1.Win.C1Document.Util.C1HtmlGraphics…ctor(XmlWriter doc, C1Page page, String imageFolder, Boolean singleFile)\r\n at C1.Win.C1Document.Export.HtmlFilterBase.ExportPage(C1Page page)\r\n at C1.Win.C1Document.Export.GraphicsFilter.InternalExport(IExecutionContext context)\r\n at C1.Win.C1Document.Export.ExportFilter.Export(IExecutionContext context)\r\n at C1.Win.C1Document.C1PdfDocumentSource.InternalExport(ExportFilter exporter, IExecutionContext context)\r\n at C1.Win.C1Document.C1DocumentSource.Export(ExportFilter exportFilter)\r\n at C1.Web.Api.Document.Models.Document.Export(ExportFilterOptions exportFilterOptions)\r\n at C1.Web.Api.Document.DocumentRequestContext

    1.Export(ExportFilterOptions options)\r\n at #0Ai.#cBi.#08x()\r\n at System.Threading.Tasks.Task
    1.InnerInvoke()\r\n at System.Threading.Tasks.Task.Execute()\r\n— End of stack trace from previous location where exception was thrown —\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at #0Ai.#cBi.#88x.#U9e()\r\n— End of stack trace from previous location where exception was thrown —\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Controllers.ApiControllerActionInvoker.d__0.MoveNext()\r\n— End of stack trace from previous location where exception was thrown —\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Controllers.ActionFilterResult.d__2.MoveNext()\r\n— End of stack trace from previous location where exception was thrown —\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Dispatcher.HttpControllerDispatcher.d__1.MoveNext()"}

    Here are my device settings which can’t get the pdf content:

    • Window Server 2008 R2 Standard SP1

      -IIS 7

      -.Net Framework 4.6
  • Posted 3 March 2019, 8:29 pm EST

    Hi Andrew,

    Please use the following download link:

    http://localhost/MYWEB/api/pdf/pdfViewer/e6a54256-acce-4231-91c5-f86fe2b25a8e.pdf/$pdf/export[b]?format[/b]=html&paged=true&outputRange=1

    It should work for you.

    Could you please let us know where you are consuming C1 WebAPI PDF Service?

    Also, please post the future related to C1MVC and C1 WebAPI related queries at the following forum:

    https://www.grapecity.com/en/forums/mvc-edition

    Regards,

    Manish Gupta

  • Posted 4 March 2019, 3:04 pm EST

    Hi Manish,

    I have tried the path http://localhost/MYWEB/api/pdf/pdfViewer/e6a54256-acce-4231-91c5-f86fe2b25a8e.pdf/$pdf/export?format=html&paged=true&outputRange=1.

    But still, it gives me the same error as before.

    Replying your question, I created a wijmo PdfViewer and set the service url and file path in .js as below:

    var pdfViewer = new wijmo.viewer.PdfViewer('#pdfViewer');
    pdfViewer.serviceUrl = "./api/pdf";
    pdfViewer.filePath = filePath;
    

    and every time i open a website,it will create wijmo PdfViewer once.

    The error is then come out in the console. [internal server error 500] with the link :

    http://localhost/MYWEB/api/pdf/pdfViewer/e6a54256-acce-4231-91c5-f86fe2b25a8e.pdf/$pdf/export?_=1551425664732&format=html&paged=true&outputRange=1

    Regards,

    Andrew

  • Posted 5 March 2019, 9:06 pm EST

    Hi Andrew,

    Could you please let us know the version information for both the C1WebApi and Wijmo you are using?

    Please also find the attached sample for reference.

    Regards,

    Manish Gupta

    C1PDF_WijmoPDFViewer.zip

  • Posted 6 March 2019, 6:01 pm EST

    Hi Manish,

    I am using v4.0.20173.119 of C1WebApi and v5.20173.405 of Wijmo.

    And thank you for your attachment.

    Regards,

    Andrew

  • Posted 7 March 2019, 10:55 pm EST

    Hi Andrew,

    Thanks for sharing the build version. The issue is with the WebApi older version. Please update it to the latest version 4.0.20183.159 as from the sample and the issue should be resolved for you.

    Regards,

    Manish Gupta

  • Posted 27 May 2019, 6:43 pm EST

    Dear Manish,

    Sorry for late reply. I have tried 4.0.20183.159 and 4.0.20191.185 of C1.Web.Api.

    But Still the same error comes out.

    Sorry but is there any other solution?

    In the other hand, is there any deployment requirement that i need to pay attention to?

    Regards,

    Andrew

  • Posted 27 May 2019, 6:48 pm EST - Updated 29 September 2022, 11:16 pm EST

    This is how its look when the error appears

  • Posted 28 May 2019, 1:16 pm EST

    Dear Manish,

    After different trails, a platform update of Window Server 2008 is needed to solve this problems

    Thank you for your help!

    Regards,

    Andrew

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels