Skip to content

Commit

Permalink
fix(print-tool): fix small screen layers print (#780)
Browse files Browse the repository at this point in the history
* fix(print-tool): fix small screen layers print

* delete console
  • Loading branch information
PhilippeLafreniere18 authored Nov 19, 2020
1 parent 7c046e0 commit 9e404fe
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions packages/geo/src/lib/print/shared/print.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -346,13 +346,13 @@ export class PrintService {
) {
let image;

image = canvas.toDataURL('image/jpeg');
image = canvas.toDataURL('image/png');

if (image !== undefined) {
const imageSize = this.getImageSizeToFitPdf(doc, canvas, margins);
doc.addImage(
image,
'JPEG',
'PNG',
margins[3],
margins[0],
imageSize[0],
Expand Down Expand Up @@ -381,9 +381,9 @@ export class PrintService {
let timeout;

map.ol.once('rendercomplete', (event: any) => {
const canvas = event.target
const canvases = event.target
.getViewport()
.getElementsByTagName('canvas')[0];
.getElementsByTagName('canvas');
const mapStatus$$ = map.status$.subscribe((mapStatus: SubjectStatus) => {
clearTimeout(timeout);

Expand All @@ -395,7 +395,11 @@ export class PrintService {

let status = SubjectStatus.Done;
try {
this.addCanvas(doc, canvas, margins);
for (const canvas of canvases) {
if (canvas.width !== 0) {
this.addCanvas(doc, canvas, margins);
}
}
} catch (err) {
status = SubjectStatus.Error;
this.messageService.error(
Expand All @@ -420,7 +424,11 @@ export class PrintService {

let status = SubjectStatus.Done;
try {
this.addCanvas(doc, canvas, margins);
for (const canvas of canvases) {
if (canvas.width !== 0) {
this.addCanvas(doc, canvas, margins);
}
}
} catch (err) {
status = SubjectStatus.Error;
this.messageService.error(
Expand Down

0 comments on commit 9e404fe

Please sign in to comment.