0

I'm using Leaflet awesome marker icons and was almost all right, but when I try print, the icons doesn't show. Why?

I tried:

var redMarker = L.AwesomeMarkers.icon({
    icon: 'coffee',
    markerColor: 'red',
    extraClasses: 'PrintOnly'
  });

And my CSS:

@media print {
    .PrintOnly {
        display:block;
    }
}

But it still did not work :( I am sending the two images to see the error, I have already done everything for the icons to appear, but to no success.

Problem print and Icons showed

1

I founded a solution. I do not think that's the best way to solve this, but it's what I discovered right now and it worked.

In the file leaflet.awesome-markers.css, do this:

.awesome-marker {
   background: url ('../ images / markers-soft.png') no-repeat 0 0 !important;
   width: 35px;
   height: 46px;
   position: absolute;
   left: 0;
   top: 0;
   display: block;
   text-align: center;
}

.awesome-marker-shadow {
   background: url ('../ images / markers-shadow.png') no-repeat 0 0 !important;
   width: 36px;
   height: 16px;
}

.awesome-marker-icon-blue {
   background-position: -108px 0 !important;
}

Just add !important.

Do this for each color of the icon you want to show on the print. If someone has a better solution, I'd love to hear it. Thank you!!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.