Pdfviewer UI and webix.print

I have some pdfViewer and all working as expected. But with my webix version 10.0.6 I found out prints will not the hole pdf-file but only the view of my pdf. that means I’s quit smaller scaled then the pdf. I can download and print this it then but this is not my wish. How can I print the pdf which I have just loaded in the webix.pdfViewer UI?

Have a look at this Code Snippet
In here I see this a size reduced page I don’t know but I have to monitors with two different solutions…! Possible is this a reason?!

Thanks a lot
Michael

First I’ve thought I got a solution by using this printJS and

this piece of code:
let source = document.querySelector('canvas').toDataURL(); printJS({printable: source, type: 'image', imageStyle: 'width:100%;'});

But this is only for one page ! :frowning:

Also my pdf files are all not been accessible from outside! But I can use

$$(pdfName).download()

So why it’s not possible to have a methode like $$(pdfName).print()???

Please give me an answer :blush:

Michael

Hello Michael,

The viewer renders only the current sheet. the rest of the sheets are not processed internally, so other sheets webix.print doen’t see (as is done, for example, in a table with a pager or the same spreadsheet).

So you can customize the print() function:

  • go through all the pages
  • render pages
  • add to the DOM
  • print (similarly done inside the above widgets)

Please, check out the snippet with example: Code Snippet

Webix.print is a general helper and there is no need for such customization globally.

Hello NatashaS.

Thank you for your help. But as you can see:

  1. This print is not the size in preview. The content fully cover the A4 page. But on a print preview is in a quit smaller size.
  2. The pdf file isn’t accessible from outside for security reason.

There is not an easier way to print out a pdf file with more than one page??

Thanks a lot
Michael

You can customize print by using printJS:

 const blob = PDFJS.createBlob(data, "application/pdf");
      var reader = new FileReader();
        reader.onload = function () {
            printJS({
                printable: reader.result.substring(28),
                type: 'pdf',
                base64: true
            });
        };

Please, check out the snippet with example: Code Snippet

Thank you so much… :slight_smile:

Good day @Michael,

The bug was fixed, so there is no need to use workaround :slight_smile: