Commit dd41c6a6 by ramdayalmunda

on pdf woff2 is not working used ttf file for fonts on PDF

parent ff45397b
......@@ -105,7 +105,6 @@ var ADocEditor = function (customConfig) {
<span class="option">Edit</span>
<span class="option">Insert</span>
<span class="option">Help</span>
<span class="option" a-doc-editor-action="generate-pdf">PDF</span>
</div>
<div class="option-bar">
<span class="option">Search</span>
......@@ -148,7 +147,6 @@ var ADocEditor = function (customConfig) {
</div>
</div>
`;
console.log();
addFonts(["./assets/fonts/ArchitectsDaughter-Regular.woff2", "./assets/fonts/ArchitectsDaughter-Regular.ttf"], 'Architects Daughter')
addFonts(["./assets/fonts/calibri-regular.woff2", "./assets/fonts/calibri-regular.ttf"], 'Calibri')
......@@ -208,8 +206,6 @@ var ADocEditor = function (customConfig) {
fontFamilyDropdown = document.getElementById(fontFamilyDropdownId)
fontFamilyDropdown.addEventListener('change', changeFontFamily)
reRenderFontDropdown()
let generatePDFBtn = document.querySelector('[a-doc-editor-action]')
generatePDFBtn.addEventListener('click', generatePDF)
}
......@@ -712,8 +708,9 @@ var ADocEditor = function (customConfig) {
function embedFont(name) {
return new Promise((res, rej) => {
let fontObj = fontList.find(item => item.name == name)
console.log(fontObj)
fetch(fontObj.paths[0])
let url = fontObj.paths.find( item => item.slice(-4)=='.ttf' )
if(!url) fontObj.paths[0]
fetch(url)
.then(async (data) => {
let arrayBuffer = await data.arrayBuffer()
embededFonts[name] = await pdfDoc.embedFont(arrayBuffer)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment