Using TMSFNC PDF library in VSC

I'm trying to figure out how to use TMS FNC libraries in VSC. I added the TMS FNC Core path to the OmniPascal search path:

c:\Users\Groffy.vscode\extensions\tmssoftware.tmswebcore-1.1.3816\resources\coresource*;C:\Development\Lazarus\components\TMS_FNC_Core

and add

WEBLib.TMSFNCPDFIO,
WEBLib.TMSFNCGraphicsPDFEngine,

units into the uses clause.

When trying to compile, the compiler is showing several errors.

Are the TMS FNC libraries not ready yet for using them in VSC?

What errors?
You should be able to use these classes & components at runtime.

I installed the TMS FNC Core package from the latest TMS FNC UI Pack 3.2.2.0

Can it be this is the trial version of TMS WEB Core for Visual Studio Code?
With the trial version, FNC cannot be used.

Not that I know. I upgraded to the latest version of TMS WebCore, and used the new dialog for activating my licence. I removed TMS WebCore from VSC, deleted all in

.vscode\extensions\tmssoftware.tmswebcore-1.1.3816

and reinstalled TMS WebCore and activated the licence

After that, several properties stored in the form.dfm file were causing error messages when compiling my project:

clBtnFace
clNone
clWindow
clWhite
fsBold
ANSI_CHARSET
DEFAULT_CHARSET

finally I gave up, and created a new project

The errors when adding the TMSFNC PDF units are still there

  1. What exact error message for clBtnFace, clNone, ...
  2. The TMS FNC PDF issue looks warnings, not errors

Concerning the form *.dfm issues I can't provide an example any more I edited the form file too much.

Just by adding the units

WEBLib.TMSFNCPDFGraphicsLib.General,
WEBLib.TMSFNCPDFIO,

I get at least two errors

Whether I can ignore the warnings, I don't know yet

I cannot see these problems.
Are these the latest versions of TMS FNC sources?

In case the TMS FNC UI Pack 3.2.2.0 download contains the latest version of TMS FNC Core, then yes.

There are other TMSFNC units I can add without any problems, but I didn't check that for all.

I'm sorry but I am out of ideas.
This demo, using FNC PDF is working without issues here

There seems to be an issue in unit

WEBLib.TMSFNCPDFGraphicsLib.General

in function

function TTMSFNCGeneralPDFGraphicsLib.DrawText()

There is something wrong with

Delete(s, 1, p);

complaining about UniCode string

"message": "Incompatible type arg no. 1: Got \"UnicodeString\", expected \"String\". Var param must match exactly.",
	"startLineNumber": 1001,
	"startColumn": 16,
	"endLineNumber": 1001,
	"endColumn": 16

For testing I comment that line out and finally in my application I added the unit

WebLib.TMSFNCGraphicsTypes

That made the electron app finally starting

I cannot see a problem.
If a problem persists, please isolate this, provide a sample source app + step by step instructions to reproduce.

I will try.

Looking into the code of

WEBLib.TMSFNCPDFGraphicsLib.General

I saw that in other situations where the

delete()

function is used, there are compiler switches for using either string or WideString

{$IFDEF WEBLIB}
s: string;
{$ELSE}
s: UnicodeString;
{$ENDIF}

I don't know why this switches are not used in this one function

You must have an incorrect setup.
WEBLib.TMSFNCPDFGraphics.General.pas uses {$I WEBLib.TMSFNCDefines.inc}
and this file {$I WEBLib.TMSFNCDefines.inc} should have the define WEBLIB

Everything is true what you wrote, but in this implementation of Drawtext, the string variable s which is used later in the delete() funtion is defined as UnicodeString :

function TTMSFNCGeneralPDFGraphicsLib.DrawText(Text: UnicodeString; Rect: TRectF; Calculate: Boolean = False): TRectF;
var
i: Integer;
s, sn, st: UnicodeString;

The variable s in that case is NOT wrapped inside a conditional compiler switch.

There must be a mismatch between FNC version and WEB Core version.
You have the latest versions of both installed?
As a workaround, for web use, can you change unicodestring to string (as for web this should not matter)

Hi,

There must be a mismatch with TMS WEB Core & FNC & Visual Studio Code. We'll look into this as soon as possible. For now, please manually fix the UnicodeString declaration inside the WEBLib.TMSFNCPDFLib.General.pas unit. TMS WEB Core & FNC are currently going through a maintenance and thus this will take a significant amount of time.

Additionally, please note that FNC is not yet officially supported inside Visual Studio Code. While you might be able to compile projects at runtime, there is no designtime support, and there could be compiler issues rising. Official support for Visual Studio Code will be announced via blog post, social media, documentation and release notes when it's ready.

Hello Peter,

thank you for support. Actually I'm still having a lot to learn, coming back to delphi after more than 10 years of C# and very few ideas what web programming is about. I'm exited about the Electron framework and while learning, I'm using delphi 10.3 community edition, because Lazarus is currently not supporting WEBCore Electron projects. I'm not really happy with the delphi IDE. After a TMS WEBCore project becomes more complex, the code completion somehow stopps working, and besides learning the possibilities from TMS WEBCore this makes it really hard. I really do like VSC and was excited that with the latest version it supports the Electron framework as well. It's ok to wait for WEBCore for VSC 1.2 which will officially support also the TMS FNC components