You are here:
Create an External File
Create a zip of the base-64 encoded string format of the custom font and its license. Append the base-64 encoded string format of the zip file in an external file in VS Code based Modeler.
Required Editions
- Download the desired font-style data file (for example, .ttf) and its corresponding license file to a local drive.
- Convert the font style data to a base-64 encoded string format. For example, to convert
NotoSerifKorean-Regular.ttf to a base-64 encoded string, run this command in your VS Code based
Modeler:
sf modeler workspace utils base64encode --input ./NotoSerifKorean-Regular.ttf > ./NotoSerifKorean-Regular.txt
| Available in Lightning Experience in Professional, Enterprise, and Unlimited Editions that have Consumer Goods Cloud enabled. |
| User Permissions Needed | |
|---|---|
| To create an external file: | CGCloud Business Admin |
- To create a Printfont.js file, in a text editor, copy the code snippet for the preferred font type configuration from the Sample Code for PrintFont.js section and save it as a JavaScript file.
-
In the Printfont.js file, add the base-64 encoded string of the font
type data. In this example, PrintFont.js uses a single font type
configuration.
"use strict"; //define required font types const regularFont = "#base64-encoded regular PrintFont data#" //build object using font types and return return{ "Regular": regularFont, "Italic": regularFont, "Bold": regularFont, "BoldItalic": regularFont } ; - Save your changes.
- Create a zip archive of the Printfont.js and License.txt files.
-
Convert the zip file to a base-64 encoded string format in a text file by using this
command in your VS Code based Modeler:
sf modeler workspace utils base64encode --input ./MyPrintFont_Korean.zip > ./MyPrintFont_Korean.txt - Create an external file contract for the custom font by using the template $workspace/contractSnippets/ExternalFiles/#Name#.externalfile.xml in your VS Code based Modeler. For example, MyPrintFont_Korean.externalfile.xml.
-
Add the base-64 encoded string from MyPrintFont_Korean.txt to the
CDATA block in the content element of the ExternalFile contract.
Here’s the code snippet template. followed by a sample ExternalFile configuration.
<ExternalFile name="#Name#" npmName="#NpmName#" displayName="#Your Description#" version="#Version#" availableForUI="true"> <Content> <!-- CDATA Block with base-64 string of the lib --> <![CDATA[#Base64String#]]> </Content> </ExternalFile><ExternalFile name="MyPrintFont_Korean" npmName="MyPrintFont_Korean" displayName="MyPrintFont - Korean" version="1.0.0" availableForUI="true"> <Content> <![CDATA[SampleStringARqSPRr7™/9zsDvZ5n₴28tS$CAnPqdREPtTj5aLYBTyA/gL42CUGL7A0KfGoy4f{yDP16xqH3[mXWCTLwExgLgyakSeR=9udCqc1VUBQADVx212nV4CMABBBAAAEFAAAAFBLAQIAxQAAAAIAIt6xFj34hn3vQCAAIERAAALABgAACAKMAAADI/UBAAAA]]> </Content> </ExternalFile> - Save your changes.
- Copy the custom font external file contract to $workspace/src/ExternalFiles in your VS Code based Modeler.
-
Build the contracts by using this command:
sf modeler workspace build.
Did this article solve your issue?
Let us know so we can improve!

