Rich link preview in flutter - dart

Is it possible to make a preview from an url, grabbing all the information such as title, relevant texts and images. Is there any plugins I can use readily?
See this Native android plugin

You can do this way :
1)Create a user at https://www.linkpreview.net
2)Generate an Access Key.
3)From your code call
http://api.linkpreview.net/?key=<Your_API_KEY_From_Step_2>&q=https://www.google.com
It returns the meta tags in JSON as below :
{"title":"Google","description":"Search the world's information, including webpages, images, videos and more. Google has many special features to help you find exactly what you're looking for.","image":"http:\/\/www.google.com\/images\/branding\/googlelogo\/1x\/googlelogo_white_background_color_272x92dp.png","url":"https:\/\/www.google.com\/"}
4) Use it in flutter widget to create a preview.

Hope I'm not late to answer this question, There is a plugin for link with previews Rich link preview

Currently, there is not an open source library for flutter providing these meta tags for a website.
There is a temporal solution, using these freemium APIs for getting this information. The main drawback is that the requests are limited before paying.

I know I'm a bit late but I found a solution for that.
The comment of Sudip might work but if you have a lot of preview to generate, you will have to subscribe and pay..
I couldn't use the library rich_link_preview because of some depency issues (it requires http < 1.12.0).
So I had to do it myself. Writting the complete answer in this comment would be too long so I'll tell you how I did it.
I followed this youtube tutorial. If you are too lazy to watch the entire video you can look at his Github Repo. It worked for me and it is not too long (there are only 2 relevant files):
lib/link_preview.dart
lib/helper/fetch_preview.dart

Related

Replace Thumbnails and Theme Switching

I am currently making an extension, and I hope I could get some
practical advice on feasibility :
I want my extension to go fetch/load a local folder of custom homescreen
thumbnails(top-sites), and then replace the auto-generated thumbnails in
the homescreen with those it loaded.
The extension would be able to read the associated domain names of the
thumbnails and then replace them accordingly.
(e.g :Pinned Url : youtube.com/anything : Ok so it’s YouTube : then replace the thumbnail with “Custom_Youtube_Thumbnail.png”)
Does that seems possible to you ? (Before I dive in head first)
I saw that the top-sites API is not quite available
https://bugzilla.mozilla.org/show_bug.cgi?id=1246693 but maybe I’m wrong.
Extra : My extension is switching themes (like this :
https://github.com/mdn/webextensions-examples/tree/master/theme-switcher ).
Would it be possible to switch the thumbnails accordingly
(Custom_Youtube_Thumbnail_light.png > Custom_Youtube_Thumbnail_dark.png)
as i’ve made a version for each.
Would be a pleasure to hear your opinion on this, or just pointing
useful resources to me,
I’m not asking for a perfectly baked solution.
Hope I’ve been concise.
Thanks for reading me !
Very nice idea you had.
But In short: no possible.
Main problem is that you cannot inject and manipulate on the homepage which is a built in browser tab.
"You cannot inject code into any of the browser's built-in pages, such as: about:debugging, about:addons, or the page that opens when you open a new empty tab."
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/tabs/executeScript

NativeScript - How to create a webview with request blocking/redirection?

I'm trying to create a webview with the capability to block/redirect certain urls requested inside the webview (not just the page url, but also the requests sent from the page, think of it as what a browser extension is able to do).
After some research, the closest I get was this Swift/Obj-c approach of use NSUrlProtocol: https://www.raywenderlich.com/2292-using-nsurlprotocol-with-swift, and the doc of the native-webview-ext mentioned something about WKURLSchemeHandler https://github.com/Notalib/nativescript-webview-ext .
I'm new to mobile development and this feature is crucial for my project. I wonder if anyone has experience building this out in NativeScript, I hope I don't have to convince my team and my boss to write this in Swift instead :(.
As you see in the webview-ext plugin docs, it does support overriding resource urls. Refer the registerLocalResource method.
Just in case, even if that is not supported you don't have to write your whole project in Swift as you can always access all native apis from JavaScript / TypeScript itself, read more about it here.

Rendering PDF in iOS

Need help on rendering PDF using CGPDFContext. I am currently using UIWebView to display PDF but would like to perform much more operation rather than just reading like Highlight Text, Search PDF, Annotate PDF. Not looking for using any Framework or library.
Any help will be beneficial. For a start, code on how to render PDF using CGPDF and displaying it instead of using UIWebView.
PDF annotations are a rabbit hole. I've been working on them since 2010. The spec is thousands of pages. It's easy to get started but it takes forever to get right with all the PDFs and variations out there. Even a simple feature like bookmarks are harder than you would think.
To date there's no open source framework that implements PDF annotations. The above linked one can be a good starting point. If you don't have months/years to build something on your own, there are a few commercial options available - like PSPDFKit, available for iOS, Android and Web, which I am building.
We have a guide article listing the most important PDF spec documents.
Searching is another tricky topic. It's quite hard to convert the PDF text data to unicode. The Adobe CIDFont spec is a good starting point.
You shoud try VFReader, it is an open source project for rendering PDF files on iOS. It can be a good starting point.

PSPDFKit add network image into scrollview like pdf page

I'm using PSPDFKit in my app. I want to load remote images async with the framework, cause there are both images and normal files in my app. I have tried convert imageData into PDFDataProvider, which cannot be Asynchronous. Does anyone have ideas?
Author of PSPDFKit here. Please contact us for feature requests directly, we only rarely monitor StackOverflow - that's not the right platform to provide support for commercial products.
That being said, the PSPDFViewController is designed to present PDF files - we don't have immediate plans to add support for other file types.

is swf supported in ibooks? if yes how to integrate it into epub3

I need a way to integrate a swf file with all the click events into an epub3 format? i tried including text on a swf file it shows an error in tags used while validation.Please help me with this.
Thanks to every help, suggestion or any links
While it's legal to embed a Flash file in an EPUB, Flash won't run on iOS at all, so it's not worth pursuing validation.
http://blog.threepress.org/2009/11/14/using-flash-video-in-epub/
A huge post toward the middle talks about ISO Mpeg4 and using that format for video, other suggestions talk about using a fallback image, other comments on this page that might help.
Good luck!
As from the
Liza Daly
answer and some of my research i found out that apple iOS doesn't support flash any more so it doesn't support swf in epubs. i Acheived it by using HTML5, css3 and jquery.

Resources