Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[syncfusion_flutter_pdfviewer] Issue in parsing tel: urls from PDFs #2180

Open
jonl-percsolutions-com opened this issue Nov 20, 2024 · 3 comments
Labels
open Open pdf viewer PDF viewer component

Comments

@jonl-percsolutions-com
Copy link

Bug description

When a pdf contains both https: and tel: links. Possibly even just tel: links, the parsing of the link fails in PDFViewerCanvas.

The code pasted below in the stack traces breaks and seems unnecessary. Let the url parse it and the platform handle it.

Steps to reproduce

  1. open a pdf with tel: and mixed https links
  2. attempt to open the tel: link
  3. see it cause an error

Code sample

fixed code

             //Just parse the url, be done with it and let the platform handle it!
              final Uri url = Uri.parse(_pdfTextWebLink!.url);
              _showHyperLinkDialog(url);
              markNeedsPaint();
              break;

Screenshots or Video

N/a

Stack Traces

https://github.com/syncfusion/flutter-widgets/blob/master/packages/syncfusion_flutter_pdfviewer/lib/src/control/pdfviewer_canvas.dart

              final bool isMailID =
                  RegExp(r'^.+@[a-zA-Z]+\.{1}[a-zA-Z]+(\.{0,1}[a-zA-Z]+)$')
                      .hasMatch(_pdfTextWebLink!.url);

              //the assumption here is that this is a mail or https url, why's that?
             // why is any of this necessary?
              final String scheme = isMailID
                  ? !_pdfTextWebLink!.url.contains('mailto')
                      ? 'mailto'
                      : ''
                  : (!_pdfTextWebLink!.url.contains('https') &&
                          !_pdfTextWebLink!.url.contains('http'))
                      ? 'https'
                      : '';
             
              final Uri url = !_pdfTextWebLink!.url.contains(scheme)
                  ? scheme.contains('mailto')
                      ? Uri(scheme: scheme, path: _pdfTextWebLink!.url)
                      : Uri(scheme: scheme, host: _pdfTextWebLink!.url) //<--- this breaks, why is this even necessary.
                  : Uri.parse(_pdfTextWebLink!.url);
              _showHyperLinkDialog(url);
              markNeedsPaint();
              break;

On which target platforms have you observed this bug?

Android, iOS, Web, Web (Android browser), Web (iOS browser), Windows, macOS, Linux

Flutter Doctor output

N/A

@jonl-percsolutions-com jonl-percsolutions-com changed the title Issue in parsing tel: urls from PDFs [syncfusion_flutter_pdfviewer] Issue in parsing tel: urls from PDFs Nov 20, 2024
@jonl-percsolutions-com
Copy link
Author

Also to clarify, this issue appears in 27.2.2 still.

@VijayakumarMariappan VijayakumarMariappan added pdf viewer PDF viewer component open Open labels Nov 21, 2024
@KrithigaPerumal
Copy link

Hi @jonl-percsolutions-com ,

We have confirmed that the issue of 'parsing 'tel:' URLs from PDF Document' is a defect in our product. We have logged a report for it, and the fix will be included in the December 3rd, 2024, weekly release.
Please follow the feedback link to track the status of the bug,
https://www.syncfusion.com/feedback/63432/errors-with-opening-the-the-pdftextweblink-in-the-pdf-document

Regards,
Krithiga Perumal.

@immankumarsync
Copy link
Contributor

Hi @jonl-percsolutions-com,

We have resolved the issue with parsing PDF text web links that contains Telephone number link, and the fix for the same is available in our latest weekly release.

Package link: syncfusion_flutter_pdfviewer 27.2.5

Root cause: The scheme for the telephone links were not handled properly in the SfPdfViewer widget.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
open Open pdf viewer PDF viewer component
Projects
None yet
Development

No branches or pull requests

4 participants