Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
a-doc-editor
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ramdayal Munda
a-doc-editor
Commits
dd41c6a6
Commit
dd41c6a6
authored
Dec 18, 2023
by
ramdayalmunda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
on pdf woff2 is not working used ttf file for fonts on PDF
parent
ff45397b
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
6 deletions
+3
-6
a-doc-editor.js
dist/assets/a-doc-editor.js
+3
-6
No files found.
dist/assets/a-doc-editor.js
View file @
dd41c6a6
...
@@ -105,7 +105,6 @@ var ADocEditor = function (customConfig) {
...
@@ -105,7 +105,6 @@ var ADocEditor = function (customConfig) {
<span class="option">Edit</span>
<span class="option">Edit</span>
<span class="option">Insert</span>
<span class="option">Insert</span>
<span class="option">Help</span>
<span class="option">Help</span>
<span class="option" a-doc-editor-action="generate-pdf">PDF</span>
</div>
</div>
<div class="option-bar">
<div class="option-bar">
<span class="option">Search</span>
<span class="option">Search</span>
...
@@ -148,7 +147,6 @@ var ADocEditor = function (customConfig) {
...
@@ -148,7 +147,6 @@ var ADocEditor = function (customConfig) {
</div>
</div>
</div>
</div>
`
;
`
;
console
.
log
();
addFonts
([
"./assets/fonts/ArchitectsDaughter-Regular.woff2"
,
"./assets/fonts/ArchitectsDaughter-Regular.ttf"
],
'Architects Daughter'
)
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'
)
addFonts
([
"./assets/fonts/calibri-regular.woff2"
,
"./assets/fonts/calibri-regular.ttf"
],
'Calibri'
)
...
@@ -208,8 +206,6 @@ var ADocEditor = function (customConfig) {
...
@@ -208,8 +206,6 @@ var ADocEditor = function (customConfig) {
fontFamilyDropdown
=
document
.
getElementById
(
fontFamilyDropdownId
)
fontFamilyDropdown
=
document
.
getElementById
(
fontFamilyDropdownId
)
fontFamilyDropdown
.
addEventListener
(
'change'
,
changeFontFamily
)
fontFamilyDropdown
.
addEventListener
(
'change'
,
changeFontFamily
)
reRenderFontDropdown
()
reRenderFontDropdown
()
let
generatePDFBtn
=
document
.
querySelector
(
'[a-doc-editor-action]'
)
generatePDFBtn
.
addEventListener
(
'click'
,
generatePDF
)
}
}
...
@@ -712,8 +708,9 @@ var ADocEditor = function (customConfig) {
...
@@ -712,8 +708,9 @@ var ADocEditor = function (customConfig) {
function embedFont(name) {
function embedFont(name) {
return new Promise((res, rej) => {
return new Promise((res, rej) => {
let fontObj = fontList.find(item => item.name == name)
let fontObj = fontList.find(item => item.name == name)
console.log(fontObj)
let url = fontObj.paths.find( item => item.slice(-4)=='.ttf' )
fetch(fontObj.paths[0])
if(!url) fontObj.paths[0]
fetch(url)
.then(async (data) => {
.then(async (data) => {
let arrayBuffer = await data.arrayBuffer()
let arrayBuffer = await data.arrayBuffer()
embededFonts[name] = await pdfDoc.embedFont(arrayBuffer)
embededFonts[name] = await pdfDoc.embedFont(arrayBuffer)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment