How to render top of page to png via headless browser? - c#

I'm trying to dynamically generate images for the og:image preview for a particular urls.
Given the designs/stack the easiest option for layout seems to be html/css/reactjs, so just trying to render out to an image using a headless browser of some kind.
Ideal would be js libraries or npm packages, but happy to use any stack to do the rendering (c#, java, anything). If I can't find something thinking maybe have to adapt something used in ux testing?
(That is, I guess I sort of need something like browsershots but only for one browser, only the top section of the page, and ideally running on my server).
Any ideas or suggestions greatly appreciated πŸ™‚ thank you.

Related

Treat Picture Like a Map ASP/CSHTML

I need to zoom in and out of a picture, grab it and browse different parts of it as you would a map, and set pushpins as markers to remind me of locations I found interesting. Essentially I want to perform similar functionality that bing (or google) maps provides but on a picture I have. From this tutorial : http://www.microsoft.com/web/post/using-the-bing-maps-api
I have tried swapping the source to point to the picture on my local drive but that don't work. What would be a good language / approach to take/use in solving this issue? I was trying to do this in C# first but now need to do this for a web application, please advise; newbie to Web development btw...
I am not able to understand why are you trying to view Picture as Map; zooming, clicking, dragging. But however, try to use jQuery for this.
The API that you are using, would work for Bing Maps. Its their server API and I don't think you can use that for any other work. But you can still re-write it and compile it to work for you.
The basic code or what you can say, the basic events for it would be .click() .dblclick() then you can use jQuery Draggable. These would be the basics only.
However if you are working with image. You would definitely need some other tools that would be able to let you work with Images, try SilverLight.
You mentioned Google Maps, Bing Maps, I need to clarify they use huge amount of JavaScript. To check where click was made, what is its location, where to zoom in where to zoom out. If it was me, I would have first tried to learn jQuery and JavaScript. To learn what are events, how they are used, and how I can use them in my project.
jQuery zoom is nothing or should I say, there is no such thing as a Zoom for any object in jQuery API. But this is a great site that I just found right now I hope it would be a kick start for you jQuery Zoom jacklmoore.com. For this site, you might need some plugin from the person, link is provided on that page! Go an have a look. :)
Again: Try to learn the basics first. You never know when the very basic event is needed and you are trying to use the expert level one. I hope it helps! :) Comment for any question or any objection.
Cheers.

Render page as a picture

I have question to Java or C# programmers. I want to render some pages in various browsers mainly Firefox and IE and save it as a picture. I have not any serious experience in Java/.Net. Is there any libs/tools for such tasks? I thought about some FF extensions for example but I don't know how to do it in IE. Is the in .Net some libs for dealing with it? Maybe some ActiveX? Any sugestions?
http://www.vesic.org/english/blog/winforms/render-html-to-quality-jpeg/
I'm not sure what your end goal is, but perhaps http://browsershots.org/ offers the functionality you're looking for? It would appear they offer both an XML-RPC interface and also the source code freely.
Edit: It looks like the source code link isn't properly hooked up currently.
You can use the FireFox Screengrab extension - it's very handy!
"Screengrab! is an extension that
makes it easy to save a web-page as an
image – it’s a screen capture tool for
Firefox!
With it, you can save anything that
you can see in a browser window – from
a small selection, to a complete
page."

How to create a WebKit browser plugin in C#?

I want to create C# plugin for some 3d + Music editing stuff. I want to be able to run my files inside browsers pages (so to see HTML some Flash content and some content which is rant by my plugin) using something like HTML tag or some JavaScript. (So my plugin will be small, powerfull and i want it to run at least on Windows and Mac firefox and safary and Chrome)(If it'll be runing on Linux itll be grate)))
I'ma beginner so any helpfull info will be appriciated
You could achieve it using Silverlight .. think abt it .. :)

dynamic loading in silverlight

Ill explain a little bit of my project here. I'm trying to make a website in silverlight, my goal is to store all the content in external files, and load them after my silverlight app has loaded. for instance, load the home page, then, while the user is browsing the home page, load the other pages in the backround, and then when a link is clicked, the main content will fade out, and the new page will then fade in its place. My question to you guys is:
whats the best way to create the external files? how should they be created/saved?
how can i load them in the backround while the user is browsing, and then display them by fading when a link is clicked?
how can i add features, for my silverlight app to edit, and re-save the files,for instance, adding a picture to a picture gallery and such
any help would be greatly appriciated. the code-behind of my app is in C#, but im new with the whole silverlight idea, so pretty much any advice at this point would be very welcomed!!
My suggestion for this scenario is using a MEF (Managed Extensibility Framework).
It's provide Dynamically Loading a .XAP, Downloading Based on User Interaction, and other's features out of the box. So, I think, use the MEF it's easyest way approach load-content-on-demand scenario.
You don't mention what sort of content you are dealing with. If it's markup (markdown) and images it should be pretty simple
Log every actual content request, and use that data to rank the order you pre-load the cache in. This way the system is self tuning. If there are complex paths to traverse, consider using a neural network process to determine what to pre-load
Silverlight uses the standard browser HTTP request methods and hence cache, so all you have to do is request a resource and it will be cached
You seem to be describing a wiki (editing pages in Silverlight etc). Consider using an existing wiki engine e.g. screwturn.eu and customising the display and editing interface to work via Silverlight. This will save an enormous amount in versioning, resource management, security etc
Similar to the Managed Extensibility Framework which FFire mentioned, you may also want to look into Prism V2. Heres some resources to get you started and find out if its for you.
WPF/Silverlight - Prism - Resources for beginners
from that list heres a good list of example videos about silverlight, modularity, regions etc.

Paint like Feature in Web.Application?

i want to implement Ms Paint like feature in my web application in c# asp.net. like cropping coloring zooming ,color picker etc . Please tell me is there any pre build tools or application for it.Any pointers and suggestion would be much appreciated. Thanks !
you can use jquery plugin....
http://www.webresourcesdepot.com/jquery-image-crop-plugin-jcrop/
http://www.webappers.com/2008/09/12/jcrop-poweerful-image-cropping-engine-for-jquery/
If your looking for C#, your only option is Silverlight.
If you can do something other than C#, theres Adobe Flash, as well as some JavaScript. JavaScript can be limited (though I have seen some pretty nice ones) when it comes to graphics, unless you want to use the Canvas tag. The only problem with the Canvas tag and JS is that it is not fully supported in all browsers yet.

Categories

Resources