Skip to content

fix(print) centrer titre, ajuster marges, ajout sous-titre - #805

Merged
mbarbeau merged 5 commits into
nextfrom
printalexis
Feb 1, 2021
Merged

mbarbeau merged 5 commits into
nextfrom
printalexis

Conversation

@alexisboyergauthier-msp

Copy link
Copy Markdown
Contributor
  • 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

Copy link
Copy Markdown
Member

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!


let timeout;

// const scaleline = document.getElementsByClassName('ol-scale-line');

Copy link
Copy Markdown
Member

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);

Copy link
Copy Markdown
Member

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) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

???

positionHCanvas = 30;
newContext.textAlign = 'center';
newContext.fillText(title, width / 2, 20);
newContext.fillText(width, width / 2, 20, width * 0.9);

Copy link
Copy Markdown
Member

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);

Copy link
Copy Markdown
Member

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 ?

@mbarbeau
mbarbeau merged commit 8efa97f into next Feb 1, 2021
@mbarbeau
mbarbeau deleted the printalexis branch February 1, 2021 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants