-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(print) centrer titre, ajuster marges, ajout sous-titre #805
Conversation
alexisboyergauthier-msp
commented
Jan 27, 2021
- marges changés pour le formulaire imprimé en fonction des normes du MERN
- titre centré horizontalement en fonction des marges
- Taille du titre ajustable en fonction du format de la page et de sa longueur
- Taille du titre réduit en général
- Titre mis en gras
- Ajout d'une boite de sous-titre, sa taille est définie a 70% de la taille du titre
const margins = [20, 10, 20, 10]; | ||
const width = dimensions[0] - margins[3] - margins[1]; | ||
const height = dimensions[1] - margins[0] - margins[2]; | ||
const margins = [10, 10, 10, 10]; // modifier pour correspondre à normes MERN / dépends taille papier /top-bottom-left-right |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should remove this comment!
@@ -393,7 +443,8 @@ export class PrintService { | |||
const heightPixels = Math.round((size[1] * resolution) / 25.4); | |||
|
|||
let timeout; | |||
|
|||
// const scaleline = document.getElementsByClassName('ol-scale-line'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these comments should also be removed.
const titleSize = Math.round(2 * (pageHeight + 145) * 0.05) / 2; | ||
doc.setFont('Times'); | ||
doc.setFontType('Bold'); | ||
doc.setFontSize(titleFontSize); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you use titleFontSize before its declaration
// If scale need to be added to canvas | ||
if (scale !== false) { | ||
if (true) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
???
newContext.font = '26px Calibri'; | ||
positionHCanvas = 30; | ||
newContext.textAlign = 'center'; | ||
newContext.fillText(title, width / 2, 20); | ||
newContext.fillText(width, width / 2, 20, width * 0.9); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why width as the first parameter ?
The syntax of the function is:
void ctx.fillText(texte, x, y [, largeurMax]);
newContext.font = '26px Calibri'; | ||
positionHCanvas = 30; | ||
newContext.textAlign = 'center'; | ||
newContext.fillText(width, width / 2, 20, width * 0.9); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why width as the first parameter ?