Adding button in pdf made using pdf package in flutter - flutter

I am using the pdf package in flutter for generating pdf from the app. I need to add a clickable kind of thing(hyperlink, button) in pdf but the package doesn't provide any widget for that purpose. Also, the basic flutter widgets couldn't be used for generating the pdf files(restricted by the package). Is there any way to solve it?

Use the Stack widget to put any widget above the pdf ?

The problem is solved now, the pdf package provides the UrlLink for the purpose of opening a link when tapped on the page.
This is the short documentation for the same.
I did it like this-
pw.UrlLink(destination: imageUrl, child: pw.Text('LINK', style: pw.TextStyle(fontSize: size)))

Related

How to use image_cropper in flutter web?

It's said in the description of the package that is supports web. But since it's not possible to get path of the file in flutter web I can't to use it. Because the only way to work with this package is to provide path of the image
I looked at the example and you have to use Image.network instead of Image.file on web.
Then you can pass in the url to the image like this:
Image.network(
url,
);
if you what to crop image than check out crop_image package

How to tap to copy html text in flutter app

My developer is building an educational app for me and we kind of have a problem. I want to know how to tap a word or phrase on the screen to show copy, highlight, web search like the image below. The app was built with flutter and the code is in dart. This feature is really needed. Will appreciate if someone can help with a plugin or just a way to do this.
If you are using webview package you have a gestureRecognizers property in webview widget, just add this line:
WebViewPlus(
gestureRecognizers: {}..add(Factory<LongPressGestureRecognizer>(() =>
LongPressGestureRecognizer())),...)
Flutter has selectable text for that
If he is using webview, maybe this could help?
How to enable text selection modal(copy/paste/select) in flutter webview?
They is a package for copy and paste text in the flutter.
FlutterClipboard.copy(item.code).then((value) {})
package link
Well I got your problem.
There is a possible solution. Here you are doing is sending data from server in html format and displayed it using html_viwer. But there is no functionality I found to select and copy so far.
The possible solution is send string data from server and use SelectableText() to show the text and you will be able to select and copy your text.
There's a solution for this, just use SelectableHtml widget instead of only Html

How to hide the the navigationbar that present in pdf viewer plugin flutter

I need to hide the navigation bar that present default in the pdfviewer plugin flutter.I used to change the value of showNavigation value to false but it doesn't work .I use the plugin flutter_plugin_pdf_viewer:any here is my code:
Containe( width:130,
height:130,
margin:EdgeInsets.all(20.0),
child:PDFViewer(document:doc2,
showNavigation : false,/*here is my issue ,when i set like this it shows nothing in the UI*/ ),)
This plugin solves this issue please check the below link
https://github.com/lohanidamodar/pdf_viewer/pull/2
Use this plugin
advance_pdf_viewer: any
I have solved this issue by changing source code of this plugin. for hiding navigation tool bar in the pdf viewer plugin use this plugin for viewing only single page from pdf :)
https://github.com/SmilingDeveloper/newpdf_viewer.git

How Can I generate QR code and Show it on a PDF page in Flutter

I am Building a Flutter App, and one of the Functionalities includes the following:
1- Generating Qr codes - no problem here if I am showing it on the screen.
2- Generating PDF file, then saving it and sharing it using native device Sharing, No problem here until I tried to include the Qr code in the PDF page!
I have been stuck with this for two days and tried too many approaches to solve this, sadly with no luck.
please help and thank you all in advance.
You can use the Barcode widget from the pdf package. https://pub.dev/packages/pdf
import 'package:pdf/widgets.dart' as pw;
//Barcode widget inside pdf.addPage()
pw.BarcodeWidget(
color: PdfColor.fromHex("#000000"),
barcode: pw.Barcode.qrCode(),
data: "My data",
),
using this package (pdf package) you can use like this -->
final pdf = pw.Document();
pw.BarcodeWidget(
data: "demo",
barcode: pw.Barcode.qrCode(),
width: 100,
height: 50
),
result is:
I have got the following answer from DavBfr / dart_pdf on GitHub and it worked:
Yes, there is a Widget for that:
BarcodeWidget(
barcode: Barcode.qrCode(),
data: 'here is a qrcode',
)
You can use the same widget for Flutter too: https://pub.dev/packages/barcode_widget

Is window copyable in Flutter

I need copy data of window and add to clipboard. I searched and I found nothing.
I reiceved data from rest api with html tags and I use html view for render the html tag. that's why I can't selectable text.
How to copy data of window or body of stateful widget? Any idea?
If you want to copy text from your app, you can use the SelectableText widget. There was recently a Widget of the Week video on it here:
https://www.youtube.com/watch?v=ZSU3ZXOs6hc&vl=en
There isn't a way to copy images or other data except for text, as far as I know.
You can use the following package to capture a screenshot.
Add the following to install
dependencies:
screenshot: ^0.1.1
Then import it
import 'package:screenshot/screenshot.dart';
Example can be found here Screenshot Example
References
screenshot package