You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are using the Salesforce LWC components, where using the custom fonts with the download functionality, but we are getting the "pdflib:17785 Uncaught (in promise) TypeError: fontkit.create is not a function" once downloading the custom fonts with the Fontkit library.
Could you please share the correct Fontkit library, so we can use it here.
How did you attempt to do it?
We are using the Salesforce LWC components, where using the custom fonts with the download functionality, but we are getting the "pdflib:17785 Uncaught (in promise) TypeError: fontkit.create is not a function" once downloading the custom fonts with the Fontkit library.
Could you please share the correct Fontkit library, so we can use here.
What actually happened?
We are using below 2 lines to import the static pdfLib and Fontkit library in our salesforce database.
import pdflib from "@salesforce/resourceUrl/pdflib";
import fontkit from "@salesforce/resourceUrl/fontkit";
While we ar using the below code, we are getting the error after pdfDoc.embedFont() function.
const pdfDoc = await PDFLib.PDFDocument.create();
pdfDoc.registerFontkit(fontkit);
const timesRomanFont = await pdfDoc.embedFont(
fontBytes
);
What did you expect to happen?
It should download the PDF file with the custom fonts
What were you trying to do?
We are using the Salesforce LWC components, where using the custom fonts with the download functionality, but we are getting the "pdflib:17785 Uncaught (in promise) TypeError: fontkit.create is not a function" once downloading the custom fonts with the Fontkit library.
Could you please share the correct Fontkit library, so we can use it here.
How did you attempt to do it?
We are using the Salesforce LWC components, where using the custom fonts with the download functionality, but we are getting the "pdflib:17785 Uncaught (in promise) TypeError: fontkit.create is not a function" once downloading the custom fonts with the Fontkit library.
Could you please share the correct Fontkit library, so we can use here.
What actually happened?
We are using below 2 lines to import the static pdfLib and Fontkit library in our salesforce database.
import pdflib from "@salesforce/resourceUrl/pdflib";
import fontkit from "@salesforce/resourceUrl/fontkit";
While we ar using the below code, we are getting the error after pdfDoc.embedFont() function.
const pdfDoc = await PDFLib.PDFDocument.create();
pdfDoc.registerFontkit(fontkit);
const timesRomanFont = await pdfDoc.embedFont(
fontBytes
);
What did you expect to happen?
It should download the PDF file with the custom fonts
How can we reproduce the issue?
async createPdf() {
//const fontkit = pdflib;
loadScript(this, fontkit).then(() => {
console.log('fontkit loded');
});
console.log('fontkit : '+fontkit);
///LightningMemberPortal/resource/OLDENGL/OldEnglishFive-axyVg.ttf
//const url = specFontsOLDENGL+'/OldEnglishFive-axyVg.ttf';
Version
We are using the latest version of pdf-lib
What environment are you running pdf-lib in?
Other
Checklist
Additional Notes
No response
The text was updated successfully, but these errors were encountered: