Créer un fichier pdf avec wkhtmltopdf et de rendu javascript

Je suis d'essayer de créer un fichier PDF du javascript graphique que j'ai dans un modèle de fenêtre (ma carte est une combinaison de javascript et de css dans un .aspx vue). La seule chose dans le rendu du fichier PDF est le contenu statique à partir de la fenêtre, le javascript graphique n'est pas là.

Mon appel pour créer le PDF est comme suit:

public byte[] WKHtmlToPdf(string url)
{
var fileName = " - ";
var wkhtmlDir = "C:\\Temp\\wkhtml";
var wkhtml = "C:\\Temp\\wkhtml\\wkhtmltopdf.exe";
var p = new Process();
p.StartInfo.CreateNoWindow = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.UseShellExecute = false;
p.StartInfo.FileName = wkhtml;
p.StartInfo.WorkingDirectory = wkhtmlDir;
string switches = "";
switches += "--print-media-type ";
switches += "--margin-top 0mm --margin-bottom 0mm --margin-right 0mm --margin-left 0mm ";
switches += "--page-size Letter ";
p.StartInfo.Arguments = switches + " " + url + " " + fileName;
p.Start();
//read output
byte[] buffer = new byte[32768];
byte[] file;
using (var ms = new MemoryStream())
{
while (true)
{
int read = p.StandardOutput.BaseStream.Read(buffer, 0, buffer.Length);
if (read <= 0)
{
break;
}
ms.Write(buffer, 0, read);
}
file = ms.ToArray();
}
//wait or exit
p.WaitForExit(60000);
//read the exit code, close process
int returnCode = p.ExitCode;
p.Close();
return returnCode == 0 ? file : null;
}

Des idées sur comment je pourrais prendre le javascript graphique? Peut-être l' .Net version serait plus approprié ou je dois enregistrer la page générée dans un fichier et le passer dans l'outil.

Grâce.

J'ai eu ce problème et fixe, en assurant j'ai été en utilisant wkhtmltopdf 0.9.9. Le "gem install" version (0.8.3) n'était pas le couper.

OriginalL'auteur Zero Cool | 2011-08-04