sandanat / vue-pdf-app

VUEjs v2 PDF viewer based on Mozilla's PDFJS
MIT License
225 stars 103 forks source link

printResolution not defined in the code, walkaround provided #110

Open jasonfish568 opened 1 year ago

jasonfish568 commented 1 year ago

As this repo is basically abandoned by the owner, I'm just providing a walkaround for this issue. It took me half a day to locate the variable, hope it helps.

If you use the print function to print documents in small page size, you may find the blury effect. To solve this, you will need to define the printResolution. This variable is included once in the code, but was never initialized.

Fortunately, this variable is stored in the AppOptions variable, so just do the following:

<vue-pdf-app :pdf="filePdfUrl" :fileName="filePdfName" @open="openHandler"></vue-pdf-app>
async openHandler(pdfApp) { 
    pdfApp.preferences.prefs.printResolution = 300; // Set resolution
    pdfApp._readPreferences(); // Update cached preferences
}