Skip to content
This repository has been archived by the owner on Mar 7, 2023. It is now read-only.

Commit

Permalink
fix(schedule-template): html render exp 2
Browse files Browse the repository at this point in the history
  • Loading branch information
rhahao authored May 17, 2022
1 parent e942d55 commit 5a3fdd2
Showing 1 changed file with 1 addition and 18 deletions.
19 changes: 1 addition & 18 deletions src/template/ScheduleTemplate.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
import { useEffect, useState } from 'react';
import { useNavigate } from 'react-router-dom';
import { useRecoilValue } from 'recoil';
import { useTranslation } from 'react-i18next';
import html2pdf from 'html2pdf.js';
import Box from '@mui/material/Box';
import Button from '@mui/material/Button';
import SaveAltIcon from '@mui/icons-material/SaveAlt';
import Typography from '@mui/material/Typography';
import { dbGetScheduleForPrint } from '../indexedDb/dbAssignment';
import {
classCountState,
Expand All @@ -18,7 +12,6 @@ import { monthNamesState } from '../appStates/appSettings';

const ScheduleTemplate = () => {
let navigate = useNavigate();
const { t } = useTranslation();

const [data, setData] = useState([]);
const [month, setMonth] = useState('');
Expand All @@ -29,17 +22,7 @@ const ScheduleTemplate = () => {
const congNumber = useRecoilValue(congNumberState);
const monthNames = useRecoilValue(monthNamesState);

const savePDF = () => {
const element = document.getElementById('schedule_template');
var opt = {
margin: [0.2, 0.5, 0.2, 0.5],
filename: `${currentSchedule.replace('/', '-')}.pdf`,
image: { type: 'jpeg', quality: 0.98 },
html2canvas: { scale: 2 },
jsPDF: { unit: 'in', format: 'a4', orientation: 'portrait' },
};
html2pdf().set(opt).from(element).save();
};
console.log(data, month, classCount, congName, congNumber)

useEffect(() => {
const getData = async () => {
Expand Down

0 comments on commit 5a3fdd2

Please sign in to comment.