I am generating some linecharts via JSF (Primefaces).
So charts are accessible and generated nicely via accessing in any browser.
However i need to send those charts via email to certain persons cause they do not want to click on a link so this should be automated.
Is there a way to generate an image out of what the JSF is rendering ?
Thanks
Charts are canvas based and can be exported as static images with client side api.
Take a look here:
http://www.primefaces.org/showcase/ui/chartExport.jsf
Primefaces use Javascript Libraries to render the charts. You would have to process the browser output before sending the email.
(Also, lazy managers)
You would have to dig into the Java Image API (not JSF) in order to plot the graph (from the raw data) into an image if you want the JVM to send the email.
If you want to just automate the process in your machine to send the emails (so you can send the emails in one click instead of doing it all manually, be mindful of this caveat:
You would have to generate a custom page with print CSS and your email layout, then use a browser plugin that sends the email on a click.
Related
I have an web-application in RoR which calculates some energy values and investment money. I use ajax to send the data from the web-browser to the server. It is something like this: Browser-server-Browser-Server-Browser
This web-application is already integrated in typo3 and I want to implement a PDF button to send the results per email (in other words, a photo of the page with the results).
I have heard an option would be to generate some links in RoR to be used in typo3 (when clicking on it, it would open exactly the web-application with the results already calculated). But as a newbie, I do not really know which would be the best approach.
Any recommendation?
A screenshot of the page can be done client-side:
http://html2canvas.hertzen.com/
You could even have another page with the same results that you use only for the rendering of the result page what you use for making a clean screen-shot (you might not want to have the footer, menu and other elements on that page, only the results)
Once you have your screenshot, you can upload it to your server where you can use it to create a PDF of that image and then send it with any mail API you prefer to use.
info about TYPO3's mail api can be found here:
https://docs.typo3.org/typo3cms/CoreApiReference/ApiOverview/Mail/Index.html
I want to read the content (html) of a certain URL. I send a GET command, receive the html and I do what I want to do with it, no problem here.
The problem happens when a site loads more info into itself when you scroll down (like Facebook does), so the content I receive is the default one without the parts that are yet to be loaded. Any idea what can be done to retrieve the next parts automatically so I can read more and more of the content of such site?
I saw something about phantomJS but I'm developing a desktop application (using Delphi) so I can't use it. Thanks.
I creating emails using partial views and saving them in DB (later they will be sent). I need to embed image into email to display in gmail. How to do this in ASP.NET MVC 2 project? How to embed image into view to make it work and display image in gmail?
You can't. Well, not reliably anyways. At least not in the way you mean. There is such a thing as data-url's, that allow you to embed an image into the page, but you will find that this is not widely supported by email clients and thus is not a reliable way to include images.
In fact, creating emails with embedded content is something of a black art. There are so many gotchas with various email client support that you have to do a lot of research into what does and doesn't work.
However, in general, what you want to do is use an embedded MIME image attachment in the email multi-part mime format, which has nothing whatsoever to do with MVC. All you would do in MVC is create your email with the appropriate tag (ie. <img src="cid:logo_sml.jpg">) to extract the mime content from the email, note that you won't see anything in a browser, as it only works in an email client.
You might want to read articles like these:
https://www.campaignmonitor.com/blog/post/3927/embedded-images-in-html-email
http://emailmarketing.comm100.com/email-marketing-tutorial/embedding-images-in-email.aspx
How to embed images in email
sending mail along with embedded image using asp.net
Im trying to send some data to a form on a site were im a member using cURL, but when i look at the headers being sent, they seem to have been encrypted.
Is there a way i can get around this by making the computer / server visit the site and actual add the data to the inputs on the form and then hit submit, so that it would generate the correct data and post the form ?
You have got a few options:
reverse engineer the JavaScript that does the encryption (or possibly just encoding) process
get a browser engine (e.g. the Gecko engine), and add some scripting to it to fill in the forms and push the submit button - of course you would need JavaScript support within the page itself
parse the HTML using an HTML parser, feed the JavaScript in it to a JavaScript runtime with the correct libraries, fill in the "form" and hit the submit button
It's probably easiest to go for the first option. The JavaScript must be in the open to be able to be executed in the browser. But it may take some time to reverse-engineer as it is likely obfuscated.
You can use a framework to automate user interaction on the web pages, like Selenium.
This would enable you to not bother reverse engineering anything.
Selenium has binding in various languages, including Python and java.
Provided the javascript is visible on the website in question, you should be able to simply copy and paste their encryption routines to prepare the headers exactly as they do
A hacky fix if you can isolate the function that encodes the data you type in the form - is to use something like PyV8 to execute the JS inside python.
Use AutoHotKeyIt and actually have it use the Browser Normally. It can read from files, and do repetitive tasks infinitely. Also you can push a flag to make it only happen within that application, which means you can have it minimized and yet still preform the action.
You seem to be having issues with the problem of them encrypting the headers and such, so why not simply use that too your advantage? Your still pushing the same data in, but now your working around their system. With little to no side effect too you.
http://www.asp.net/web-api/overview/working-with-http/sending-html-form-data,-part-2 shows how to upload files. However I would like to have someone show me the code example where I can display the progress of the file upload using ProgressMessageHandler class. So far I was able to find examples of the class being used in WPF or console application, but I would like to use it either on the MVC controller method or the WebAPI method directly and show the upload progress to JQuery UI progress bar. Can someone post the sample code of how it can be done?
So you want to display the send progress on the client, by tracking the receive progress on the server? Keep in mind that the ProgressMessageHandler class is server-side code.
In order to do what you're proposing, every time the server receives a packet, it would need to send back to the client the details of the progress. But in order for a web browser to receive any data, it must first request it. So the browser would have to upload the file, and simultaneously be asking the server for progress updates?
I think you've got this all backwards. If you're wanting to display file upload progress in a web browser you need to look at browser technologies. Like the HTML5 upload (there's plenty of examples out there of using HTML5 to track file upload progress). Or one of the pre-HTML5 options that got a lot of mileage was Shockwave Flash plugins. GMail does, or at least did use a Shockwave Flash plugin for progress reporting on attachment uploads for example.