LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Insert image into html report

Solved!
Go to solution

Hi all,

      VI Description:   I have attached a sample VI in which I have tried to implement a template HTML (I have used a sample template since I cannot use the template specified by the company). The process focusses on printing the HTML using Microsoft write to pdf and convert the HTML to pdf.

      Problem:   When I insert the image with a lower resolution (hence with a lower size) loads. So, it is successful when writing to the pdf. But, for large size images ( like the images with size=10MB, the printing is too fast to capture the image and write).

What can I do to write the larger image as well.

      Pre-requisites:  I have included a combo box in the VI. this helps in shifting between the small and the large image.

I couldn't upload the large image.

Download All
0 Kudos
Message 1 of 3
(3,753 Views)
Solution
Accepted by topic author sr_nilabview

The Report Generation Toolkit uses the .NET WebBrowser2 componenet (it's basically a sub-component of Internet Explorer) in oder to render the HTML and then command it to print. The following happens when printing HTML with the Report Generation Toolkit:

  • The HTML that you have saved into memory is saved to file in a temporary location with the format of %TEMP%\lvtemporary_%d.html
    • %TEMP% refers to the Windows Temporary folder that you can access by entering %TEMP% in the Windows Explorer file path bar
    • %d is a Randomly generated number up to 1000000
  • A check is performed to make sure IE is installed
  • The temporary path to the HTML file that was saved to disk is given as a webpage URL and rendered behind the scenes using an IWebBrowser2 browser canvas
  • When the "DocumentComplete" event is generated by the IWebBrowser2 component, a Print command is issued
    • This should guarantee that the image has been loaded and completely rendered

Knowing this, my first suggestion would be to see if you can get this to work in Internet Explorer directly. This helps us isolate the problem between IE and the Report Generation implementation. To try with Internet Explorer directly, you can either find the temporary HTML file that is create and open it with IE or save your HTML in your VI to disk and try that.

Message 2 of 3
(3,716 Views)

Thank You iZACHdx,

         I used your reply as reference and figured out that the error was in 2 parts of the code:

1) Temp Folder : <img src="image.png" /> which referred to a static address. This seemed to point out to a directory path "C:\Users\raakeshs\AppData\Local\Temp" , which contained the so called lvtemp file. So, I needed to have the image.png file in that folder to access it in the PDF.

2) HTML code : the path given in the src attribute of the <img> tag must be with reference to the image (Eg : <img src="C:\Users\user_name\Desktop\presentation\images\image.png" />)

 

0 Kudos
Message 3 of 3
(3,695 Views)