Skip to content

Pdftextweblink class with empty string or hidden text(Feature) #15

Closed

Description

@lavahasif

I want to add hyperlink function on image position
Untitled

Enhancement:Already Modified image contain button or text .adding hyperlink base on image position .

Activity

  1. Anand3595 commented on Oct 13, 2020

    @Anand3595

    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.

    //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);

    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

  2. lavahasif commented on Oct 13, 2020

    @lavahasif
    Author

    Can I add javascript function
    in flutter pdf

  3. Anand3595 commented on Oct 14, 2020

    @Anand3595

    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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions