Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Sun Aug 16, 2020 8:02 pm

hi
i need to use spire.pdf library for java.

i use free spire.pdf version 2.6.3.but when i run my code appears this problem:

Exception in thread "main" class com.spire.pdf.packages.sprKJA: Font parsing exception ---> com.spire.pdf.packages.sprLuB: No have this LanguageID
--- End of inner exception stack trace ---
com.spire.pdf.packages.sprHkA.spr (Unknown Source)
com.spire.pdf.packages.sprwkA.spr (Unknown Source)
com.spire.pdf.packages.sprejA.spr (Unknown Source)
com.spire.pdf.packages.sprejA.spr (Unknown Source)
com.spire.pdf.packages.sprejA.<init>(Unknown Source)
com.spire.pdf.packages.sprtlA.spr (Unknown Source)
com.spire.pdf.packages.sprrkA.spr (Unknown Source)
com.spire.pdf.graphics.PdfTrueTypeFont.<init>(Unknown Source)
com.spire.pdf.graphics.PdfTrueTypeFont.<init>(Unknown Source)
com.spire.pdf.graphics.PdfTrueTypeFont.<init>(Unknown Source)
com.spire.pdf.graphics.PdfTrueTypeFont.<init>(Unknown Source)
javaapplication7.JavaApplication7.main(JavaApplication7.java:42)
at com.spire.pdf.packages.sprHkA.spr (Unknown Source)
at com.spire.pdf.packages.sprwkA.spr (Unknown Source)
at com.spire.pdf.packages.sprejA.spr (Unknown Source)
at com.spire.pdf.packages.sprejA.spr (Unknown Source)
at com.spire.pdf.packages.sprejA.<init>(Unknown Source)
at com.spire.pdf.packages.sprtlA.spr (Unknown Source)
at com.spire.pdf.packages.sprrkA.spr (Unknown Source)
at com.spire.pdf.graphics.PdfTrueTypeFont.<init>(Unknown Source)
at com.spire.pdf.graphics.PdfTrueTypeFont.<init>(Unknown Source)
at com.spire.pdf.graphics.PdfTrueTypeFont.<init>(Unknown Source)
at com.spire.pdf.graphics.PdfTrueTypeFont.<init>(Unknown Source)
at javaapplication7.JavaApplication7.main(JavaApplication7.java:42)
Caused by: com.spire.pdf.packages.sprLuB: No have this LanguageID
at com.spire.pdf.packages.sprUKA.spr (Unknown Source)
at com.spire.pdf.packages.sprHkA.spr  (Unknown Source)
... 12 more


my code
Code: Select all
package javaapplication7;
import com.spire.pdf.PdfDocument;
import com.spire.pdf.PdfPageBase;
import com.spire.pdf.graphics.*;
import java.awt.*;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.EnumSet;
import com.spire.pdf.packages.sprKJA;
/**
 *
 * @author Mammad
 */
public class JavaApplication7 {

    /**
     * @param args the command line arguments
     */
     public static void main(String[] args) throws FileNotFoundException, IOException  {

        //create a PdfDocument object
        PdfDocument doc = new PdfDocument();

        //add a page
        PdfPageBase page = doc.getPages().add();

        //heading text
        String heading = "Java - Overview";

        //create solid brush objects
        PdfSolidBrush brush1 = new PdfSolidBrush(new PdfRGBColor(Color.BLUE));
        PdfSolidBrush brush2 = new PdfSolidBrush(new PdfRGBColor(Color.BLACK));

        //create true type font objects
        PdfTrueTypeFont font1= new PdfTrueTypeFont(new Font("Times New Roman",Font.PLAIN,20));
        PdfTrueTypeFont font2= new PdfTrueTypeFont(new Font("Arial Unicode MS",Font.PLAIN,12));

        //set the text alignment via PdfStringFormat class
        PdfStringFormat format1 = new PdfStringFormat();
        format1.setAlignment(PdfTextAlignment.Center);

        //draw heading on the center of the page
        page.getCanvas().drawString(heading, font1, brush1, new Point2D.Float((float)page.getActualBounds(true).getWidth()/2, 0),format1);

        //get body text from a .txt file
        String body = "a";

        //create a PdfTextWidget object
        PdfTextWidget widget = new PdfTextWidget(body, font2, brush2);

        //create a rectangle where the body text will be placed
        Rectangle2D.Float rect = new Rectangle2D.Float(0, 30, (float)page.getActualBounds(true).getWidth(),(float)page.getActualBounds(true).getHeight());

        //set the PdfLayoutType to Paginate to make the content paginated automatically
        PdfTextLayout layout = new PdfTextLayout();
        layout.setLayout(PdfLayoutType.Paginate);

        //draw body text on the page
        widget.draw(page, rect, layout);

        //save to file
        doc.saveToFile("1.pdf");
    }
   
}


