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.

Mon Oct 01, 2018 3:06 am

I am using Spire.PDF for Java.

For this code:
PdfTrueTypeFont font1= new PdfTrueTypeFont(new Font("Helvetica",Font.PLAIN,12));

I get :
Fail to save. Saving of requested font type is not supported. I actually need to save it in "Arial" . But it also gives same error.

PS: I am using Netbeans on Mac.

Safder
 
Posts: 21
Joined: Fri Sep 28, 2018 8:08 am

Mon Oct 01, 2018 4:47 am

Hello,

Thanks for inquiry.
I used Eclipse to run this code and it could creat the pdf file successfully.
Code: Select all
PdfTrueTypeFont font1= new PdfTrueTypeFont(new Font("Arial",Font.PLAIN,12));

Here is my full code, and I attached the generated pdf file.
Code: Select all
mport java.awt.Font;
import java.awt.geom.Point2D;

import com.spire.pdf.FileFormat;
import com.spire.pdf.PdfDocument;
import com.spire.pdf.PdfPageBase;
import com.spire.pdf.graphics.*;
public class DrawingText {

   public static void main(String[] args) {
       //Create a Pdf file
        PdfDocument doc = new PdfDocument();
        //Add a page
        PdfPageBase page = doc.getPages().add();
       
        //Draw text
        DrawText(page);
        doc.saveToFile("D:\\DrawText.pdf", FileFormat.PDF);
   }
   static void DrawText(PdfPageBase page) {
        String text = "Your Office Development Master";
       
        PdfTrueTypeFont font1= new PdfTrueTypeFont(new Font("Arial",Font.PLAIN,12),true);
        page.getCanvas().drawString(text, font1, PdfBrushes.getBlack(), new Point2D.Float(80, 80));
     
    }
}

Please try to run my code with your tool. If it still unsuccessfully creates the pdf file, please share us with the error information in detail? Thank you in advance.

Sincerely,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2766
Joined: Wed Jun 27, 2012 8:50 am

Mon Oct 01, 2018 5:43 am

Exception in thread "main" class com.package.phA: Fail to save. Saving of requested font type is not supported.
com.package.wGA.\  (txe:210)
com.spire.pdf.graphics.PdfTrueTypeFont.<init>(jgd:64)
com.spire.pdf.graphics.PdfTrueTypeFont.<init>(jgd:113)
com.spire.pdf.graphics.PdfTrueTypeFont.<init>(jgd:153)
delete.Delete.DrawText(Delete.java:36)
delete.Delete.main(Delete.java:30)
at com.package.wGA.\  (txe:210)
at com.spire.pdf.graphics.PdfTrueTypeFont.<init>(jgd:64)
at com.spire.pdf.graphics.PdfTrueTypeFont.<init>(jgd:113)
at com.spire.pdf.graphics.PdfTrueTypeFont.<init>(jgd:153)
at delete.Delete.DrawText(Delete.java:36)
at delete.Delete.main(Delete.java:30)
/Users/faaa/NetBeansProjects/Delete/nbproject/build-impl.xml:1328: The following error occurred while executing this line:
/Users/faaa/NetBeansProjects/Delete/nbproject/build-impl.xml:948: Java returned: 1
BUILD FAILED (total time: 4 seconds)

Safder
 
Posts: 21
Joined: Fri Sep 28, 2018 8:08 am

Mon Oct 01, 2018 8:16 am

Hello,

Thanks for sharing error information.
I will report the issue occurred in netbeans to our dev team. But our dev team can investigate the issue on 08/10/2018 as we are on 7-Day National Holiday from 01/10/2018 to 07/10/2018.

Sorry for any inconveniences caused by us and we appreciate your support and understanding.

Happy National Holiday and best wishes to you all!

Sincerely,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2766
Joined: Wed Jun 27, 2012 8:50 am

Thu Oct 04, 2018 3:21 pm

Alright but please respond ASAP

Safder
 
Posts: 21
Joined: Fri Sep 28, 2018 8:08 am

Mon Oct 08, 2018 10:21 am

Hi,

Thanks for patient waiting.
We have come back to office now. Our dev team has started to investigate the issue. We will notify you as soon as there is any update.

Sincerely,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2766
Joined: Wed Jun 27, 2012 8:50 am

Wed Oct 10, 2018 10:12 am

Hi,

I got news from our dev team. The issue was caused by the lack of "Arial"font on Mac. When using PdfTrueTypeFont, the font must be installed on machine. Please try to install Arial font and then test again.

Sincerely,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2766
Joined: Wed Jun 27, 2012 8:50 am

Fri Oct 12, 2018 3:36 am

Hi,

How is the issue now? Did you try to install Arial font on your Mac?
I am looking forward to your feedback. Thanks in advance.

Sincerely,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2766
Joined: Wed Jun 27, 2012 8:50 am

Sat Oct 13, 2018 9:56 am

Arial font is already available on my Font Book(Mac OS) . It seems like it was already installed.
I think it could be Permission issue or something.. I am on Mac, (new) Netbeans 9. Please check the Exception error again and help me get through this.


