Jump to content
JGMS

Class Arial not found when using PowerPDF

Recommended Posts

I have installed PowerPDF in Delphi 12 via GitHub. The master package in Git seems to be made ready for Delphi12 (there is an 11AndAbove subdir).

In previous Delphi versions I used to install PowerPDF via GetIt, but the package still is not available. After about 3 months I can no longer wait.

 

Anyway, it looks like the installation was a success: all controls are in place, and I can drop a TPrReport component on a form.

However, the next step, i.e. to drop a TPrPage, fails, showing the "Class Arial not found" message.

Since a TPrPage is the container for all other PowerPDF controls, the package is unusable.

 

I have no idea how to get it to work. Do you?
I very much appreciate your help or hints.

 

Share this post


Link to post

The very day after my first post PowerPDF was available via GetIt.
I removed the GitHub version and re-installed it through GetIt.

However, the same "Class Arial not found" message pops up when trying to drop a TPrPage component on a form.

Arial is a standard font and cannot be removed nor reinstalled. Moreover, it is not missing.

Hence it does not seem te be a Windows 11 issue, but rather something wrong in PowerPDF.

Can anyone help me with some hints? Please...

Share this post


Link to post

There is a bug in the component. Here is the call stack:

rtl.System.Classes.ClassNotFound(???)
rtl.System.Classes.FindClass(???)
:55c8a47c FindClass + $18
:2490ca39 TPdfDoc.GetFont + $A1
:2490e778 TPdfCanvas.SetFont + $38
:2490e404 GetCurrentFont + $120
:2490e653 TPdfCanvas.SetPage + $13F
:2490d393 TPdfDoc.AddPage + $23F
:2490d7cf TPdfDoc.SetVirtualMode + $17
:24917b19 TPRPage.Create + $99
:526fd80a delphicoreide290.@Comppalmgr@TComponentPalettePageItemDelegate@CreateComponent$qqrxp25System@Classes@TComponentt1x60System@%DelphiInterface$33Componentdesigner@IDesignerModule%rx18System@Types@TRect + 0x1a
designide.ComponentDesigner.TComponentRoot.DoCreateComponent(???,TWinControlItem($29E91FD0) as IItem,(0, 0, 0, 0, (0, 0), (0, 0)),True,True)
designide.ComponentDesigner.TComponentRoot.CreateComponent(TComponentPalettePageItemDelegate($2450B928) as IInternalPaletteItem)
:526f9b67 delphicoreide290.@Comppalmgr@TPalettePageItem@Execute$qqrv + 0x47
:54519dc5 coreide290.@Toolfrm@TToolForm@DoItemExecute$qqrxp29Vcl@Categorybuttons@TBaseItem + 0x3d
:54516548 coreide290.@Toolfrm@TToolForm@FilterEditKeyDown$qqrp14System@TObjectrus58System@%Set$30System@Classes@TShiftStateItemt1$i0$t1$i10$% + 0x50
vcl.Vcl.Controls.TWinControl.KeyDown(???,[])

 

 

I have no time at the moment to investigate. 

Share this post


Link to post
1 hour ago, JGMS said:

Arial is a standard font and cannot be removed nor reinstalled. Moreover, it is not missing.

Hence it does not seem to be a Windows 11 issue, but rather something wrong in PowerPDF.

Windows fonts are not represented as individual classes in the Delphi VCL. This error is occurring because PowerPDF is trying to create an Arial class implemented by PowerPDF. The actual class name is TPdfArial. It is registered in PdfFonts.pas.

 

On 2/21/2024 at 4:37 PM, JGMS said:

Anyway, it looks like the installation was a success: all controls are in place, and I can drop a TPrReport component on a form.

However, the next step, i.e. to drop a TPrPage, fails, showing the "Class Arial not found" message.

My guess is the design-time support in PowerPDF is lacking and that the unit PdfFonts is not added to the uses clause when you drop a TPrReport on it. (I do not have PowerPDF installed to test.)

 

If PdfFonts is not in your uses clause, add it and then try adding/dropping a TPrPage on the form.

Share this post


Link to post
5 minutes ago, JonRobertson said:

My guess is the design-time support in PowerPDF is lacking and that the unit PdfFonts is not added to the uses clause when you drop a TPrReport on it. (I do not have PowerPDF installed to test.)

 

If PdfFonts is not in your uses clause, add it and then try adding/dropping a TPrPage on the form.

Actually, that would only solve a run-time exception. If the exception is occurring in the designer, then the code that registers the components in the IDE is not registering the PDF font classes.

Share this post


Link to post

I added PDFfonts to the units clause, but the error remains.
I understand that there seems to a bug, which is what confirms my findings.
Thanks for answering.

 

Share this post


Link to post

Open PReport.pas and add PDFFonts to its uses clause. I'd suggest after PdfImages:

  PdfImages,
  PdfFonts
  {$IFDEF USE_JPFONTS}

Close PReport.pas. Open the DelphiPowerPDF group project and do Build All. If you don't have the group project, build PowerPDFDR followed by PowerPDFDD. (Building PowerPDFDD should not be required, but I always build run-time followed by design-time when rebuilding packages.)

 

Now go back to your project and see if you can add a TPrPage without getting the exception.

Share this post


Link to post


Meanwhile I compared the file PDFFonts.pas in Delphi12 and Delphi11 and found a single difference: "sysutils"was missing in the D12 version. I will check whether or not this is causing the problem using your building tips?

Share this post


Link to post

I am not sure what you are comparing. PDFFonts.pas on github does not have different versions of the source units by Delphi version. There is only one PDFFonts.pas.

 

SysUtils not being in the uses clause of PDFFonts.pas would not cause the issue that you are seeing. If SysUtils is needed by PDFFonts, a compile error would occur when building the component package or compiling any unit that references PDFFonts.


It is also possible that SysUtils was moved from the interface uses clause to implementation, or vice-versa.

Share this post


Link to post

I took PDFFonts from two different installations. But, bad luck indeed: the error remains after rebuilding and restarting D12.

I hope @lajos can help me out, once he finds time to do so.
Thanks again.

 

Share this post


Link to post
4 hours ago, JonRobertson said:

Open PReport.pas and add PDFFonts to its uses clause. I'd suggest after PdfImages:


  PdfImages,
  PdfFonts
  {$IFDEF USE_JPFONTS}

Close PReport.pas. Open the DelphiPowerPDF group project and do Build All. If you don't have the group project, build PowerPDFDR followed by PowerPDFDD. (Building PowerPDFDD should not be required, but I always build run-time followed by design-time when rebuilding packages.)

 

Now go back to your project and see if you can add a TPrPage without getting the exception.

 

2 hours ago, JGMS said:

But, bad luck indeed: the error remains after rebuilding and restarting D12.

I installed PowerPDF in Delphi 12 from GetIt Package Manager. Delphi 12 locked up on me due to LSP not responding. I killed that, Delphi 12 closed, and I went to try again.

 

When I opened Delphi 12 again, the PowerPDF components were installed (despite the earlier lockup). I dropped a PReport on a form, followed by a PRPage, and the IDE showed the same "Class Arial not found" message that you have.

 

I opened PowerPDFDR.dproj, opened PReport.pas from the Project Manager, and added PdfFonts to the uses clause (as suggested above). "Build" PowerPDFDR,dproj, "Build" PowerPDFDD.dproj, "Install" PowerPDFDD.

 

I am now able to drop a PRPage on a form without error.

Share this post


Link to post

You are a genious! Great!
It worked for me too.
Thank you very much indeed.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×