Pdf cannot view
See original GitHub issueAfter I have run the server then it show this error, but it still run.
Here is my code in the API, I scared it have problem with async/await
so I used .Result
[HttpGet("booking-preview/{bookingId}")]
public IActionResult GetBookingPreview(long bookingId)
{
if (!ModelState.IsValid)
return Ok(ModelState);
var doc = new HtmlToPdfDocument()
{
GlobalSettings = {
PaperSize = PaperKind.A3,
Orientation = Orientation.Landscape,
},
Objects = {
new ObjectSettings()
{
Page = "http://google.com/",
},
new ObjectSettings()
{
Page = "https://github.com/",
}
}
};
byte[] pdf = _converter.Convert(doc);
return new FileContentResult(pdf, "application/pdf");
}
But after have called the API and then return the pdf file, I opened it by browser withBlob
or using Pdf reader
but it appeared blank/ not support
.
Thanks.
Issue Analytics
- State:
- Created 6 years ago
- Comments:10 (5 by maintainers)
Top Results From Across the Web
Troubleshoot viewing PDF files on the web
In Reader or Acrobat, right-click the document window, and choose Page Display Preferences. · From the list at left, select Internet. · Deselect ......
Read more >Can't open PDF
Right-click the PDF, choose Open With > Choose default program (or Choose another app in Windows 10). · Choose Adobe Acrobat Reader or...
Read more >Can't Open PDF? How To Fix PDF Files Not Opening Error
Open Adobe Reader or Acrobat. · Choose Edit from the menu bar. · Select Preferences. · Choose Internet from the left sidebar. ·...
Read more >12 Fixes to Try When Adobe Acrobat Reader Can't Open ...
12 Fixes to Try When Adobe Acrobat Reader Can't Open PDF Files on Windows · 1. Close Background Processes and Give Adobe a...
Read more >7 Effective Methods to Fix "PDF Not Opening" Error
Part 1: Why Does "PDF Not Opening" Error Occur? · Unsupported file type: This is the most common reason you cannot open PDF....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Error that you marked shouldn’t have any impact on conversion process. Can you write PDF to disk on a server to confirm that there is something wrong with the library?
Can you paste this to your browser URL box:
<insert your web server address>/booking-preview/12
This will return file stream directly from your server.