1 possible answer(s) on “Retina display support

  1. Here is a patch (JS version) to use SVG rendering:

        PdfViewerComponent.prototype.renderPage = function (pageNumber) {
            var _this = this;
            return this._pdf.getPage(pageNumber).then(function (page) {
                var viewport = page.getViewport(_this._zoom, _this._rotation);
                var container = _this.element.nativeElement.querySelector('div');
                var canvas = document.createElement('canvas');
                var div = document.createElement('div');
                if (!_this._originalSize) {
    
                    viewport = page.getViewport(_this.element.nativeElement.offsetWidth / viewport.width, _this._rotation);
                }
                if (!_this._showAll) {
                    _this.removeAllChildNodes(container);
                }
                div.appendChild(canvas);
    //            container.appendChild(div);
    
    // Set dimensions
    container.style.width = viewport.width + 'px';
    container.style.height = viewport.height + 'px';
    
    // SVG rendering by PDF.js
    page.getOperatorList()
        .then(function (opList) {
            var svgGfx = new window.PDFJS.SVGGraphics(page.commonObjs, page.objs);
    
            return svgGfx.getSVG(opList, viewport);
        })
        .then(function (svg) {
            container.appendChild(svg);
        });
    return;
    

    This is the best solution. Rendering quality is optimal on all platforms and performance seems to be better too.

    Reference: https://www.sitepoint.com/custom-pdf-rendering/