Hi team,
 
I am using the ITextsharp to generate a PDF file for the attachec html file. 
Sample PDF was also attached. 
 
I am missing the background color and borders to that, can you please suggest a 
sample code to generate appropriately. below is the code.
byte
pafPdfPath = [] pdfContents = Render();stringpdfName = 
"file.pdf";Path.Combine(path, pdfName);// // Create a new stream to write to 
the file{
Writer.Write(pdfContents);
Writer.Flush();
Writer.Close();
}using(BinaryWriterWriter = newBinaryWriter(System.IO.File.Open(pafPdfPath, 
FileMode.CreateNew)))
 {
htmlText = System.IO.
 
{
{
pdfWriter.CloseStream = publicbyte[] 
Render()File.ReadAllText("c:\\file.html");byte[] 
renderedBuffer;using(varoutputMemoryStream = 
newMemoryStream())using(varpdfDocument = newDocument())PdfWriterpdfWriter = 
PdfWriter.GetInstance(pdfDocument, 
outputMemoryStream);false;//pdfWriter.PageEvent = new PrintHeaderFooter { Title 
= pageTitle };pdfDocument.Open();
{
{using(varhtmlViewReader = newStringReader(htmlText))using(varhtmlWorker = 
newHTMLWorker(pdfDocument))////Create a provider collection to set various 
processing properties//System.Collections.Generic.Dictionary<string, object> 
providers = new System.Collections.Generic.Dictionary<string, object>();////Set 
the image base. This will be prepended to the SRC so watch your forward 
slashes//providers.Add(HTMLWorker.IMG_BASEURL, "http://YOUR_DOMAIN";);////Bind 
the providers to the 
worker//htmlWorker.SetProviders(providers);htmlWorker.Parse(htmlViewReader);
}
}
}
renderedBuffer = 
outputMemoryStream.Position = 0;
outputMemoryStream.Read(renderedBuffer, 0, renderedBuffer.Length);
}
}newbyte[outputMemoryStream.Position];returnrenderedBuffer;
 
 
 

Regards,
Chaitanya Kolla.
9885155441
Image
Lorem Ipsum
ID: Lorem Ipsum
DOB: Lorem Ipsum
PROVIDER: Lorem Ipsum
Address: Lorem Ipsum, Franklin, TN 37067 Secure Fax Server: (123) Lorem Ipsum
 
Lorem Ipsum
Lorem Ipsum Lorem Ipsum/or
co-morbid conditions
Lorem Ipsum
Completed
Lorem Ipsum   no
Lorem Ipsum   no
Lorem Ipsum   no
Lorem Ipsum   yes
Lorem Ipsum   yes
Lorem Ipsum

Lorem Ipsum

Lorem Ipsum Lorem Ipsum Lorem Ipsum
Lorem Ipsum 12/2/2012 Member refused

 

Lorem Ipsum Lorem Ipsum Lorem Ipsum
Lorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem Ipsum Lorem IpsumLorem IpsumLorem Ipsum Lorem IpsumLorem IpsumLorem Ipsum

 

Lorem Ipsum Lorem Ipsum Lorem Ipsumn
Lorem IpsumLorem IpsumLorem IpsumLorem Ipsum 2/4/2013 12:00:00 AM Lorem Ipsum
LOREM IPSUM
Lorem Ipsum Lorem Ipsum
co-morbid conditions
Lorem Ipsum Lorem Ipsum
Lorem Ipsum 440.0 Lorem Ipsum Lorem Ipsum Yes

Attachment: File.pdf
Description: Adobe PDF document

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

Reply via email to