Print preview is showing 2 pages instead of 1.



  • We have shown the report by using jsreport library. Now we want to print that report.
    I've used window.print() to print the file, but in the print preview, it's showing me the number of pages - 2. Actually, there is only one page to print.
    Can you help me



  • Please elaborate more in detail on what you do and what you want to reach.
    Do you render an HTML through jsreport? How do you display it? Where you put window.print()?
    Thank you



  • I've integrated the jsreport libary in Angular from it we are showing the report.
    The report is displaying fine. But when I want to print the report then the report preview is showing the 2 pages actually there is a single page.
    I used window.print() method in .ts file of Angular.

    the .ts function

    printReport() {
    window.print();
    }

    HTML

    <div mat-dialog-content>
    <pdf-viewer [src]="data"
    [page]="1"></pdf-viewer>
    </div>

    Here I am using mat-dialog to view the report.



  • I see you are likely calling the window.print in the pain page, but you want to print the element where is the report displayed. I don't know angular or mat-dialog, you may get better help on other forums because this isn't related to jsreport. You get a buffer or stream from jsreport with pdf representation. You are able to display it. You display it for example in a specific iframe. Then you want to call the print on the particular iframe. In other cases, there can be other approaches to print but relates to the specific aspects of how you display it.


Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.