2 Replies - 794 Views - Last Post: 19 July 2018 - 06:01 AM

#1 ibnmvungi   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 93
  • Joined: 20-April 12

Cannot View PDF in a browser ( Failed to load PDF document. )

Posted 08 July 2018 - 01:29 AM

Hallo there,

I am using ASP.NET CORE

I have this simple code to display a string as pdf

  public async Task<ContentResult> StringToPdf(){
    return Content("String to display", "application/pdf");
 }




But When Pdf Page is loaded it display

Quote

Failed to load PDF document
.

Could someone tell me whats wrong?

This post has been edited by ibnmvungi: 08 July 2018 - 01:29 AM


Is This A Good Question/Topic? 0
  • +

Replies To: Cannot View PDF in a browser ( Failed to load PDF document. )

#2 TechnoBear   User is offline

  • Lady A
  • member icon

Reputation: 330
  • View blog
  • Posts: 1,210
  • Joined: 02-November 11

Re: Cannot View PDF in a browser ( Failed to load PDF document. )

Posted 19 July 2018 - 05:47 AM

"String to display" should be a file name of a pdf. Is it?

If it's not, that right there is your issue.
Was This Post Helpful? 0
  • +
  • -

#3 mkkekkonen   User is offline

  • D.I.C Head

Reputation: 16
  • View blog
  • Posts: 71
  • Joined: 10-May 18

Re: Cannot View PDF in a browser ( Failed to load PDF document. )

Posted 19 July 2018 - 06:01 AM

Here's a link to a tutorial. You'll most likely need an external library to generate PDF files.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1