Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #27136

    content += “<!DOCTYPE html ><html xmlns='http://www.w3.org/1999/xhtml' style='background: url(https://clients.anaxusinfotech.com/salesform1/images/22.jpg);' ><head><title></title><style type='text/css' media='all'>*{margin: 100px;padding: 100px;}body{margin:0;padding:0;font-family:Arial,Helvetica,sans-serif;color:#333;width: 1335px;}</style></head><body >”;

    PD4ML pd4ml = new PD4ML();
    PD4PageMark header = new PD4PageMark();
    StringBuilder strstyle = new StringBuilder();
    pd4ml.HtmlWidth = (htmlWidth);

    pd4ml.addStyle(“@page : body{font-family: Calibri, Helvetica, sans-serif, Verdana;}.innertext{font-family: Calibri, Helvetica, sans-serif, Verdana;color: #efefef;}”, true);
    pd4ml.enableTableBreaks(true);
    pd4ml.addStyle(“TABLE,DIV {page-break-inside: auto !important}”, true);

    pd4ml.PageSize = PD4Constants.getSizeByName(“A4”);
    Byte[] byteArray = Encoding.ASCII.GetBytes(content);
    MemoryStream stream = new MemoryStream(byteArray);
    pd4ml.render(stream, new System.IO.FileStream(stroutpath, System.IO.FileMode.Create));

    Response.ContentType = “Application/pdf”;
    Response.AppendHeader(“Content-Disposition”, “attachment; filename=” + pdfname + “.PDF”);
    Response.TransmitFile(Server.MapPath(“GeneratePDF/” + pdfname + “.PDF”));
    Response.End();

    stream.Flush();
    stream.Close();
    stream.Dispose();

    #30012

    You may define a page background with the API call:

    PD4PageMark footer = new PD4PageMark();
    // footer.setPageBackgroundColor(Color.green);
    footer.setPageBackgroundImageUrl("file:i/background.jpeg");
    pd4ml.setPageFooter(footer); // or setPageHeader() - both methods are ok

    #30013

    but im not able to get setPageFooter() keyword so what to do for that is any namespace missing??
    i am getting this error…..

    #30014

    You are right. In C# it can be done slightly different:

    pd4ml.PageHeader = footer;

Viewing 4 posts - 1 through 4 (of 4 total)

The forum ‘PD4ML Tips & Tricks’ is closed to new topics and replies.