Free Support Forum - groupdocs.com

Rendering a file to HTML with Watermark does not ends properly in .NET

Hello,

In html viewer when the watermark options is included the result Html text does not end properly:

With the attached document without Watermark ends like this:

                     ... 
                     </div>
			</div>
		</div>
	</body>
</html>

But when I include the watermark option the html ends like this:

                   ... 
                   </text>
                </g>
            </g>
                </svg>

I use the latest version 20.7 and the code is like this:

           using (Viewer viewer = new Viewer(this.textBox1.Text))
            {
                string filePathFormat = "pagePdf-Wm-{0}.html";
                HtmlViewOptions options = HtmlViewOptions.ForEmbeddedResources(filePathFormat);
                if (this.checkBox1.Checked)
                {
                    options.Watermark = new Watermark("Restricted");
                }
                viewer.View(options);
            }

The html is not always the same for all documents but almost it seems to be truncated for some reason.
TestWatermark.pdf (109.4 KB)

@oorduz

This issue is reproduced at our end. Hence, we’ve logged it in our internal issue tracking system with ID VIEWERNET-2694 for further investigation and resolution. You’ll be notified in case of any update.

@oorduz

This issue is now fixed in API version 20.8.

Hi @atirtahir3,

I tested again with API version 20.8 and the output html is better but still has an error:

Now with the watermark ends like this:

...
<div class="p1-watermark">
                <svg xmlns = "http://www.w3.org/2000/svg" version="1.1" width="100%" height="100%" viewBox="0 0 1366 768" 
                    style="position: absolute; top: 0; bottom: 0; opacity: 1;">
                    
            <!-- Diagonal -->
            <g transform = "scale(0.5,0.5)" >
                <g transform="translate(1366, 768)" >
                    <text x = "0" y="0" fill="#FF0000" style="font-size:263.7069px;" text-anchor="middle" transform="rotate(-45) scale(2, 2)" dominant-baseline="central" >
                        Restricted
                    </text>
                </g>
            </g>
                </svg>
            </div></div></body>
</html>

It opens one div tag but closes two div tags.

For me is important because this html text is not showing correctly in my application.

Thanks

1 Like

@oorduz

We’re further investigating this issue. You’ll be notified in case of any update.

@oorduz

Please have a look at this screenshot.png (19.1 KB). The second closing </div> tag is actually starting near the body tag.

Hi, @atirtahir3:

Oh yes, you’re right the tag is correctly closed!!. I’m so sorry, my bad.

I haved trouble to render an html page with watermark, but I guess is my code. (I’m gonna try with Angular groupdocs viewer component to fix this).

Thanks, sorry again

@oorduz

You are welcome.