-
Notifications
You must be signed in to change notification settings - Fork 33
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
Add svg files as header option in pdf export #4443
base: main
Are you sure you want to change the base?
Conversation
@@ -313,7 +313,7 @@ export class MotionViewComponent extends BaseMeetingComponent implements OnInit, | |||
/** | |||
* Click handler for the pdf button | |||
*/ | |||
public downloadPdf(): void { | |||
public async downloadPdf(): Promise<void> { |
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.
This is unnecessary
public async downloadPdf(): Promise<void> { | |
public downloadPdf(): void { |
this.updateHeader([`pdf_header_l`, `pdf_header_r`]).then(() => { | ||
this.mediaManageService | ||
.getLogoUrlObservable(`pdf_header_l`) | ||
.pipe(distinctUntilChanged()) | ||
.subscribe(_ => this.updateHeader([`pdf_header_l`])); | ||
this.mediaManageService | ||
.getLogoUrlObservable(`pdf_header_r`) | ||
.pipe(distinctUntilChanged()) | ||
.subscribe(_ => this.updateHeader([`pdf_header_r`])); | ||
}); |
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.
I don't really like this. This results in unnecessary traffic for most users when using svgs.
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.
function
const downloads = await this.httpService.downloadAsBase64(url); | ||
const svg = downloads.type === `image/svg+xml`; | ||
if (svg) { | ||
const fetchResult = await fetch(url); | ||
const text = await fetchResult.text(); |
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 are downloading the image twice.
} else { | ||
return -1; | ||
} |
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.
} else { | |
return -1; | |
} | |
} | |
return -1; |
let viewBox: string = ``; | ||
const width: number = this.getSizeValue(text, `width="`); | ||
const height: number = this.getSizeValue(text, `height="`); | ||
if (width !== -1 && height !== -1) { | ||
viewBox = ` viewBox=" 0 0 ` + (width + 100) + ` ` + (height + 100) + `" `; | ||
} | ||
return viewBox; |
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.
let viewBox: string = ``; | |
const width: number = this.getSizeValue(text, `width="`); | |
const height: number = this.getSizeValue(text, `height="`); | |
if (width !== -1 && height !== -1) { | |
viewBox = ` viewBox=" 0 0 ` + (width + 100) + ` ` + (height + 100) + `" `; | |
} | |
return viewBox; | |
const width: number = this.getSizeValue(text, `width="`); | |
const height: number = this.getSizeValue(text, `height="`); | |
if (width !== -1 && height !== -1) { | |
return ` viewBox=" 0 0 ` + (width + 100) + ` ` + (height + 100) + `" `; | |
} | |
return ``; |
Closes #3586