Welcome Guest Search | Active Topics | Sign In | Register

Getting Error message as File does not begin with '%PDF-'. Local\EWH_c..... Options
Sumeet Gandhi
Posted: Tuesday, July 19, 2011 5:38:56 AM
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
eo_support
Posted: Tuesday, July 19, 2011 7:51:21 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,067
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
Zanzibarski
Posted: Wednesday, May 27, 2015 2:30:55 AM
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;
eo_support
Posted: Thursday, May 28, 2015 2:17:56 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,067
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!


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.