Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error generating PDF #11

Open
luvssti opened this issue Mar 28, 2020 · 5 comments
Open

Error generating PDF #11

luvssti opened this issue Mar 28, 2020 · 5 comments

Comments

@luvssti
Copy link

luvssti commented Mar 28, 2020

Hi,
I just want to if how can I fix this error?

Thank You and God Bless!

`public class PDFModel : PageModel
{

    public ActionResult OnGet()
    {
        var report = new ActionAsPdf(Url.Content("~/TestPDF"), new { })
        {
            PageMargins = { Left = 10, Bottom = 10, Right = 10, Top = 10 },
            PageSize = RotativaCore.Options.Size.Legal,
            CustomSwitches = "--disable-smart-shrinking"

        };
        return report;
    }

}`

Win32Exception: The system cannot find the file specified.
System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
System.Diagnostics.Process.Start()
RotativaCore.WkhtmlDriver.Convert(string wkhtmlPath, string switches, string html, string wkhtmlExe)
RotativaCore.WkhtmltopdfDriver.Convert(string wkhtmltopdfPath, string switches)
RotativaCore.AsPdfResultBase.WkhtmlConvert(string switches)
RotativaCore.AsResultBase.CallTheDriver(ActionContext context)
RotativaCore.AsResultBase.BuildFile(ActionContext context)
RotativaCore.AsResultBase.ExecuteResult(ActionContext context)
Microsoft.AspNetCore.Mvc.ActionResult.ExecuteResultAsync(ActionContext context)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeResultAsync(IActionResult result)
Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeResultAsync(IActionResult result)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.ResultNext<TFilter, TFilterAsync>(ref State next, ref Scope scope, ref object state, ref bool isCompleted)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeNextResultFilterAsync<TFilter, TFilterAsync>()
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResultExecutedContextSealed context)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.ResultNext<TFilter, TFilterAsync>(ref State next, ref Scope scope, ref object state, ref bool isCompleted)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeResultFilters()
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|24_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, object state, bool isCompleted)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(ref State next, ref Scope scope, ref object state, ref bool isCompleted)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
Microsoft.AspNetCore.Routing.EndpointMiddleware.g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)

@arichika
Copy link
Owner

The error,

Win32Exception: The system cannot find the file specified.
System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
System.Diagnostics.Process.Start()

indicate missing wkhtmltopdf.exe in your project / bin directory.

e.g.
https://github.com/arichika/RotativaCore/tree/master/src/RotativaCore.SampleWebApp.3.0

Please check this.

  1. Put Binares ( wkhtmltoimage.exe , wkhtmltopdf.exe ) into the directory (project)\WkHtmlToPdf
  2. Specify that those files be copied at build time.
    https://github.com/arichika/RotativaCore/blob/master/src/RotativaCore.SampleWebApp.3.0/RotativaCore.SampleWebApp.3.0.csproj#L25

@DealerCorp
Copy link

@arichika
Copy link
Owner

arichika commented May 2, 2020

Ohh... That's great solution.
The issue was that you wanted to run it in Razor Pages. I was mistaken.
When I see the work I'm working on, I'll try to implement it in this module.

@luvssti
Copy link
Author

luvssti commented Jul 7, 2020

Thank You for the reply... I've been busy on another project and just got back to continue my previous project.

@tawani
Copy link

tawani commented Feb 14, 2022

What is the point of this project? Can you run an executable in Azure bin folder?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants