Skip to content

Commit

Permalink
Merge branch 'main' of github.com:alpaylan/afetbilgi.com
Browse files Browse the repository at this point in the history
  • Loading branch information
RKursatV committed Feb 10, 2023
2 parents 676aa16 + 3e0b1e6 commit 8cb57a8
Showing 1 changed file with 36 additions and 31 deletions.
67 changes: 36 additions & 31 deletions pdfConverterAPI/leafGenerator/docFunctions.js
Original file line number Diff line number Diff line change
@@ -1,43 +1,48 @@
const boldFont = require("./fonts/Roboto-Black-normal");
const regularFont = require("./fonts/Roboto-Regular-normal")
const { titleFontSize, textFontSize, xStart, yStart, yRange} = require("./constants");
const moment = require('moment');
const regularFont = require("./fonts/Roboto-Regular-normal");
const {
titleFontSize,
textFontSize,
xStart,
yStart,
yRange,
} = require("./constants");
const moment = require("moment");
const { default: slugify } = require("slugify");
require('moment/locale/fr.js');
require("moment/locale/fr.js");

const getDateAndTime = () => {
moment.locale('tr')
return moment().format('L') + ' - ' + moment().format('LT')
}
const date = new Date().toLocaleString("tr-TR", {
timeZone: "Europe/Moscow",
});
return date.toString();
};

const registerFont = (doc) => {
doc.addFileToVFS("./fonts/Roboto-Black.ttf", boldFont.font);
doc.addFileToVFS("./fonts/Roboto-Regular.ttf", regularFont.font);
doc.addFont("./fonts/Roboto-Black.ttf", "Roboto-Black", "normal");
doc.addFont("./fonts/Roboto-Regular.ttf", "Roboto-Regular", "normal");
doc.setFont('Roboto-Regular', 'normal');

}
doc.addFileToVFS("./fonts/Roboto-Black.ttf", boldFont.font);
doc.addFileToVFS("./fonts/Roboto-Regular.ttf", regularFont.font);
doc.addFont("./fonts/Roboto-Black.ttf", "Roboto-Black", "normal");
doc.addFont("./fonts/Roboto-Regular.ttf", "Roboto-Regular", "normal");
doc.setFont("Roboto-Regular", "normal");
};

const setFont = (doc, type) => {
if (type == "regular") {
doc.setFont('Roboto-Regular', 'normal');
} else {
doc.setFont('Roboto-Black', 'normal');
}
}
if (type == "regular") {
doc.setFont("Roboto-Regular", "normal");
} else {
doc.setFont("Roboto-Black", "normal");
}
};

const slug = (text) => {
return slugify(text, {
trim: true // trim leading and trailing replacement chars, defaults to `true`
})
}

return slugify(text, {
trim: true, // trim leading and trailing replacement chars, defaults to `true`
});
};

module.exports = {
setFont,
registerFont,
getDateAndTime,
slug,

}
setFont,
registerFont,
getDateAndTime,
slug,
};

1 comment on commit 8cb57a8

@vercel
Copy link

@vercel vercel bot commented on 8cb57a8 Feb 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.