コード例 #1
0
        public ActionResult TestQueueablePdf()
        {
            var queueableViewAsPdf = new QueueableViewAsPdf(ControllerContext, "Index")
            {
                FileName        = "TestView.pdf",
                PageSize        = Size.A3,
                PageOrientation = Orientation.Landscape,
                PageMargins     = { Left = 0, Right = 0 }
            };

            HostingEnvironment.QueueBackgroundWorkItem(e =>
            {
                // Put this step in a background work item as it takes most of the time,
                // especially when there are multiple files need to be generated.

                var file = queueableViewAsPdf.BuildFile();
                // Email the file as an attachment.
            });

            ViewBag.Message = "File will be sent to your email shortly";
            return(View());
        }
コード例 #2
0
        public ActionResult TestQueueablePdf()
        {
            var queueableViewAsPdf = new QueueableViewAsPdf(ControllerContext, "Index")
            {
                FileName = "TestView.pdf",
                PageSize = Size.A3,
                PageOrientation = Orientation.Landscape,
                PageMargins = {Left = 0, Right = 0}
            };

            HostingEnvironment.QueueBackgroundWorkItem(e =>
            {
                // Put this step in a background work item as it takes most of the time,
                // especially when there are multiple files need to be generated.

                var file = queueableViewAsPdf.BuildFile();
                // Email the file as an attachment.
            });

            ViewBag.Message = "File will be sent to your email shortly";
            return View();
        }