PDF Generating Tool Support Forum

HOME   Login   Register    Search




  Subject: how to show background image in full size of page
   PostPosted: 04 Apr 2017, 10:38 
content += "<!DOCTYPE html ><html xmlns='http://www.w3.org/1999/xhtml' style='background: url(http://clients.anaxusinfotech.com/sales ... ges/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();


Attachments:
File comment: the image is shown here, i want it in full size of page
63901256.PDF [67.05 KiB]
Downloaded 3 times
  Subject: Re: how to show background image in full size of page
   PostPosted: 04 Apr 2017, 18:34 
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


  Subject: Re: how to show background image in full size of page
   PostPosted: 05 Apr 2017, 07:22 
but im not able to get setPageFooter() keyword so what to do for that is any namespace missing??
i am getting this error.....
['org.zefer.pd4ml.PD4ML' does not contain a definition for 'setPageFooter' and no extension method 'setPageFooter' accepting a first argument of type 'org.zefer.pd4ml.PD4ML' could be found (are you missing a using directive or an assembly reference?)]


  Subject: Re: how to show background image in full size of page
   PostPosted: 07 Apr 2017, 21:42 
You are right. In C# it can be done slightly different:

pd4ml.PageHeader = footer;



[Reply]     [ 4 posts ] 

cron
Copyright ©2004-10 zefer|org. All rights reserved. Bookmark and Share