dynamic-content

imagettftext(): calculate font size to ensure text fits image width

青春壹個敷衍的年華 提交于 2019-11-28 11:34:39
I'm using imagettftext() to write dynamic text on an image and I want it to fit my image width. How can I calculate the font size by the text lenght? You can calculate the bounding box of TTF text before outputting it with the imagettfbbox function. Unfortunately there is no direct way of scaling to fit a width, so you'll have to do it yourself. One way of doing it is to pass the text with a default font size of, say 20, to imagettfbbox and retrieve the width from it. You can then calculate how much smaller or bigger the text should be to fit the size you want by calculating a scale factor:

Filling an IFRAME with dynamic content from JavaScript

我怕爱的太早我们不能终老 提交于 2019-11-28 07:01:55
I have an IFRAME that should be filled with content from JavaScript. Had the content be on the server all I had to do is: function onIFrameFill() { myIframe.location.href = "HelloWorld.html"; } But the content I have is a HTML page generated on the client and represented as a string (I have not much influence on it). How can I populate the content of the my iframe programatically? I think you're looking for something like: var iframeDoc = myIframe.contentWindow.document; iframeDoc.open(); iframeDoc.write('hello world'); iframeDoc.close(); Tried setting .innerHTML but that does not work.

javascript or jQuery doesn't work in dynamically generated content

半世苍凉 提交于 2019-11-28 00:24:08
Morning people. How to make my javascript or jquery works in dynamically generated content. Basically, i have created web page that generates contents, base on what user clicks on the navigation menu. The problems i am facing: when main page generate contents from content-page, jquery or javascript won't work. but when i open up the content-page alone, everything works. Information collected through searching: jQuery.load() method ignores the script tag that comes together with the that content generated dynamically. So i try the following: Put the tag that i need in main page, not in content

htmlagilitypack and dynamic content issue

谁说我不能喝 提交于 2019-11-27 07:20:09
I want to create a web scrapper application and i want to do it with webbrowser control, htmlagilitypack and xpath. right now i managed to create xpath generator(I used webbrowser for this purpose), which works fine, but sometimes I cannot grab dynamically (via javascript or ajax) generated content. Also I found out that when webbrowser control(actually IE browser) generates some extra tags like "tbody", while again htmlagilitypack `htmlWeb.Load(webBrowser.DocumentStream);` doesn't see it. another note. I found out that following code actually grabs current webpage source, but I couldn't

Include dynamic content containing JSF tags/components from stream

旧城冷巷雨未停 提交于 2019-11-27 05:32:29
I am working on an application where I would like to include dynamic XHTML content from a stream. To handle this I wrote a taghandler extension which dumps the dynamic XHTML content to output component as UIOutput htmlChild = (UIOutput) ctx.getFacesContext().getApplication().createComponent(UIOutput.COMPONENT_TYPE); htmlChild.setValue(new String(outputStream.toByteArray(), "utf-8")); This works fine for XHTML content which has no JSF tags. If I have JSF tags in my dynamic XHTML content like <h:inputText value="#{bean.item}"/> , then they're printed as plain text. I want them to render as input

javascript or jQuery doesn't work in dynamically generated content

一世执手 提交于 2019-11-27 04:43:41
问题 Morning people. How to make my javascript or jquery works in dynamically generated content. Basically, i have created web page that generates contents, base on what user clicks on the navigation menu. The problems i am facing: when main page generate contents from content-page, jquery or javascript won't work. but when i open up the content-page alone, everything works. Information collected through searching: jQuery.load() method ignores the script tag that comes together with the that

Filling an IFRAME with dynamic content from JavaScript

故事扮演 提交于 2019-11-27 01:41:18
问题 I have an IFRAME that should be filled with content from JavaScript. Had the content be on the server all I had to do is: function onIFrameFill() { myIframe.location.href = "HelloWorld.html"; } But the content I have is a HTML page generated on the client and represented as a string (I have not much influence on it). How can I populate the content of the my iframe programatically? 回答1: I think you're looking for something like: var iframeDoc = myIframe.contentWindow.document; iframeDoc.open()

htmlagilitypack and dynamic content issue

两盒软妹~` 提交于 2019-11-26 13:08:23
问题 I want to create a web scrapper application and i want to do it with webbrowser control, htmlagilitypack and xpath. right now i managed to create xpath generator(I used webbrowser for this purpose), which works fine, but sometimes I cannot grab dynamically (via javascript or ajax) generated content. Also I found out that when webbrowser control(actually IE browser) generates some extra tags like \"tbody\", while again htmlagilitypack `htmlWeb.Load(webBrowser.DocumentStream);` doesn\'t see it.

How to bind dynamic content using <p:media>?

青春壹個敷衍的年華 提交于 2019-11-26 07:42:38
问题 I use the <p:media> to display static PDF content. <p:media value=\"/resource/test.pdf\" width=\"100%\" height=\"300px\" player=\"pdf\"> </p:media> How can I change it to display dynamic content? 回答1: Like as in <p:graphicImage> , the value attribute can point to a bean property returning StreamedContent . This only requires a special getter method for the reasons which is explained in detail in the following answer on using <p:graphicImage> with a dynamic resource from a database: Display