You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Pdftextweblink class with empty string or hidden text(Feature) #15
We could not add the hyper link around the image by using the PdfTextWebLink API, because we can only set offset (X, Y) to add hyperlink on PDF by using PdfTextWebLink, we internally add the hyperlink bounds (width and height) by calculated on the input text value. So the text is mandatory for text web link.
We suggest you to use URI annotation to add hyperlink on image bounds to an existing PDF document. The PdfUriAnnotation class help us to achieve your requirement. Please find the below sample code for further details.
//Load an existing PDF document with image
List input = File('input.pdf').readAsBytesSync();
PdfDocument document = PdfDocument(inputBytes: input);
//Get first page
PdfPage page = document.pages[0];
//Create URI annotation with the image bounds
PdfUriAnnotation uriAnnotation = PdfUriAnnotation( bounds: Rect.fromLTWH(50, 50, 100, 50), uri: 'www.google.com');
//Set border width as 0
uriAnnotation.border.width = 0;
//Add URI annotation in first page
page.annotations.add(uriAnnotation);
//Save PDF document
List bytes = document.save();
File('output.pdf').writeAsBytes(bytes);
Currently we do not have support for JavaScript actions in flutter-pdf. We have logged this requirement in out feature request list. We will implement this feature in any of our upcoming releases.
Activity
Anand3595 commentedon Oct 13, 2020
Hi lavahasif,
We could not add the hyper link around the image by using the PdfTextWebLink API, because we can only set offset (X, Y) to add hyperlink on PDF by using PdfTextWebLink, we internally add the hyperlink bounds (width and height) by calculated on the input text value. So the text is mandatory for text web link.
We suggest you to use URI annotation to add hyperlink on image bounds to an existing PDF document. The PdfUriAnnotation class help us to achieve your requirement. Please find the below sample code for further details.
And also find the complete sample from https://www.syncfusion.com/downloads/support/directtrac/general/ze/UriAnnotationOnImage-907063139 to add URI annotation on image bounds. Please try this in your end and let us know the details.
With Regards,
Anand P
lavahasif commentedon Oct 13, 2020
Can I add javascript function
in flutter pdf
Anand3595 commentedon Oct 14, 2020
Hi lavahasif,
Currently we do not have support for JavaScript actions in flutter-pdf. We have logged this requirement in out feature request list. We will implement this feature in any of our upcoming releases.
You can track the status of this feature request from following feedback link, https://www.syncfusion.com/feedback/18747/support-for-adding-javascript-action-in-pdf.
With Regards,
Anand P