pleassse help me.
i use jdk 1.8 and apache netbeans 12.0

mjabbari
 
Posts: 3
Joined: Sat Apr 21, 2018 3:54 pm

Mon Aug 17, 2020 8:21 am

Hello,

Thanks for your post.
According to your feedback via email. I noticed that our latest commercial version(Spire.PDF for Java Version:3.8.2) had fixed this issue. Sorry that we only upgrade our free version irregularly. As for your situation, please keep using our commercial version. We are willing to provide a temporary license (one month free) of Spire.PDF for Java to help you remove the warning message and evaluate our commercial version better. If you need it, just feel free to let us know.

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1261
Joined: Wed Apr 25, 2018 3:20 am

Tue Feb 23, 2021 1:37 pm

hi ,
today i download you last lib version and trying to test her in eclise Version: 2020-12 (4.18.0).
Debian 10 x64
JRE System library - Java SE-1.8 (jdk-15.0.2)

the simple code is :
Code: Select all
import com.spire.pdf.PdfDocument;
                //other code

      PdfDocument doc = new PdfDocument();


and here i have error in console :

Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
at com.spire.pdf.PdfDocument.<init>(Unknown Source)

EvilEyeBG
 
Posts: 1
Joined: Tue Feb 23, 2021 11:54 am

Wed Feb 24, 2021 2:01 am

Hello,

Thanks for your inquiry.
The cause of the error "java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException" is that JDK 9 and later versions doesn't provide JAXB jar. You need to install jaxb-api jar separately, as shown below. Feel free to contact us if you have further questions.

Code: Select all
  <dependency>
        <groupId>javax.xml.bind</groupId>
        <artifactId>jaxb-api</artifactId>
        <version>2.3.0</version>
    </dependency>


Sincerely,
Brian
E-iceblue support team
User avatar

Brian.Li
 
Posts: 1271
Joined: Mon Oct 19, 2020 3:04 am

Tue Mar 02, 2021 8:27 am

Hello,

Has your issue been resolved? Any feedback will be greatly appreciated.

Sincerely,
Brian
E-iceblue support team
User avatar

Brian.Li
 
Posts: 1271
Joined: Mon Oct 19, 2020 3:04 am

Thu Mar 25, 2021 7:16 am

Hello,
I have use spire.pdf version 3.11.6. i have used to convert pdf file into docx.
com.spire.pdf.PdfDocument doc = new PdfDocument();
//load a sample PDF file
doc.loadFromFile(FilePath);
//save as. docx file
doc.saveToFile(finalFilePath, FileFormat.DOCX);

this code is working on windows system but when i have run this on EC2 instance that time getting error like

class com.spire.ms.System.Exception: No 'Arial' font found!com.spire.pdf.packages.sprRQa.spr (Unknown Source)com.spire.pdf.packages.sprRQa.spr (Unknown Source)com.spire.pdf.packages.sprPaA.spr (Unknown Source)com.spire.pdf.packages.sprPaA.spr (Unknown Source)com.spire.pdf.packages.sprPaA.spr (Unknown Source)com.spire.pdf.packages.sprPaA.spr (Unknown Source)com.spire.pdf.packages.sprPaA.spr (Unknown Source)com.spire.pdf.PdfDocumentBase.spr (Unknown Source)com.spire.pdf.packages.sprwnb.spr (Unknown Source)com.spire.pdf.packages.sprwnb.spr (Unknown Source)com.spire.pdf.packages.sprwnb.spr (Unknown Source)com.spire.pdf.PdfDocumentBase.spr (Unknown Source)com.spire.pdf.PdfDocumentBase.save(Unknown Source)com.spire.pdf.PdfDocument.saveToFile(Unknown

after adding Arial font getting another error as follow
"message": "class com.spire.ms.System.Exception: No 'ZapfDingbats' font found!\ncom.spire.pdf.packages.sprRQa.spr

vishalrsb19
 
Posts: 2
Joined: Mon Jan 25, 2021 8:54 am

Thu Mar 25, 2021 9:54 am

Hello,

Thanks for your inquiry.
Kindly note that when using our Spire.PDF to convert PDF to docx, you need to install all fonts used in the PDF file in your system, otherwise the application may throw errors. Please make sure you have installed the corresponding fonts on your environment.

If the issue still occurs after installing the fonts, please provide your input file to help us investigate further. You could send it to us(support@e-iceblue.com) via email. Thanks in advance.

Sincerely,
Brian
E-iceblue support team
User avatar

Brian.Li
 
Posts: 1271
Joined: Mon Oct 19, 2020 3:04 am

Mon Apr 05, 2021 4:37 am

Brian.Li wrote:Hello,

Thanks for your inquiry.
Kindly note that when using our Spire.PDF to convert PDF to docx, you need to install all fonts used in the PDF file in your system, otherwise the application may throw errors. Please make sure you have installed the corresponding fonts on your environment.

If the issue still occurs after installing the fonts, please provide your input file to help us investigate further. You could send it to us(supportThanks for yourvia email. Thanks in advance.

Sincerely,
Brian
E-iceblue support team



Hello Brian.Li,
Thanks for the reply, can you please provide the list of fonts which are used in it.
It will helpful if you provide the font download link too

Thanks

vishalrsb19
 
Posts: 2
Joined: Mon Jan 25, 2021 8:54 am

Mon Apr 05, 2021 8:35 am

Hello,

Thanks for your feedback!

You can open your PDF in the Adobe Reader and then find the font used in your file in the File->Properties->Fonts. Or you can send the file to us for reference.

For the font download link, sorry that due to the copyright issue, we cannot provide you with any download link. I recommend that you can download the fonts from the internet. Hope you can understand.

Sincerely,
Marcia
E-iceblue support team
User avatar

Marcia.Zhou
 
Posts: 858
Joined: Wed Nov 04, 2020 2:29 am

Tue Dec 21, 2021 10:52 am

Hi
I am adding dynamic header, footer to the pdf file using free java library and after converting 2 pages, it is giving
Exception in thread "main" java.lang.ClassCastException: class com.spire.pdf.packages.sprOka cannot be cast to class com.spire.pdf.packages.sprqka (com.spire.pdf.packages.sprOka and com.spire.pdf.packages.sprqka are in unnamed module of loader 'app')
at com.spire.pdf.PdfDocumentBase.spr (Unknown Source)
at com.spire.pdf.PdfDocumentBase.importPageRange(Unknown Source)
at com.spire.pdf.PdfDocumentBase.importPage(Unknown Source)
at com.spire.pdf.PdfDocumentBase.split(Unknown Source)
at com.spire.pdf.PdfDocument.split(Unknown Source)


Please help me in this issue and why it is causing.

praveengandepalli
 
Posts: 1
Joined: Mon Dec 20, 2021 11:09 am

Wed Dec 22, 2021 1:20 am

Hello,

Thanks for your inquiry!

To help us reproduce your issue quickly and efficiently, please provide us with the following information for further investigate. Thanks in advance!

1. Your testing code.
2. Your input files(if any).
3. Your JDK version(E.g. JDK 1.8.0_271).
4. Your system information (E.g. Win7, 64 bit) and region setting (E.g. China, Chinese).

Sincerely,
Marcia
E-iceblue support team
User avatar

Marcia.Zhou
 
Posts: 858
Joined: Wed Nov 04, 2020 2:29 am

Tue Jan 04, 2022 6:19 am

Hello,

Hope you are doing well!

Has the issue been solved now? Could you please provide us with the information I mentioned in the last post for further investigate?

Thanks in advance.

Sincerely,
Marcia
E-iceblue support team
User avatar

Marcia.Zhou
 
Posts: 858
Joined: Wed Nov 04, 2020 2:29 am

Return to Spire.PDF