Welcome Guest Search | Active Topics | Sign In | Register

EO.Pdf.Mvc.RenderAsPDF Corrupted Options
sherzy
Posted: Friday, August 23, 2019 8:05:10 PM
Rank: Newbie
Groups: Member

Joined: 9/29/2014
Posts: 1
I have been using your MVC html to pdf for several years without issues. I recently (past few days) have gotten this message when trying to render PDF documents from an MVC view:

Format error: not a PDF of corrupted.

I know it's a very generic error. The view renders fine in the browser if not pdf. The view is html and css only, no javascript or anything.

Controller code:
Code: C#
[EO.Pdf.Mvc.RenderAsPDF]
        public ActionResult ActivityPDF(int id)
        {
            var path = VirtualPathUtility.ToAbsolute("~/Content/");
            EO.Pdf.HtmlToPdf.Options.BaseUrl = new Uri(Request.Url, path).AbsoluteUri;
            EO.Pdf.HtmlToPdf.Options.PageSize = new System.Drawing.SizeF(8.5f, 11f);
            EO.Pdf.HtmlToPdf.Options.OutputArea = new System.Drawing.RectangleF(0.5f, 0.5f, 7.5f, 10f);
            MVCToPDF.ResultFileName = "CCC_Checkin.pdf";
            EO.Pdf.HtmlToPdf.Options.MinLoadWaitTime = 2 * 1000;
            var a = _volunteerService.GetVolunteerProjectActivity(id);
            return View(Mapper.Map<VolunteerProjectActivityViewModel>(a));
        }


My project is very extensive, the PDF rendering is a small part but very important. The PDFs were working recently, so I am wondering where I can look to troubleshoot this.

I have tried rending a very simple view with just Hello World - still corrupted. I have tried multiple pdf readers to view the file (Adobe and Foxit) as well as multiple computers.

Any help would be greatly appreciated.

eo_support
Posted: Monday, August 26, 2019 11:13:25 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,218
Hi,

This usually occurs when you have another module in the pipeline that altered the output, or it can be due to an exception. You can try to save the result as a file and then open the file with notepad to see what you see there. If you see clear text with typical web page errors, then that error should tell you what's wrong. If it's some other unrecognizable contents, then you may want to try to remove modules/pages from your project step by step until you can isolate the problem. That process may tell you exactly what triggered the problem.

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.