Skip to content

Commit 7af7278

Browse files
author
Vinothkumar Rajendran
committed
APX-14289 : Observed issue with Print option. Print document shows incomplete data.
1 parent bce4def commit 7af7278

File tree

3 files changed

+20
-27
lines changed

3 files changed

+20
-27
lines changed

src/app/app.component.ts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,9 +296,28 @@ export class AppComponent implements OnInit, OnDestroy {
296296
formattedArray.push(temp);
297297
lineNo++
298298
} while (lineNo < maxLine);
299-
this.formatCopyPage(formattedArray,printFlag);
299+
if(!printFlag){
300+
this.formatCopyPage(formattedArray,printFlag);
301+
}else{
302+
this.formatPrintPage(formattedArray);
303+
}
300304
}
301305

306+
formatPrintPage(formattedArray){
307+
let printDetails = formattedArray;
308+
let height = window.screen.availHeight-400;
309+
let width = window.screen.availWidth-750;
310+
const popupWindow = window.open('','',`height=${height},width=${width},top=${height/2},left=${width/2}`);
311+
popupWindow.document.open();
312+
popupWindow.document.write('<div class="copyWrapper crosshair" style="white-space: pre !important;"><pre>');
313+
printDetails.forEach(element => {
314+
popupWindow.document.write("<div>"+element +"</div>");
315+
})
316+
popupWindow.document.write('</pre></div>')
317+
popupWindow.print();
318+
popupWindow.close();
319+
}
320+
302321
formatCopyPage(formattedArray,printFlag){
303322
let divElement = document.createElement("div");
304323
let lineIdentifier = 0;

src/app/mini-components/transformations/modalpopup/modalpopup.component.html

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,4 @@
11
<div id="copyParentDiv" tabindex="10" >
2-
<div class="container-fluid" *ngIf="printFlag">
3-
<div class="row">
4-
<div class="col-11 col-sm-11">
5-
<h5 class="modal-title" id="exampleModalLabel">Print Preview</h5>
6-
</div>
7-
<div class="col-1 col-sm-1">
8-
<sag-topnav-right right>
9-
<sag-topnav-item id="pop-up-print-icon" itemType="button" [disable]='false' title="Print"
10-
(click)="print()" itemId="print" itemName="" itemIcon="dlt-icon-print"
11-
itemStyle="color:white">
12-
</sag-topnav-item>
13-
</sag-topnav-right>
14-
</div>
15-
</div>
16-
</div>
172
<div id="copyDiv" class="copyWrapper crosshair" (mousedown)="handleMouseDown($event)" (mouseup)="handleMouseUp($event)" ></div>
183
<div class="modal-footer unselectable" unselectable="on">
194
<div class="container">

src/app/mini-components/transformations/modalpopup/modalpopup.component.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,8 @@ export class ModalpopupComponent implements OnInit {
4848
element.classList.add("copyTextCss");
4949
})
5050
}
51-
// handleKeyDown(event){
52-
// if (event.ctrlKey && event.keyCode == 67){
53-
// console.log("handleKeyDown....", event);
54-
// this.clipboard.copy(this.copiedText.toString().replaceAll(",","\n"));
55-
// }
56-
// }
5751

58-
print() {
59-
window.print();
60-
}
6152

62-
close() {
63-
}
6453

6554
handleMouseDown(event){
6655
this.initCall();

0 commit comments

Comments
 (0)