Print Page | Close Window

[Android SDK] Issue with text/font not rendered

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=4025
Printed Date: 22 Nov 24 at 8:07AM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: [Android SDK] Issue with text/font not rendered
Posted By: k.szalach
Subject: [Android SDK] Issue with text/font not rendered
Date Posted: 28 Sep 23 at 8:29AM
Hello!

I know that library is already discontinued from being supported, but maybe someone will be able to help.
I have a PDF file which has a text that uses FreeSans font. There are also some other fonts in this PDF, but only text with FreeSans is not rendered at all when using quick PDF SDK (we use rendertobitmap option). 

I've tried to check if the fonts are embedded into the file and using Adobe Reader it seems that only Helvetica is embedded. I confirmed this also by checking within library using FindFonts and getting the font data:
(0 until pdfLibrary.FindFonts()).forEach { fontIndex ->
val fontId = pdfLibrary.GetFontID(fontIndex)
pdfLibrary.SelectFont(fontId)
Trace.i(TAG, "Font: ${pdfLibrary.FontName()}, ${pdfLibrary.FontFamily()}, ${pdfLibrary.FontSize()}, ${pdfLibrary.FontType()}, ${pdfLibrary.FontHasKerning()}, ${pdfLibrary.FontReference()}")
}

And the outcome is:
Font: , , 0, 0, 0, 
Font: Helvetica, , 0, 2, 0, QuickPDFF03FF2F0B

Although no clue what the first font is, but I guess it doesn't matter. As checked here  http://www.quickpdf.org/forum/nonembedded-fonts-not-working_topic3601.html" rel="nofollow - http://www.quickpdf.org/forum/nonembedded-fonts-not-working_topic3601.html  it looks like there are only few embedded fonts in the library. So does it mean that if other fonts are not embedded into PDF file, then the library will not be able to display them?

My questions are:
- is it possible to somehow replace on-the-fly fonts, that are not available with some other standard ones? I've seen a method ReplaceFonts, but I couldn't find any info about it.
- is it possible to add font on-the-fly so the library will be able to render them? All examples I've found are using adding fonts when creating new text or filling form fields, so I don't feel they apply to our use case.

And now, the most strange part is that this issue occurs only on Android 12, 13 and 14, but not on Android 9, 10 or 11. So it looks like something also changed in Android system that makes it not working anymore. I also did profiling on Android 13 and it looks like there is some issue with SelectFont function in library, which makes significant amount of time.
https://ibb.co/tPqZTX0" rel="nofollow">

Appreciate any help, thank you!



Replies:
Posted By: Ingo
Date Posted: 01 Oct 23 at 2:47PM
Hi Krzysztof ... welcome here :) 

Don't think that nobody is looking here but QuickPDF is mainly used with windows development.
Due to this experts regarding android will be less here.
So please be patient and don't stop trying yourself ;-)



-------------
Cheers,
Ingo



Posted By: tfrost
Date Posted: 02 Oct 23 at 10:12PM
If the font is not embedded in the PDF and not on the device, then clearly text in that specific font will not be displayed. I am one of the Windows developers whom Ingo describes as the majority here, so I cannot help you with details of how and whether fonts can be substituted on Android, or how you would find a suitable font to substitute on an Android device; sorry.


Posted By: Ingo
Date Posted: 03 Oct 23 at 10:33PM
Hi Tim :)

But i think that the used pdf-reader tries to display the text in a similar layout if the exact font is missing?


-------------
Cheers,
Ingo



Posted By: tfrost
Date Posted: 04 Oct 23 at 10:53AM
But I think the 'used pdf-reader' in this case may be the app which Krzysztof is writing, in which the PDF is to be displayed or rendered. And I have no idea how different versions (or any versions) of Android deal with  fonts, so there is little more I can say.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk