Created on 3 July 2024, 6 months ago
Updated 5 July 2024, 6 months ago

Hello Dears Mainteneurs,

I have a request in order to show in printable version of webpage the hotspots of image hotspots module.
In the webpage i change somme css to always view hotspot(see web-page.png)

I have had to drupal-printable.css

.hotspot-box {
position: absolute;
background-color: #ff000061;
}
.image-hotspots-wrapper .hotspot-box {
position: absolute;
background-color: #ff000061;
}

and had this to printable.html.twig

.hotspot-box { /* Styles par dรฉfaut pour l'รฉcran */ display: block; } @media print { .hotspot-box { /* Ensure this element is visible when printing */ display: block !important; } }



{{ header }}

<!-- Content for the hotspot -->

Printable content for the hotspot

{{ content }}

But no results to get a printable version of it.(see print.png)

If anyone can explain me how to display hotspots.

Thanks .

Regards

๐Ÿ’ฌ Support request
Status

Closed: works as designed

Version

3.1

Component

Code

Created by

๐Ÿ‡ซ๐Ÿ‡ทFrance evolutec

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @evolutec
  • ๐Ÿ‡ฆ๐Ÿ‡บAustralia nigelcunningham Geelong

    Would you be able to provide sample data / setup steps where you're expecting hotspots, so that I can just get on with implementing it and testing it for you, please?

    Thanks!

  • ๐Ÿ‡ซ๐Ÿ‡ทFrance evolutec

    Install "image hotspots" module
    create a content type with media field(image)
    create a media type(/admin/structure/media/manage/image/display/"hotspotmedia" and select formatter for form dispaly and display to image with hotspots.
    On content type form assign entity browser for widget and select hotspotmedia for view mode.
    On content type display select field formatter from view display and select hotspotmedia for view mode.

    create a node and assign hotspot to image field.
    Save node.see results with hotspots print on webpage
    Try to print but hotspot doesn't appears on print preview or print.

    Thanks.

  • ๐Ÿ‡ฆ๐Ÿ‡บAustralia nigelcunningham Geelong

    Thanks!

  • ๐Ÿ‡ฆ๐Ÿ‡บAustralia nigelcunningham Geelong

    The issue is caused by the fact that the image hotspots module generates the hotspots using Javascript in the browser, rather than as part of the page generation. Doing things that way means (among other things) that there's no way for the Printable module to tell that it needs javascript to run, or to tell that it has run before generating a PDF. For some of the PDF generation techniques, there's also no way for us to run Javascript. The exception is the Puppeteer support, which uses headless Chrome. In that case we do have a way to wait for Javascript to run - I used it at a former employer to wait for pagedJS to do its work.

    So, I'm sorry to say this but you'll need to get the image hotspot author(s) to modify their module before you'll be able to use it with printable. Ideally, it would be modified so that the HTML and CSS generated include the hotspots, without any need for JS to run.

    I hope that's at least a little bit helpful!

  • ๐Ÿ‡ซ๐Ÿ‡ทFrance evolutec

    Thanks for your reply and time spent.

    Regards

  • Status changed to Closed: works as designed 6 months ago
  • ๐Ÿ‡ฆ๐Ÿ‡บAustralia nigelcunningham Geelong

    You're welcome.

    I'll close this issue for now. Hard to pick a 'resolution' but I'll go with "works as designed" since it's not a printable issue. If they do make changes or you want me to revisit the issue, please feel free to reopen it or open another one.

Production build 0.71.5 2024