use of elemental2.dom.HTMLDocument in project kie-wb-common by kiegroup.
the class PrintHelper method print.
public void print(final HTMLElement element) {
final Window globalWindow = getGlobalWindow();
final Window printWindow = globalWindow.open("", "_blank");
final HTMLDocument printDocument = getWindowDocument(printWindow);
writeElementIntoDocument(element, printDocument);
changeMediaAttributesToAll(printDocument);
copyStylesFromWindow(printDocument, globalWindow);
setupPrintCommandOnPageLoad(printDocument, printWindow);
}
use of elemental2.dom.HTMLDocument in project kie-wb-common by kiegroup.
the class PrintHelper method changeMediaAttributesToAll.
void changeMediaAttributesToAll(final HTMLDocument printDocument) {
final NodeList<Element> links = printDocument.querySelectorAll("link");
final String attribute = "media";
for (int i = 0; i < links.length; i++) {
final Element link = asElement(links.item(i));
if (Objects.equals(link.getAttribute(attribute), "print")) {
link.setAttribute(attribute, "all");
}
}
}
Aggregations