wkhtmltopdf Custom header with ASP.NET

Oct 22 2014 5:13 AM
Hii ,

I am converting my html pages to pdf using wkhtmltopdf.

I put image as my header in my html file.But when data is large and after converting the pdf breaks down into few pages.

My header logo comes only on first page.

Is there any way to fix the header throughout all the pages in my case the company logo .. so even if data is large and after converting it splits down into multiple pages , i would like to have header for each page.. my image logo.

Belo is my code i tried so far ..
 
 
protected void btnExportToExcel_Click(object sender, EventArgs e)         {             WorkingWay3();         }           private void WorkingWay3()         {             string pdfExportPath = profile + ApConfig.CurrentCompany.CompId + "/" + ApConfig.CurrentUser.EmpId.ToString();               if (!Directory.Exists(Server.MapPath(pdfExportPath)))             {                 Directory.CreateDirectory(Server.MapPath(pdfExportPath));             }             else             {                 pdfExportPath = pdfExportPath + "/Objectives.pdf";             }               string objpath = Server.MapPath(pdfExportPath);               HtmlToPdf("http://localhost:32370/User/PerformancePDF.aspx", @"D:/Projects/New.pdf");               Response.Clear();             Response.AddHeader("Content-Disposition", "attachment; filename=DownloadedFile.zip");             Response.ContentType = "application/zip";             objZip.Save(Response.OutputStream);             Response.End();         }           private void HtmlToPdf(string website, string destinationFile)         {               ProcessStartInfo startInfo = new ProcessStartInfo();               startInfo.UseShellExecute = false;               startInfo.RedirectStandardOutput = true;               startInfo.RedirectStandardInput = true;               startInfo.RedirectStandardError = true;               startInfo.CreateNoWindow = true;               startInfo.FileName = "C:\\Program Files\\wkhtmltopdf\\bin\\wkhtmltopdf.exe";             startInfo.Arguments = website + " " + destinationFile;             Process myProcess = Process.Start(startInfo);             myProcess.WaitForExit();             myProcess.Close();             objZip.AddFile(destinationFile, "Files");         }
 

Answers (2)