This is an archived forum post. The information may be outdated. Contact us if you have any questions.

Apply the Customize font- family to PDF

nitish_developer wrote on 2013-01-09:
Dear Support,

I like your dll very much, but it is not fullfilling my some requirements as :-

There is a list of requirement that i needed for converting my HTML text into PDF :-

1) Customized Font- Family basically Bookman Old Style applies to all elements of HTML.
2) Different Footer on left and right side .- Basically a quote on left side and page number on right side.

I have tried the first point with this code

string str = "<html><head><style>@font-face { font-family: Bookman Old Style; src: url(http://server.com/BOOKOS.TTF) format('truetype'); }</style> </head> <body>" + str+"</body>";

But still get no success, I am using the VS2010 and language is C#.

I am newbie to ASP.NET, any help will be greatly appreciated.

Thanks in advance !!!

Username - nitish_developer
support wrote on 2013-01-09:
Hello,

try the following:
pdfcrowd.Client client = new pdfcrowd.Client("***", "***");

string footer = @"<table cellspacing='0' style='margin:0;width:100%'>
<tr><td>quote</td><td style='text-align:right'>%p/%n</td></tr>
</table>";

string html = @"
<html>
  <head>
    <style>
      @font-face {
        font-family: 'Bookman Old Style';
        src: url('http://server.com/BOOKOS.TTF') format('truetype');
      }
      body { font-family: 'Bookman Old Style', serif; }
    </style>
  </head>
  <body>
    Bookman Old Style
  </body>
</html>
";

fileStream = new FileStream("file.pdf", FileMode.CreateNew);
client.setFooterHtml(footer);
client.convertHtml(html, fileStream);
fileStream.Close();
nitish_developer wrote on 2013-01-30:
Sir, it is not getting the font that i reqiured.

For e.g.

string footer = @"<table cellspacing='0' style='margin:0;width:100%'>
<tr><td>quote</td><td style='text-align:right'>%p/%n</td></tr>
</table>";

string html = @"
<html>
<head>
<style>
@font-face {
font-family: 'MANGAL';
src: url('http://software.agraneeh.com/MANGALB.TTF') format('truetype');
}
body { font-family: 'MANGAL', serif; }
</style>
</head>
<body>
Bookman Old Style
</body>
</html>
";

fileStream = new FileStream("file.pdf", FileMode.CreateNew);
client.setFooterHtml(footer);
client.convertHtml(html, fileStream);
fileStream.Close();




-----------------------

It is not getting the font that i had given and it is displaying the font Arimo, Samyak (devnagari) and Sarai.

Help me for generating the pdf and i need it on urgent basis.
support wrote on 2013-01-30:
The code snippet works for me. You can verify it in our online conversion form which uses the same backend as the API. Paste the following to http://pdfcrowd.com/#convert_by_input and click the "Convert To PDF" button.
<html> 
<head> 
<style> 
@font-face { 
font-family: 'MANGAL'; 
src: url('http://software.agraneeh.com/MANGALB.TTF') format('truetype'); 
} 
body { font-family: 'MANGAL', serif; } 
</style> 
</head> 
<body> 
Bookman Old Style 
</body> 
</html>

It creates PDF with the Mangal font embedded, see the attached file.
nitish_developer wrote on 2013-01-31:
I had mail the HIndi code as it is not displaying the Hindi Data