Welcome Guest Search | Active Topics | Sign In | Register

EO.Pdf not working after deployed in to azure app service Options
KumoJosh
Posted: Friday, December 28, 2018 12:23:43 PM
Rank: Advanced Member
Groups: Member

Joined: 12/14/2018
Posts: 31
We are using Web API to generate PDF, MVC app does not fit to our application structure. Please try the same sample by taking Web API and host on Azure app Service running on 64 bit.

As mentioned in the first post, below code we use to return the response stream from API.
Code: C#
HtmlToPdfOptions op = new HtmlToPdfOptions();
op.HeaderHtmlFormat = "Header content";
op.FooterHtmlFormat = "Footer content";

MemoryStream pdfStream = new MemoryStream();
{
HtmlToPdf.ConvertHtml("our html content", pdfStream, op);

byte[] pdfFileBytes = pdfStream.ToArray();
MemoryStream outPutStream = new MemoryStream(pdfFileBytes);
response.Content = new PushStreamContent((responseStream, httpContent, tc) =>
{
outPutStream.CopyTo(responseStream);
responseStream.Close();
}, "application/octet-stream");
HttpStatusCode successStatus = HttpStatusCode.Created;
response.StatusCode = successStatus;
response.Content.Headers.ContentType = new MediaTypeHeaderValue("application/pdf");
response.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment");
response.Content.Headers.ContentDisposition.FileName = "sample.pdf";
response.Content.Headers.ContentLength = new MemoryStream(pdfFileBytes).Length;
return response;
}

eo_support
Posted: Friday, December 28, 2018 1:03:04 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,258
Can you confirm the simple case we mentioned previously work or not? You can't keep jumping to your actual scenario without running the basic tests because the result of the basic test scenario would indicate where to look next.
KumoJosh
Posted: Friday, December 28, 2018 1:19:51 PM
Rank: Advanced Member
Groups: Member

Joined: 12/14/2018
Posts: 31
Agree, below sample code with in Web API hosted on 64 bit azure app service is hanging in the line HtmlToPdf.ConvertHtml("test", doc); of code.

Code: C#
PdfDocument doc = new PdfDocument();
HtmlToPdf.ConvertHtml("test", doc);

eo_support
Posted: Friday, December 28, 2018 2:12:51 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,258
We asked you about standard MVC application, not Web API application. One thing at a time. Don't jump.


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.