Skip to content

Commit

Permalink
using a mocked version of docxqrcode to replace images when the image…
Browse files Browse the repository at this point in the history
… is not a png (seems to solve #24)
  • Loading branch information
edi9999 committed Apr 27, 2014
1 parent a185c15 commit fdaa90e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
6 changes: 3 additions & 3 deletions coffee/imgReplacer.coffee
Expand Up @@ -27,7 +27,7 @@ ImgReplacer = class ImgReplacer
if tagrId==undefined then throw 'tagRiD undefined !'
rId = tagrId.getAttribute('r:embed')
oldFile= @xmlTemplater.DocxGen.imgManager.getImageByRid(rId)
if oldFile==null then throw 'oldFile is not defined'
if oldFile==null then throw 'oldFile undefined'
if env=='browser' then tag= xmlImg.getElementsByTagNameNS('*','docPr')[0]
if env=='node' then tag= xmlImg.getElementsByTagName("wp:docPr")[0]
if tag==undefined then throw 'tag undefined'
Expand Down Expand Up @@ -61,7 +61,7 @@ ImgReplacer = class ImgReplacer
@qr[u].decode(@imageSetter)
dat= png.decode(finished)
else
#remove the image from the list of images to be tested
@xmlTemplater.DocxGen.qrCodeCallBack(@xmlTemplater.DocxGen.qrCodeNumCallBack,false)
mockedQrCode={xmlTemplater:@xmlTemplater,imgName:imgName,data:oldFile.asBinary()}
@imageSetter(mockedQrCode)

root.ImgReplacer=ImgReplacer
11 changes: 8 additions & 3 deletions js/docxgen.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit fdaa90e

Please sign in to comment.