LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW 26Q1 Browser Control - HTML Print to PDF

Solved!
Go to solution

Is it possible to print HTML to PDF from the new browser control like you could with the Webview2 control (sklein)? Interestingly if you feed the new control a pdf it shows a tool banner with print a button, but I don't see a way to turn the tool bar on/off programmatically.

 

System: Win11 VM, Microsoft Edge. (Adobe Acrobat, MS Office not installed) 

0 Kudos
Message 1 of 6
(334 Views)

There is very little information in the help except it's a browser!  What is it based on? Where is the cache ? Does it cache? This is important if pages are partially dynamic.

Hav you tried ctrl+p? Maybe as a hack, try to give the control focus and then send control+p then enter

Message 2 of 6
(190 Views)
Solution
Accepted by topic author al_g

To print from the new browser control call "window.print();" through an invoke node > Execute Javascript.

print.png

0 Kudos
Message 3 of 6
(113 Views)

To control the toolbar display of a pdf in the browser control, the pdf file needs to be loaded from an html file using iframe with the "toolbar" option. It doesn't work as sting constant.

 

al_g_1-1770741273929.png

 

Example toolbar off:

<!DOCTYPE html>
<html>
<iframe src="c:\Project Files\Enchiladas.pdf#toolbar=0" width="100%" height="978">
</html>

 

Example toolbar on:

<!DOCTYPE html>
<html>
<iframe src="c:\Project Files\Enchiladas.pdf#toolbar=1" width="100%" height="978">
</html>

 

 

 

Message 4 of 6
(109 Views)

This is really useful information thank you! Have you found any documentation from NI or is this just general web and JavaScript stuff? 

Thanks!!

0 Kudos
Message 5 of 6
(97 Views)

There are a few LabVIEW examples in example finder, but not for these specific questions. It was mostly Javascript web searches and trial and error.

0 Kudos
Message 6 of 6
(84 Views)