heavysixer / node-pptx

Generate PPTX files on the server-side with JavaScript.
MIT License
161 stars 44 forks source link

DPI Override in ElementProperties > PptxUnitHelper #75

Open bekworks opened 3 years ago

bekworks commented 3 years ago

Simple override of default 72 DPI used in PptxUnitHelper.

Solves Adding images into our PowerPoint template results in dimension overrides, in the form of scaling. Our template is set at 96 DPI, resulting in a scaling of 133% of all inserted images, using the default DPI of 72. This allows us to specifically set the targeted DPI when adding images, thus eliminating the scaling altogether.

Notes This may be required for some other elements as well, shapes and textboxes, but I've left those alone, as we're not using them. This was the easiest way to achieve our needs of not having to switch to a different library.

In a perfect world, the DPI settings should be read from the document, and automatically be used in calculations. But I do not have the required experience with PowerPoint, to actually achieve this.

heavysixer commented 3 years ago

@gregdolley this looks good to me, but see that this example is limited. what do you think it would take to make this more global?

heavysixer commented 3 years ago

@bekworks Can you please add some unit tests for this to ensure we have good coverage and that future commits don't inadvertently break your code?

heavysixer commented 3 years ago

@bekworks additionally what is the workflow you added? I see that your branch requires approval to run a workflow but am curious what that is and why its needed.