Supplying link for generating pdf

I have the following code:

<div>
<a href=*"mypdf.htm"* target=*"_blank"*>My PDF </a>
</div>
<div class=*"qzTray"*>
<button onclick="printQZTray()">Test QZTray Print</button>
</div>

And clicking on My PDF link opens a PDF in a new tab .

I’m trying to use qz tray and when I was checking their sample HTML file(I’ve put the file in a JSFiddle) after downloading it from their website, they have a printPDF function defined as follows:


function printPDF() {
        var config = getUpdatedConfig();
        var opts = getUpdatedOptions(true);

        var printData = [
            { type: 'pixel', format: 'pdf', flavor: 'file', data: 'assets/pdf_sample.pdf', options: opts }
        ];

        qz.print(config, printData).catch(displayError);
    }

So I was wondering if for this part data: 'assets/pdf_sample.pdf', I can somehow create a similar functionality like <a href=*"mypdf.htm"* target=*"_blank"*>My PDF </a>. I mean user already sees a pdf after cicking on the URL so I am not sure if something like this can happen?

  var printData = [
            { type: 'pixel', format: 'pdf', flavor: 'file', data: 'mypdf.htm', options: opts }
        ];

Is it the correct way to go about it?

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.