Quoting the error again
Exception in thread "AWT-EventQueue-0" class com.package.phA: Fail to save. Saving of requested font type is not supported.
com.package.wGA.\  (txe:210)
com.spire.pdf.graphics.PdfTrueTypeFont.<init>(jgd:64)
com.spire.pdf.graphics.PdfTrueTypeFont.<init>(jgd:113)
com.spire.pdf.graphics.PdfTrueTypeFont.<init>(jgd:153)
DrawingText.DrawText(DrawingText.java:33)
DrawingText.Start(DrawingText.java:27)
NewJFrame.jButton1ActionPerformed(NewJFrame.java:86)
NewJFrame.access$000(NewJFrame.java:32)
NewJFrame$1.actionPerformed(NewJFrame.java:60)
java.desktop/javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1967)
java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2308)
java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:405)
java.desktop/javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:262)
java.desktop/javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:270)
java.desktop/java.awt.Component.processMouseEvent(Component.java:6589)
java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3342)
java.desktop/java.awt.Component.processEvent(Component.java:6354)
java.desktop/java.awt.Container.processEvent(Container.java:2261)
java.desktop/java.awt.Component.dispatchEventImpl(Component.java:4966)
java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2319)
java.desktop/java.awt.Component.dispatchEvent(Component.java:4798)
java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4914)
java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4543)
java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4484)
java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2305)
java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2772)
java.desktop/java.awt.Component.dispatchEvent(Component.java:4798)
java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:772)
java.desktop/java.awt.EventQueue.access$600(EventQueue.java:97)
java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
java.base/java.security.AccessController.doPrivileged(Native Method)
java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:87)
java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:97)
java.desktop/java.awt.EventQueue$5.run(EventQueue.java:745)
java.desktop/java.awt.EventQueue$5.run(EventQueue.java:743)
java.base/java.security.AccessController.doPrivileged(Native Method)
java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:87)
java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742)
java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
at com.package.wGA.\  (txe:210)
at com.spire.pdf.graphics.PdfTrueTypeFont.<init>(jgd:64)
at com.spire.pdf.graphics.PdfTrueTypeFont.<init>(jgd:113)
at com.spire.pdf.graphics.PdfTrueTypeFont.<init>(jgd:153)
at DrawingText.DrawText(DrawingText.java:33)
at DrawingText.Start(DrawingText.java:27)
at NewJFrame.jButton1ActionPerformed(NewJFrame.java:86)
at NewJFrame.access$000(NewJFrame.java:32)
at NewJFrame$1.actionPerformed(NewJFrame.java:60)
at java.desktop/javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1967)
at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2308)
at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:405)
at java.desktop/javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:262)
at java.desktop/javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:270)
at java.desktop/java.awt.Component.processMouseEvent(Component.java:6589)
at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3342)
at java.desktop/java.awt.Component.processEvent(Component.java:6354)
at java.desktop/java.awt.Container.processEvent(Container.java:2261)
at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:4966)
at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2319)
at java.desktop/java.awt.Component.dispatchEvent(Component.java:4798)
at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4914)
at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4543)
at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4484)
at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2305)
at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2772)
at java.desktop/java.awt.Component.dispatchEvent(Component.java:4798)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:772)
at java.desktop/java.awt.EventQueue.access$600(EventQueue.java:97)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:87)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:97)
at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:745)
at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:743)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:87)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

Safder
 
Posts: 21
Joined: Fri Sep 28, 2018 8:08 am

Mon Oct 15, 2018 8:20 am

Hi,

Thanks for your feedback.
I hava forwarded the error information to our dev team. We will do further investigation and notify you when there is any update.

Sincerely,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2766
Joined: Wed Jun 27, 2012 8:50 am

Wed Oct 17, 2018 10:44 pm

Okay thanks.

Safder
 
Posts: 21
Joined: Fri Sep 28, 2018 8:08 am

Sat Nov 10, 2018 4:00 am

Any update?
because this thing is working :
jButton1.setFont(new Font("Arial",Font.PLAIN,12) );

but not with this:
PdfTrueTypeFont font1= new PdfTrueTypeFont(new Font("Arial",Font.PLAIN,12),true);
page.getCanvas().drawString(text, font1, PdfBrushes.getBlack(), new Point2D.Float(80, 80));

I could do team viewer session too if you're available DM if you actually can,

Thanks.

Safder
 
Posts: 21
Joined: Fri Sep 28, 2018 8:08 am

Mon Nov 12, 2018 9:45 am

Hello

Thanks for your inquiry.
Yes, we can do a team viewer session. Our working time is GMT+8 9:00 AM to 18:00 PM. You can send the session ID to support@e-iceblue.com via email. But in fact, now we hava no available Mac OS machines. We are building some machines to do a complete test for our Spire.Pdf java. Maybe we can give you a detailed feedback on the issue after finishing the investigation.

Sincerely,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2766
Joined: Wed Jun 27, 2012 8:50 am

Tue Nov 13, 2018 9:44 am

Hello,

Hope you are doing well.
After deep investigating, we found out the causation and it was related to our product. Sorry for the inconvenience caused.
I am glad to tell you that now the issue has been fixed. We will notify you when new version is available.

Sincerely,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2766
Joined: Wed Jun 27, 2012 8:50 am

Thu Nov 22, 2018 6:16 am

Okay thanks update me as soon as it gets fixed. My project has been held because of the issue

Safder
 
Posts: 21
Joined: Fri Sep 28, 2018 8:08 am

Return to Spire.PDF