Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Mon Jan 08, 2024 10:36 am

Hi,
We tried to upgrade spiredoc library from 11.7.0 to 12.1.0.
After upgrade we have missing classes in spire.doc-12.1.0.jar:
com.spire.doc.documents.PointsConverter
com.spire.pdf.PdfDocument
com.spire.license.LicenseProvider
com.spire.pdf.PdfDocument

Please help to resolve this issue.

Thanks
Andrei Chorin

andrei.chorin
 
Posts: 68
Joined: Sun Jan 08, 2023 2:36 pm

Tue Jan 09, 2024 2:26 am

Hello,

Thank you for your inquiry.
Regarding your query, starting from Spire.Doc for Java Version: 12.1.0, the dependency on Spire.Pdf.jar has been removed. As a result, the classes "com.spire.pdf.PdfDocument" and "com.spire.pdf.PdfDocument" no longer exist.
Furthermore, the class "com.spire.license.LicenseProvider" has been changed to "com.spire.doc.license.LicenseProvider". Please make note of this modification for future reference.
However, I regret to inform you that there is currently no alternative method or interface available to replace the class "com.spire.doc.documents.PointsConverter", as it has been removed.
If you have any further questions or concerns, please don't hesitate to reach out to us.

Sincerely,
Annika
E-iceblue support team
User avatar

Annika.Zhou
 
Posts: 1657
Joined: Wed Apr 07, 2021 2:50 am

Tue Jan 09, 2024 10:58 pm

Hi,
What we should use instead PointsConverter.fromPixel() in order to calculate sizes?

Thanks,
Andrei Chorin

andrei.chorin
 
Posts: 68
Joined: Sun Jan 08, 2023 2:36 pm

Wed Jan 10, 2024 1:22 am

Hello,

Thank you for your feedback.
Our Spire.PDF for Java provides the "com.spire.pdf.graphics.PdfUnitConvertor" class for unit conversion purposes. Below is an example code snippet:
Code: Select all
// Create a new instance of PdfUnitConvertor.
PdfUnitConvertor convertor = new PdfUnitConvertor();
// Convert 100 pixels to points using the PdfGraphicsUnit.Pixel and PdfGraphicsUnit.Point units.
float values = convertor.convertUnits(100f, PdfGraphicsUnit.Pixel, PdfGraphicsUnit.Point);

Furthermore, if you need to use both Spire.PDF and Spire.Doc in the same project, please directly import the Spire.Office library to avoid any compatibility issues. Spire.Office includes both Spire.PDF and Spire.Doc functionalities.

Sincerely,
Annika
E-iceblue support team
User avatar

Annika.Zhou
 
Posts: 1657
Joined: Wed Apr 07, 2021 2:50 am

Wed Jan 10, 2024 9:13 am

Hi,
License we have is:
Code: Select all
      <Name>Spire.Doc for JAVA</Name>
      <Version>12.1</Version>

Is using of Spire.Office (PdfDocument, PdfGraphicsUnit) covered with this license?

Thanks,
Andrei Chorin

andrei.chorin
 
Posts: 68
Joined: Sun Jan 08, 2023 2:36 pm

Wed Jan 10, 2024 9:40 am

Hello,

Thank you for your feedback.
Your license is valid for operations within the "com.spire.doc" package of Spire.Office. Regarding the "com.spire.pdf.graphics.PdfUnitConvertor" class in Spire.PDF, it is primarily used for data conversion and does not directly manipulate PDF documents. Therefore, there won't be any warning watermarks in the resulting output file.
If you are still concerned about using the "com.spire.pdf.graphics.PdfUnitConvertor" class, you can develop your own unit conversion tool using code. The deprecation of the "com.spire.doc.documents.PointsConverter" class is primarily for the security considerations of our product.

Sincerely,
Annika
E-iceblue support team
User avatar

Annika.Zhou
 
Posts: 1657
Joined: Wed Apr 07, 2021 2:50 am

Wed Jan 10, 2024 10:07 am

Hi,
I've checked
Code: Select all
        <artifactId>spire.office</artifactId>
        <version>8.12.0</version>

from official downloads and it contains com.spire.doc.documents.PointsConverter class.
Is this library (spire.office-8.12.0.jar) contains SpireDoc 12.1.0 for java?

Thanks,
Andrei Chorin

andrei.chorin
 
Posts: 68
Joined: Sun Jan 08, 2023 2:36 pm

Thu Jan 11, 2024 3:20 am

Hello,

Thank you for your feedback.
Currently, the latest version of Spire.Office for Java, Version 8.12.0, does not include Spire.Doc for Java Version 12.1.0.
Regarding the usage of the "com.spire.doc.documents.PointsConverter" class, I have written the following method as an alternative. Please refer to it:
Code: Select all
//Replace interface PointsConverter.fromCm()
private static float ConvertCmToPt(float cm){
    float result = (float) ( cm / 2.54 * 72);
    return  result;
}
//Replace interface PointsConverter.fromMm()
private static float ConvertMmToPt(float mm){
    float result = (float) ( mm / 25.4 * 72);
    return  result;
}
//Replace interface PointsConverter.fromPixel()
private static float ConvertPxToPt(float px){
    float result = px *3 /4;
    return  result;
}
//Replace interface PointsConverter.fromInch()
private static float ConvertInchToPt(float inch){
    float result = inch *72;
    return  result;
}

Please feel free to use this method in your code.

Sincerely,
Annika
E-iceblue support team
User avatar

Annika.Zhou
 
Posts: 1657
Joined: Wed Apr 07, 2021 2:50 am

Return to Spire.Doc