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

addText with hyperlink and addImage on different slide brakes image #520

Closed
ronnyroeller opened this issue Mar 21, 2019 · 2 comments
Closed

Comments

@ronnyroeller
Copy link

ronnyroeller commented Mar 21, 2019

I create a PPT consisting of a slide with an image and another slide with a hyperlink and an image. In this case, the image on the second slide is broken.

I can reproduce the issue with the latest 2.5.0 release.

This issue is likely related to #465 (which covers hyperlink and image on the same slide). I verified that the test case for #465 works with my 2.5.0 release, i.e. this issue is a different problem.

Reproduce

This code reproduces the issue:

var PptxGenJS = require("pptxgenjs");

var IMAGE = 'image/gif;base64,R0lGODlhEAAQAMQAAORHHOVSKudfOulrSOp3WOyDZu6QdvCchPGolfO0o/XBs/fNwfjZ0frl3/zy7////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAkAABAALAAAAAAQABAAAAVVICSOZGlCQAosJ6mu7fiyZeKqNKToQGDsM8hBADgUXoGAiqhSvp5QAnQKGIgUhwFUYLCVDFCrKUE1lBavAViFIDlTImbKC5Gm2hB0SlBCBMQiB0UjIQA7';

var pptx = new PptxGenJS();

var slide1 = pptx.addNewSlide();
slide1.addImage({ data: IMAGE });

var slide2 = pptx.addNewSlide();
slide2.addText([
    {
        text: 'Link',
        options: {
            hyperlink: { url: 'https://www.github.com' }
        }
    }
]);
// This image will be broken
slide2.addImage({ data: IMAGE, y:1 });

pptx.save('reproduce-issue-465');

The code generates the following output:
image
image

@ronnyroeller ronnyroeller changed the title addText with hyperlink and addImage on different slide broken image addText with hyperlink and addImage on different slide brakes image Mar 21, 2019
@ReimaFrgos
Copy link
Contributor

@gitbrent this bug no longer appears present in the latest build. Here's the v3 updated code I used to test on the 3.2.1 JS Fiddle.

let pptx = new PptxGenJS();
let IMAGE = 'image/gif;base64,R0lGODlhEAAQAMQAAORHHOVSKudfOulrSOp3WOyDZu6QdvCchPGolfO0o/XBs/fNwfjZ0frl3/zy7////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAkAABAALAAAAAAQABAAAAVVICSOZGlCQAosJ6mu7fiyZeKqNKToQGDsM8hBADgUXoGAiqhSvp5QAnQKGIgUhwFUYLCVDFCrKUE1lBavAViFIDlTImbKC5Gm2hB0SlBCBMQiB0UjIQA7';

let slide1 = pptx.addSlide();
slide1.addImage({ data: IMAGE });

let slide2 = pptx.addSlide();
slide2.addText([
    {
        text: 'Link',
        options: {
            hyperlink: { url: 'https://www.github.com' }
        }
    }
]);
// This image will be broken
slide2.addImage({ data: IMAGE, y:1 });
pptx.writeFile('reproduce-issue-465');

@gitbrent
Copy link
Owner

Thanks @ReimaFrgos !

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

No branches or pull requests

3 participants