Texts in PDF are not visible during PNG view process

When I want to prepare PNG renditions of attached PDF documents with the Viewer, the text on the document is not displayed in the resulting PNG. This only happens with one of our customers. I have not encountered such a problem in the development environment. “GroupDocs.Total.NETFramework.24.6.0” is used in the customer environment. Also, when I want to view one of these documents with the online viewer at “View documents online | Free GroupDocs Apps”, it is displayed as a blank page. How can I fix this problem?
A1.PDF (9.3 KB)

A1.png (16.5 KB)

A2.PDF (48.6 KB)

A2.png (20.2 KB)

@fsimsek

It seems that you are experiencing issues with rendering text in PDF documents to PNG format, where the text is not visible in the output images. This problem appears to be specific to one of your customers’ environments using “GroupDocs.Total.NETFramework.24.6.0”. Additionally, the online viewer at “View documents online | Free GroupDocs Apps” is also displaying a blank page for the same documents.

Here are some potential solutions to address this issue:

  1. Font Issues: Ensure that all necessary fonts used in the PDF documents are installed on the customer’s system. Missing fonts can lead to text not being rendered correctly. You can enable font hinting in your rendering options to improve the display of fonts.

  2. Rendering Options: When rendering the PDF to PNG, consider using the RenderTextAsImage option. This will render the text as an image, which can help maintain the layout and visibility of the text in the output PNG files. Here’s a code snippet to illustrate this:

    using GroupDocs.Viewer;
    using GroupDocs.Viewer.Options;
    
    using (var viewer = new Viewer("document.pdf"))
    {
        var viewOptions = new PngViewOptions("output_{0}.png");
        viewOptions.PdfOptions.RenderTextAsImage = true; // Enable rendering text as image
        viewer.View(viewOptions);
    }
    
  3. Repairing Corrupted PDFs: If the PDF files are corrupted, you can enable the repair option when loading the document. This can help in cases where the PDF structure is not intact:

    LoadOptions loadOptions = new LoadOptions();
    loadOptions.TryRepair = true;
    
    using (var viewer = new Viewer("document.pdf", loadOptions))
    {
        var viewOptions = new PngViewOptions("output_{0}.png");
        viewer.View(viewOptions);
    }
    
  4. Testing with Different Versions: If possible, test the rendering process with a different version of the GroupDocs library to see if the issue persists. Sometimes, specific versions may have bugs that are resolved in later releases.

  5. Check for Document-Specific Issues: Since this issue is only occurring with specific documents, it may be beneficial to analyze those PDFs for any unique characteristics that could be causing the rendering problems.

If these suggestions do not resolve the issue, consider reaching out to GroupDocs support for further assistance, as they may have more insights into specific problems related to the library version or the documents in question.

Feel free to ask if you need further assistance or clarification on any of the steps mentioned!

@fsimsek

Thank you for attaching the source files and output files. We’ll analyze this issue and update you.

@fsimsek

I have tried to reproduce the issue but it worked well on my side. Can you please share more details about the target environment where GroupDocs.Total.NETFramework.24.6.0 is used, such as OS version, and .NET Framework that your application is targeting?

Having this information I’ll try reproduce the issue on a similar environment.