how can i add a font family in in pdf itextsharp c# -
here code:
stringbuilder sb = new stringbuilder(); sb.append("<table border='1' style='border- collapse:collapse;width:100%;margin-top:10px;font-family: 'source sans pro','helvetica neue',helvetica,arial,sans-serif !important;font-size: 14px !important;font-weight: 300;'>"); sb.append("<tr>"); sb.append("<td align='center' style='padding:5px;'>"); sb.append("question"); sb.append("</td>"); sb.append("<td align='center' style='padding:5px;'>"); sb.append("<h4>answer</h4>"); sb.append("</td>"); sb.append("</tr>"); sb.append("<tr>"); sb.append("<td style='padding:5px;'>"); sb.append("gender"); sb.append("</td>"); sb.append("<td style='padding:5px;'>"); sb.append(result.rows[0]["question1"].tostring()); sb.append("</td>"); sb.append("</tr>"); sb.append("<tr>"); sb.append("<td style='padding:5px;'>"); sb.append("age group"); sb.append("</td>"); sb.append("<td style='padding:5px;'>"); sb.append(result.rows[0]["question2"].tostring()); sb.append("</td>"); sb.append("</tr>"); stringreader sr = new stringreader(sb.tostring()); document pdfdoc = new document(pagesize.a4, 10f, 10f, 10f, 0f); htmlworker htmlparser = new htmlworker(pdfdoc); using (memorystream memorystream = new memorystream()) { pdfwriter writer = pdfwriter.getinstance(pdfdoc, memorystream); pdfdoc.open(); htmlparser.parse(sr); pdfdoc.close(); byte[] bytes = memorystream.toarray(); memorystream.close(); response.clear(); response.contenttype = "application/pdf"; response.addheader("content-disposition", "; filename=survey.pdf"); response.buffer = true; response.charset = ""; response.cache.setcacheability(httpcacheability.nocache); response.binarywrite(bytes); response.flush(); response.end(); response.close(); }
here how can add font family :'source sans pro','helvetica neue',helvetica,arial,sans-serif !important , font-weight: 400; text in pdf.
how add font family , font style in pdf itextsharp.
i using code not working. style in sb.append in table not working in pdf page in .net c#. trying below code not working:
//font fon = fontfactory.getfont("source sans pro", 14); //font fon1 = fontfactory.getfont("helvetica neue", 14); //font fon2 = fontfactory.getfont("helvetica", 14); //font fon3 = fontfactory.getfont("arial", 14); //font fon4 = fontfactory.getfont("sans-serif", 14);
any suggestions??
Comments
Post a Comment