groupdocs-viewer / GroupDocs.Viewer-for-Java

GroupDocs.Viewer for Java examples, plugins and showcase
https://products.groupdocs.com/viewer/java
MIT License
23 stars 22 forks source link

What is replacement for PageImpl constructor #69

Closed securelyshare-shiva-kumar closed 2 years ago

securelyshare-shiva-kumar commented 3 years ago

Project details: Spring

I changed the Groupdocs viewer dependency to 21.2 and ran into compilation error in Utils.java class, applyWidthHeightFix method in this line of code.

pages.set(n, new Page(page.getNumber(), page.isVisible(), (fixWidth == 0) ? lastFixWidth : fixWidth, (fixHeight == 0) ? lastFixHeight : fixHeight, page.getLines()));

In 21.2 version Page is an interface and default implementation PageImpl is deprecated what is the suitable replacement for this.

liosha2007 commented 2 years ago

Hello. You can still use PageImpl class, it will not be deleted. But in this way you will not have opportunity to create custom models for your own implementation of serialization. The recommended way is to use CacheableFactory. There are methods for creating new instances of models. For example: CacheableFactory.getInstance().newPage(page.getNumber(), page.isVisible(), (fixWidth == 0) ? lastFixWidth : fixWidth, (fixHeight == 0) ? lastFixHeight : fixHeight, page.getLines()));

More details can be found in documentation