|
Rank: Newbie Groups: Member
Joined: 7/19/2011 Posts: 7
|
I am getting the above error when the PDF tries to open
Please advice.
Thanks Sumeet
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,229
|
Hi,
This is your code error. If you save the PDF output to a stream and you have written something else into the stream before calling our code, then you will get that error.
Thanks
|
|
Rank: Newbie Groups: Member
Joined: 5/27/2015 Posts: 0
|
Sorry for writing in old topic, but i have same error. Code is:
Code: C#
public HttpResponseMessage GetQuestionSolutionHtmlEO(string id)
{
var stream = new MemoryStream();
EO.Pdf.HtmlToPdf.ConvertHtml(document.DocumentNode.InnerHtml, stream);
var response = new HttpResponseMessage(HttpStatusCode.OK);
response.Content = new StreamContent(stream);
response.Content.Headers.ContentType = new MediaTypeHeaderValue("application/pdf");
return response;
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,229
|
Hi Zanibarski,
You can try to save the content of your stream object into a file and see if that gives you a valid PDF file. If that does give you a valid PDF file, then the problem is in your response.Content (probably because it already has something). We are not in a position to troubleshoot that for you. So you will need to resolve that part yourself.
Thanks!
|
|