Welcome Guest Search | Active Topics | Sign In | Register

Submit types are being printed in PDF document though hidden in html Options
GShanbhag
Posted: Friday, May 25, 2012 3:42:49 AM
Rank: Newbie
Groups: Member

Joined: 5/15/2012
Posts: 4
Hi,

I am using the EO's HtmlToPdf.ConvertUrl method to obtain a PDF Result.

I've a simple requirement where in I do not want controls like buttons,images to appear in a PDF.
I'm using a jquery code to hide these when the html is ready.
From the html created I use the ConvertUrl to create a PDF.(on demand)

I'm seeing that the controls (of type submit etc) are actually hidden in html page that feeds to PDF.
However the PDF document that I obtain has such controls visible.



(1)Jquery code:->>

$(document).ready(function () {
$("#dvEO").addClass('imgPrint');//this is the id of a div inside which the button exists.
});

//also tried to remove the div using .remove()

(2)The CSS class:
//This is to hide the visibility
.imgPrint
{
visibility:hidden;
display:block;
width:0px;
background-color: White;
}

(3)The HTML has the following div (that I hide using the jquery) .

<DIV id=dvEO>
<INPUT style="WIDTH: 200px" id=ctl00_ContentPlaceHolder1_btnA value="Hide Me" type=submit name=ctl00$ContentPlaceHolder1$btnA>
</DIV>

My observation is that the jquery executes the code when the html is ready, but the result (pdf) isn't the same as html that is loaded.

Before posting this I've searched your forum for similar issues and considered setting
HtmlToPdf.Options.MinLoadWaitTime = 5000;
which isn't helping.

Do you think if I'm missing anything here?Think

PS: I do not intend to use InvisibleElementIds(which actually hides the button) as I want to use save to PDF across the website and id's of such buttons vary.

Details:
EO vesrion: 3.0.95.2

jquery:jQuery v1.7.2 jquery.com

Kindly help.
Regards.
G
eo_support
Posted: Friday, May 25, 2012 9:12:55 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,195
Hi,

Your code looks fine. We tested it at here and it works fine as well. You may want to add some debug code into your script just to see if the script has run properly (for example, if jquery script file fails to load, then obviously imgPrint will not be applied and those input will still be visible).

Version 3.0.95.2 is a rather old build. So you may also want to update to the current build first. We tested it with the current build and it works.

Thanks!
GShanbhag
Posted: Monday, May 28, 2012 2:29:30 AM
Rank: Newbie
Groups: Member

Joined: 5/15/2012
Posts: 4
Hi,

I do have an alert statement in the ready function of the jquery ,which does execute when I open the html.It alerts before the line $("#dvEO").addClass('imgPrint'); executes.

This is the line of code I've written (on click of a PDF image button) that gives me the pdf doc.
Line of code->pdfResult = HtmlToPdf.ConvertUrl(Server.MapPath(uri.Path), Response.OutputStream);

Are you saying that if the jquery were loaded appropriately I would have seen an alert when the above line of code gets executed?

PS: I am yet to try the latest version of EO.

Regards,
G
eo_support
Posted: Monday, May 28, 2012 7:41:20 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,195
Hi,

You will not see alert with the HTML to PDF converter since it does not interact with user. You can change your alert code to some code that changes a DIV's innerHTML. If you see the DIV's innerHTML is changed, then you will know the code was executed.

If the problem continues, try to update to the latest first, then isolate the problem into a small test project and send us the test project. We will take a look and let you know. This should be something very obvious.

Thanks!
GShanbhag
Posted: Wednesday, June 6, 2012 7:36:55 AM
Rank: Newbie
Groups: Member

Joined: 5/15/2012
Posts: 4
Hi,

I've managed to get the EO binary with version 4.0.12.2.

With the earlier version I could generate a pdf but this one gives me an exception while converting.

Convertion failed. System.MissingMethodException: Method not found: 'Boolean System.Threading.WaitHandle.WaitOne(Int32)'.
at EO.Pdf.Internal.dh.a(a1 A_0)
at EO.Pdf.Internal.ll.b.a(Byte[] A_0)


The source behind my htm is

<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'><html><head><title>Patrol-Printable Page</title><script type='text/javascript'language='javascript' src='http://localhost/MYPROJECT/Modules/OA/Content/jquery-1.7.1.js'></script><link href='http://localhost/MYPROJECT/Modules/OA/Content/PrintPDFStyle.css' rel='stylesheet' type='text/css' /><script type='text/javascript' language='javascript' src='http://localhost/MYPROJECT/Modules/OA/Content/ConflictWaiverPrint.js'></script></head><body><div class="container ContainerHeight"><div class="span-26 MainContent" id="MainContent"><DIV id=dvEO><INPUT style="WIDTH: 200px" id=ctl00_ContentPlaceHolder1_btnA value="Hide Me" type=submit name=ctl00$ContentPlaceHolder1$btnA> </DIV></div></div></body></html>



The ConflictWaiverPrint.js has the following content:

$(document).ready(function () {

$("INPUT").addClass("imgPrint");
});


Do you see any issues with the Htm?
PS:Visual studio version:VS 2008,professional edition.

Regards,
Gautam

GShanbhag
Posted: Wednesday, June 6, 2012 7:44:01 AM
Rank: Newbie
Groups: Member

Joined: 5/15/2012
Posts: 4
Hi,

Additionally I made an attempt to remove the scripts,css from the htm

<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'><html><head><title>Patrol-Printable Page</title></head><body><div class="container ContainerHeight"><div class="span-26 MainContent" id="MainContent"><DIV id=dvEO><INPUT style="WIDTH: 200px" id=ctl00_ContentPlaceHolder1_btnA value="Hide Me" type=submit name=ctl00$ContentPlaceHolder1$btnA> </DIV></div></div></body></html>

But I get the same issue.FYI

Regards,
G
eo_support
Posted: Wednesday, June 6, 2012 7:49:44 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,195
Hi,

This is a bug. We will provide you an update build and reply again as soon as possible.

Thanks!
eo_support
Posted: Wednesday, June 6, 2012 9:11:25 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,195
Hi,

We have posted a new build that should fix this problem. Please see your private message for the download location.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.