Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rotate images #815

Closed
supervanya opened this issue Mar 11, 2021 · 5 comments · Fixed by #822
Closed

Rotate images #815

supervanya opened this issue Mar 11, 2021 · 5 comments · Fixed by #822

Comments

@supervanya
Copy link

I am embedding images into the document but I am noticing if the orientation of the jpeg image isn't correct. It is due to the EXIF metadata for orientation being something other than 1.

Would it be possible to specify rotation when creating the media object within drawingOptions:

const drawingOptions = {
  transformation: {
    rotate: {
      type: IMediaRotateType.Clockwise,
      value: 90,
    }
  }
}
Media.addImage(document, fileBuffer, actualWidth, actualHeight, drawingOptions)
@dolanmiu
Copy link
Owner

dolanmiu commented Mar 11, 2021

Gladly

Could you provide the associated specification/documentation for this

Thanks

@dolanmiu
Copy link
Owner

dolanmiu commented Mar 15, 2021

Will be included in: #822

I took most of your API advice, I like transformation, however, I thought maybe it will be too much for the user if they have to specify clockwise or anti clockwise rotation. It increases complexity without providing too much value. rotation is a simple number attribute in degrees.

Thanks

dolanmiu added a commit that referenced this issue Mar 15, 2021
@ivschukin
Copy link
Sponsor

small question: did you publish this change to npm? I'm not getting the updated code of #822.

@supervanya
Copy link
Author

supervanya commented Mar 17, 2021

@ivschukin I don't think there was a release yet but if you really need this functionality you could try pointing your package.json to a specific commit instead:

{
  "name": "foo",
  "version": "0.0.0",
  "dependencies": {
    "docx": "https://github.com/dolanmiu/docx.git#9557015c6cef7bcae6e7d61b8b20dd0ac44c5b8d", // add commit hash here
  }
}

If you decide to do this, you will also need to build the docx manually. I added a postinstall script to package.json:

{
  "name": "foo",
  "version": "0.0.0",
  "scripts": {
    "postinstall": "cd ./node_modules/docx && yarn install && yarn build || rm -rf node_modules/ && cd ../..",
  }
}

@dolanmiu
Copy link
Owner

i did not publish yet, its coming very soon though

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants