Free Support Forum -

[JAVA] Incorrect stylesheet link in generated html file


GroupDoc.Viewer v17.2

I’m generating html file in cache folder with ResourcesEmbedded = false, because it seems the total size is smaller when sending to browser.
But I found the stylesheet link is incorrect.
For example below in page1.html(image.png (5.0 KB)):

<link rel="stylesheet" type="text/css" href="fontFaces.css" media="all" />

Actually, fontFaces.css is in “resources/page1” folder(image.png (5.0 KB)),
So correct link should be:

<link rel="stylesheet" type="text/css" href="resources/page1/fontFaces.css" media="all" />

I attached generated files for your reference( (16.7 KB)).

Thank you.


Thanks for sharing the issue details with all the relevant information. We successfully reproduced this issue at our end. Hence, its been logged in our internal issue tracking system with ID:VIEWERJAVA-1503. As we get any update from the concerned team, we’ll surely notify you.


We got an update. You need to save HTML resources as well in order to view HTML pages properly.

Save resources in cache:

Save resources in output HTML files as follows:
for(HtmlResource resource : page.getHtmlResources()){ //save resource into "resources/page" + page.getPageNumber() + "/" }

This is how complete method will look like:

HtmlOptions options = new HtmlOptions();
List<PageHtml> pages = htmlHandler.getPages(guid, options);

for (PageHtml page : pages) {
   Utilities.saveAsHtml(page.getPageNumber() + "_" + fileName, page.getHtmlContent());
   for(HtmlResource resource : page.getHtmlResources()){
       //save resource into "resources/page" + page.getPageNumber() + "/"

If you still face any further issues, please let us know.


The issue you have found earlier (filed as VIEWERJAVA-1503) has been fixed in this update.