Hi I am evaluating a trial license and I am migrating from GroupDocs Viewer 19.11 to GroupDocs Viewer 20.1. I’m having an issue where the HTML rendering only is outputting 2 pages when there are more than 2. I’ve tried it with multiple docx files and it does the same thing. Did anything change where trial licenses will only output 2 pages? The same license outputs the whole document in 19.8.1
EDIT: I’d like to add, that I don’t see any aspose watermarks on the page and i’m sure my license is being accepeted as there aren’t any errors.
1 Like
@sayed.amir,
Please share following details and we’ll look into this issue:
- API variant (Java or .NET)
- Problematic document
- Sample code that you wrote for rendering
- License file expiry date (you can see that by opening license file in some text editor)
@atirtahir3
-
I am using the Java API.
-
I attached a sample document
-
Here is my code:
try {
LoadOptions loadOptions = new LoadOptions();
Viewer viewer = new Viewer(stream, loadOptions);
viewer.view(HtmlViewOptions.forEmbeddedResources(new PageStreamFactory() {
@Override
public OutputStream createPageStream(int pageNumber) {
return new ByteArrayOutputStream();
}
@Override
public void closePageStream(int pageNumber, OutputStream pageStream) {
ByteArrayOutputStream outputStream = (ByteArrayOutputStream)pageStream;
byte[] bytes = outputStream.toByteArray();
String outputHtml = new String(bytes);
System.out.println(pageNumber);
System.out.println(outputHtml);
}
}));
viewer.close();
}
catch(Exception e) {
e.printStackTrace();
}
The System.out.println(pageNumber) line only prints up to 2.
I also did the following lines to print the page count and it prints 2.
Viewer viewer = new Viewer(stream, loadOptions);
ViewInfoOptions viewInfoOptions = ViewInfoOptions.forHtmlView();
ViewInfo documentInfo = viewer.getViewInfo(viewInfoOptions);
System.out.println(documentInfo.getPages().size());
- 20200626 is the expiration
lorem.zip (20.8 KB)
1 Like
@atirtahir3
I believe the problem is my environment. So i’m trying to run GroupDocs in a Atlassian SDK plugin that I am developing. I just tried the same code with the same file in a separate Java spring web server and it worked just fine. So for some reason, when running in the Atlassian OSGI plugin environment, it only outputs 2 pages.
This will probably be a tough problem for you to help me with as you don’t have the same environment as me, but is there anything that you can think of that will make it only output 2 pages? The only thing I can think of is the trial license. Perhaps the XML parsing of the license isn’t working properly in my environment?
To give you a little more background, I had the viewer working in the Atlassian plugin environment with version 19.11, but when I tried a visio file, I was getting the following error:
[INFO] class com.groupdocs.viewer.exception.GroupDocsViewerException: class com.groupdocs.viewer.exception.GroupDocsException: java.lang.IllegalArgumentException: Not supported: http://javax.xml.XMLConstants/property/accessExternalDTD
—> java.lang.IllegalArgumentException: Not supported: http://javax.xml.XMLConstants/property/accessExternalDTD
[INFO] — End of inner exception stack trace —
[INFO] com.groupdocs.viewer.converter.a.q.b(Unknown Source)
[INFO] com.groupdocs.viewer.converter.a.q.aO(Unknown Source)
[INFO] com.groupdocs.viewer.converter.a.q.a(Unknown Source)
[INFO] com.groupdocs.viewer.converter.a.h.d(Unknown Source)
[INFO] com.groupdocs.viewer.converter.a.h.aU(Unknown Source)
[INFO] com.groupdocs.viewer.converter.a.h.aT(Unknown Source)
[INFO] com.groupdocs.viewer.converter.a.h.bU(Unknown Source)
[INFO] com.groupdocs.viewer.converter.a.bW(Unknown Source)
[INFO] com.groupdocs.viewer.handler.ViewerHandler.a(Unknown Source)
[INFO] com.groupdocs.viewer.handler.ViewerHandler.a(Unknown Source)
[INFO] com.groupdocs.viewer.handler.ViewerHandler.getPages(Unknown Source)
…
Caused by: java.lang.IllegalArgumentException: Not supported: http://javax.xml.XMLConstants/property/accessExternalDTD
[INFO] at org.apache.xalan.processor.TransformerFactoryImpl.setAttribute(TransformerFactoryImpl.java:571)
After some research, my guess was I was getting that error because there was a dependency conflict between the xalan atlassian uses and the one that GroupDocs viewer uses. So I decided to try viewer 20.1 and now I don’t get that error and visio files work, BUT i only see 2 pages per document.
If you can help me resolve the error above, I don’t mind going back to 19.11
1 Like
@sayed.amir,
You are getting 2 pages as output and they don’t have any evaluation tag/watermark. Generally, API doesn’t behave like this. Yes, there are some cases when license is not properly applied (despite of the fact that license is valid). But with some changes/configurations in such an environment, issue could be fixed.
In order to investigate the issue properly, we need to configure same environment at our end. Without that it won’t be possible to find root cause. Please share
- Your complete development environment details (e.g. OS, Java version, tools, SDKs, Plugins used)
- All the the steps/processes to setup the environment (like you have)
- Console application that could be executed in such an environment and using that issue could be reproduced
@atirtahir3
Here is a sample project sample-project.zip (34.5 KB)
that I created on running a atlassian plugin with groupdocs working. I put the instructions in the README on what to install and how to run it.
I noticed that the problem doesn’t happen when I only use groupdocs-viewer, but when I add groupdocs-comparison as a dependency to the project, it only outputs the first 2 pages.
Let me know if there are any issues running my sample project.
1 Like
@sayed.amir,
This issue is reproduced at our end as well. It’s under investigation with ID VIEWERJAVA-2206. We’ll notify you about the outcomes and why only 2 HTML pages are generated.
@atirtahir3
Okay please let me know when you have more information.
1 Like
@sayed.amir
Your reported issue is now fixed in API version 20.1.1. Please integrate latest version of the API in your project and let us know if issue persists.
@atirtahir3
I confirmed that this problem is now fixed, I can render more than two pages now.
One other issue i’m having is the HTML rendering is showing some weird characters for my word docx, looks like an encoding problem. The characters … show up as … and " show up as a weird character as well. Im using the same viewer code from above.
1 Like
@sayed.amir
Can you please share the problematic Word document?