I'm having the following problems using Javascript and img tags in the standard HTML component in AIR:
1- Javascript in the xml literal causes problems (even though it shows using them here: http://livedocs.adobe.com/flex/3/html/ProgrammingHTMLAndJavaScript_07.html#1032824
2- Using html.loadString(...<img src="/tmp/me.jpg" />...) does not show the image.
3- After wrapping the Javascript in CDATA tags it is still not accessible and returns an 'invalid function' error when trying to reach it.
The second 2 issues seem to go away if I save the html to a file and load it with html.load(file) instead of trying to read it as a string. Any suggestions to solve these issues?
I ended up saving the file to a temporary file and using html.load(tempfile).
Related
Currently, I am working on a program that converts an html page into a PDF using the iText Library.
The Checker that I am using is PAC3 -->PDF Accessibility Checker 3 which is described by the following link (https://section508.gov/blog/check-pdf).
One of the issues is the “Alternate description missing for an Annotation”
An excerpt from the following link explains it:
http://www.uottawa.ca/respect/sites/www.uottawa.ca.respect/files/fss-fixing-accessibility-errors-in-pdfs.pdf
Alternative description missing for an annotation This usually happens when the link is not clear enough. To fix this error, add alternative text to the link tags. To add the alternative text, please do the following;
In the tag tree, select the tag for the link, and select Properties
from the options menu.
In the Touchup Properties dialog box, select
the Tag Tab.
Type alternate text for the link, and click close
I have been trying to use iText to fix this problem, but googling, looking at the source and reading the documentation does not help.
Does anybody have any suggestions on how to either write the HTML or use the itext problem to get rid of the “Alternate description missing for an Annotation”
Thank you for your help
You did not specify whether you using old code (XMLWorker, HTMLWorker) or new iText code (pdfHTML).
This of course impacts the proposed solution.
In my answer I am going to assume you are using pdfHTML
There are several options:
edit the incoming HTML using a library like JSoup
convert the incoming HTML to iText IElement objects, and edit those, setting properties where needed
write your own custom TagWorker that handles all instances of a specific tag, and write custom logic to deal with the missing annotations.
An example of a custom tag worker can be found here:
https://developers.itextpdf.com/content/itext-7-examples/converting-html-pdf/pdfhtml-custom-tagworker-example
After searching for a while as I couldn't find a way to achieve what I want posting the question here. I want to format the angular HTML file in a way that is explained below.
There was enough way to format. Using extensions or overwriting the vscode settings by "html.format.wrapAttributes": "force"
This is how the file is formatted after pressing Ctrl+Shift+Enter
I want only the angular component selectors' attributes to be formatted as shown below.
Any extensions or customizations or any better way to do that is appreciated?
I had the same issue and found a solution.
Install Beautify plugin for vscode and it will solve your issue.
You can use the following option in VS Code settings:
"html.format.wrapAttributes": "preserve-aligned"
If you split the angular components' attributes into different lines (and keep the remaining HTML attributes in a single line), it will correctly format you document without breaking the "rules" you defined.
Yes, it has a bit of manual work, but is the best alternative I've found.
I used Ctrl + K + S for the first time and after that it continued saving withoud reformatting
Anyone has idea, how to produce valid HTML5 when images are displayed with AngularJs ng-scr directive?
What I have discovered?
"src"- attribute is required on img-tags
It can't be empty
Console reports 404 error if I set src attribute data with angular binding, cause it tries to load image before Angular has initialized
Why I want valid HTML?
Reason is simple. Strange HTML errors (missing end tags, open tags etc..) causes strange behavior in our project where we have LOTS of views. Ensuring periodically that source is valid, makes code less unstable.
From this post stems a genious hack:
<img ng-src="modelImage" src="//:0">
...much easier to remember from the top of your head than an image URL ;)
ngSrc: any string which can contain {{}} markup.
The website use ajax to load some data.When DocumentCompleted,I only get the html code without ajax data.
How to get the ajax data through webkit.net?
Thanks.
I've just recently fought with this myself and have what should be a working solution. I've not tried it with ajax, but I have used it after creating and appending DOM elements from C# and it produces the full code where DocumentText only produces the original unmodified HTML.
var fullHTML = webKitBrowser1.StringByEvaluatingJavaScriptFromString("document.getElementsByTagName('html')[0].outerHTML")
The only limitation to this method that I've seen is that it does not include the doctype tag if there is one, but everything else is there.
I am trying to load and parse html in adobe air. The main purpose being to extract title, meta tags and links. I have been trying the HTMLLoader but I get all sort of errors, mainly javascript uncaught exceptions.
I also tried to load the html content directly (using URLLoader) and push the text into HTMLLoader (using loadString(...)) but got the same error. Last resort was to try and load the text into xml and then use E4X queries or xpath, no luck there cause the html is not well formed.
My questions are:
Is there simple and reliable (air/action script) DOM component there (I do not need to display the page and headless mode will do)?
Is there any library to convert (crappy) html into well formed xml so I can use xpath/E4X
Any other suggestions on how to do this?
thx
ActionScript is supposed to be a superset of JavaScript, and thankfully, there's...
Pure JavaScript/ActionScript HTML Parser
created by Javascript guru and jQuery creator John Resig :-)
One approach is to run the HTML through HTMLtoXML() then use E4X as you please :)
Afaik:
No :-(
No :-(
I think the easiest way to grab title and meta tags is writing some regular expressions. You can load the page's HTML code into a string and then read out whatever you need like this:
var str:String = ""; // put HTML code in here
var pattern:RegExp = /<title>(.+)<\/title>/i;
trace(pattern.exec(str));