Font fallback not working when using Apryse on Android

Product: Apryse Android SDK

Product Version: 11.0.0

Please give a brief summary of your issue:
Hi, In some files where the font is not present on the system, the PDF created after conversion doesn’t have any valid fallbacks and the PDF appears with blank text.

Please describe your issue and provide steps to reproduce it:

 fun OfficeToPDFTest(context: Context?)
    {
//        try
//        {
            val config = PDFNetConfig()
            if (config.getExtraResourcePaths() != null)
            {
                for (resPath in config.getExtraResourcePaths())
                {
                    if (resPath != null && resPath.exists())
                    {
                        PDFNet.addResourceSearchPath(resPath.absolutePath)
                    }
                }
            }

            // adds font cache path by default as well
            val fontCacheFolder: File = File(ARApp.getAppContext().getCacheDir(), FontResource.FONT_FOLDER)
            PDFNet.addResourceSearchPath(fontCacheFolder.absolutePath)
            if (!PDFNet.hasBeenInitialized())
            {
                PDFNet.initialize(ARApp.getAppContext(), com.pdftron.pdfnet.R.raw.pdfnet, null)
            }

        PDFNet.enableJavaScript(config.isJavaScriptEnabled)
        PDFNet.setDefaultDiskCachingEnabled(config.isDiskCachingEnabled)
        if (config.persistentCachePath != null)
        {
            PDFNet.setPersistentCachePath(config.persistentCachePath)
        }
        if (config.tempPath != null)
        {
            PDFNet.setTempPath(config.tempPath)
        }
        PDFNet.setViewerCache(config.viewerCacheMaxSize, config.isViewerCacheOnDisk)

        val layoutPluginPath = config.getLayoutPluginPath(context)
        if (null != layoutPluginPath)
        {
            PDFNet.addResourceSearchPath(layoutPluginPath)
        }
        val layoutSmartPluginPath = config.getLayoutSmartPluginPath(context)
        if (null != layoutSmartPluginPath)
        {
            PDFNet.addResourceSearchPath(layoutSmartPluginPath)
        }
        val exoticFontPluginPath = config.getExoticFontPluginPath(context)
        if (null != exoticFontPluginPath)
        {
            PDFNet.addResourceSearchPath(exoticFontPluginPath)
        }
}


val doc = PDFDoc()

Convert.officeToPdf(doc, filePathToConvert, null)
val file = File(newFilePath)
if (file.exists())
{
       file.delete()
}
file.createNewFile()
doc.save(file.getAbsolutePath(), SDFDoc.SaveMode.LINEARIZED, null);

The above code is not able to do font substitution with default fallbacks. Do we need to do something else as well to achieve font substitution with fallbacks?

Please provide a link to a minimal sample where the issue is reproducible:
Provided above

1 Like

Thanks for reaching out to Support through our forum. In order to best assist you, would you be able to submit a minimum runnable sample project that can be run as-is, along with a video demonstrating this issue? You can do so here: Apryse

1 Like