Skip to content
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

Merged
merged 5 commits into from
Feb 1, 2021

Conversation

alexisboyergauthier-msp
Copy link
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
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!

@@ -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');
Copy link
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
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
Member

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