Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9137817
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:10:34+00:00 2026-06-17T09:10:34+00:00

I have embedded my custom fonts in html with @font-face. This working with all

  • 0

I have embedded my custom fonts in html with @font-face. This working with all browser but when I am trying to convert it to pdf through itextrender in java custom font is not working anymore its taking default fonts like Arial.

css code:

    @font-face {
        font-family: Subaru-Medium;
        src: url('fonts/Subaru-Medium.eot'); /* IE9 Compat Modes */
        src: url('fonts/Subaru-Medium.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
             url('fonts/Subaru-Medium.ttf')  format('truetype'), /* Safari, Android, iOS */
             url('fonts/Subaru-Medium.svg#svgFontName') format('svg'); /* Legacy iOS */
        }

java code:

public static void writePDF(String HTMLfileName, String PDFFileName, String WhereToSave,String fontDirectory)
    {
        try
        {
            String url = new File(HTMLfileName).toURI().toURL().toString();
            String outputFile = WhereToSave+PDFFileName;
            OutputStream os = new FileOutputStream(outputFile);

            ITextRenderer renderer = new ITextRenderer();
            ITextFontResolver fontResolver=renderer.getFontResolver();
                  fontResolver.addFont("C:\\Users\\benay.debnath\\Desktop\\htmltemplate\\fonts\\Subaru-Medium.ttf", true);

                // fontResolver.addFontDirectory(fontDirectory, true);
                SharedContext scontext=renderer.getSharedContext();
                // scontext.setDPI(72);
                scontext.setDotsPerPixel(12);
                renderer.setDocument(url);
                renderer.layout();
                renderer.createPDF(os);
                os.close();
                System.out.println("status:$:true^#^message:$:PDF    Genarated^#^fileName:$:"+outputFile);
        }catch (Exception e) {
            System.out.println("status:$:false^#^message:$:"+e.getMessage());
        }
    }

Any one can help me to find what I am doing wrong? help much appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T09:10:35+00:00Added an answer on June 17, 2026 at 9:10 am

    This issue has resolved, the problem was in css I mentioned font-family:”Subaru-Medium” in font file(.ttf) font name was “Subaru Medium” so it was not working. Now its working fine 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I made a website with custom fonts embedded on the website using font-face. The
I have a web application that is using CSS3's @font-face to embed custom fonts.
Im trying to create a custom formatter in Symfony 1.4. I have embedded form
I've been having a lot of difficulties with using custom fonts and @font-face .
My problem is that custom fonts do not display when using @font-face . My
I have managed to get a custom SWF embedded in Facebook wall posts. This
I am using font-face in CSS to import custom fonts on to a web
I have a custom font embedded in my iPhone app that previously has rendered
I tried add custom font and have lots of troubles :( this is my
I have have Gulim, a custom font, embedded into my website at mangodownload.com (you

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.