I may fall under the list of possible duplicates but still i could not find the answer according to my req.In my rails application i have some web pages with a link of print option.
Now what i need is when i click on this print ,i should get a screen shot of the current web page and a popup box to save the image .Is there any plugin available for the same.
Also any queries for code are welcome
Thanx
You could go for phantomJs. Where you can alter the page HTML, manipulate CSS, insert & call javascript snippets, the way you need it.
Good documentation available and also you can find great deal of help in stackoverflow-phantomjs
Regards,
HBK
May i suggest that you use http://www.w3.org/TR/css-print/
if you want to make a screeenshot you have to work with the user env, so i suggest you look at this topic How do I take screenshots of web pages using ruby and a unix server?
Related
I've tried the TChromiumOSR and TPaintbox32,it works fine. However, but not all the screenshot of webpage, only the part.So maybe I need the width and the height of the webpage,but I can't find a way to get it.This is my method of solving the problem,could you give me the solution or is there any faster ways?
You could use html2canvas inside a your chromium instance. The user could choose a part of a openstreetmap and our application made the screenshot and stored it somewhere on the disk. The advantage with this approach is, that you allways get the hole page and not just with what you see. You could use the OnLoadEnd event, to put your javascript inside the page your are loading and then make the screenshot and save it somewhere. I'm sorry I cant provide any sourcecode, I dont have access to this project any more. The downside of this approach is, that you need some decent javascript skills, to pull this one off.
I'm trying to find a way to let the client of a website I'm working on (specifically an administrator) edit the content of a pdf file. For example, if the client decides that they want to change the wording on a pdf (but not the format), they can click a button or something and make the changes they need to without asking me to do it. Any help would be much appreciated. :)
Check out The Ruby Toolbox page for report generation, specifically PDF_generation. There's a couple of different options with reviews and documentation.
https://www.ruby-toolbox.com/categories/pdf_generation
When using FB or Google + I can paste a link of any website into the status update box and it will instant load information about that website with the option of flicking through thumbnail images.
How can I go about achieving this in ruby on rails? All my searches seem to bring up php methods on how to do this.
For grabbing video data info I use the Ruby Open Graph Protocol gem. Is there any thing for grabbing data the way FB and G+ do? If not is there a standard way this is done in rails/ruby, if so.. how is this done?
Kind regards
I think you're looking for something like oembed. I've found a gems for that, so I propose you to take look at it: https://github.com/judofyr/ruby-oembed or https://github.com/embedly/embedly-ruby
You should likely use a gem like http://nokogiri.org/
It allows you to work with a html page just as you would do with jQuery. Very handy.
Similar to Facebook's UI, I am attempting at generating a preview image from an external linked website. So that when a user types in a url he is linking, the UI will by default, scan that site for an img and scrape a preview thumb.
Is there a specific name for this technique? Or can anyone point me in the direction of learning this?
Thanks so much!
Its called scraping. There is a library called scrAPI.
Here is a code example http://crunchlife.com/articles/2007/08/13/code-snippet-ruby-image-scraper
There are a couple different options when it comes to page scraping. Another one to check out would be nokogiri, http://nokogiri.org/. You can find tutorials on how to use it at http://nokogiri.org/tutorials.
Instead of grabbing an image from the site, why not grab the image of the entire page? You could make use of a free screenshot service like http://www.websnapr.com/ or http://www.thumbshots.com/ among others. In one application, I use that for my preview image, and use nokogiri to scrape the page title and description. Just an idea.
I have seen examples of printing from a windows application but I have not been able to find a good example of any way of doing this.
I've used the print style sheet
here's and article http://alistapart.com/stories/goingtoprint/ that will go through the way to set that up. Rather than setting up a special page that would need to be maintained as well.
If you just need to print your web page from the client-side use window.print(). Sample could be found here: http://www.javascriptkit.com/howto/newtech2.shtml. I would suggest preparing a special version of your page first with no dynamic content and with a layout which would look nice on print.
If you need to send something to printer on the server-side that would be a little bit more complicated. Check out this MSDN article on how to do the basic printing.
The browser prints your pages. If you need to tweak the page so it looks better on the printer, use CSS #media selectors.
Restating what others have said, you just need to call window.print() in javascript. That and build a separate css for print.