Sfoglia il codice sorgente

render canvas on-screen to avoid bad fonts in MSIE

Brian Gough 10 anni fa
parent
commit
4ca918a3b8

+ 6 - 1
services/web/public/coffee/ide/pdfng/directives/pdfRenderer.coffee

@@ -245,6 +245,12 @@ define [
 					return
 
 				canvas = $('<canvas class="pdf-canvas pdfng-rendering"></canvas>')
+				# In Windows+IE we must have the canvas in the DOM during
+				# rendering to see the fonts defined in the DOM. If we try to
+				# render 'offscreen' then all the text will be sans-serif.
+				# Previously we rendered offscreen and added in the canvas
+				# when rendering was complete.
+				element.canvas.replaceWith(canvas)
 
 				viewport = page.getViewport (scale)
 
@@ -298,7 +304,6 @@ define [
 
 				result.then () ->
 					# page render success
-					element.canvas.replaceWith(canvas)
 					canvas.removeClass('pdfng-rendering')
 					page.getTextContent().then (textContent) ->
 						textLayer.setTextContent textContent