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

QR code yellow background #461

Closed
vishwajit76 opened this issue Oct 19, 2021 · 10 comments
Closed

QR code yellow background #461

vishwajit76 opened this issue Oct 19, 2021 · 10 comments

Comments

@vishwajit76
Copy link

I tried multiple government pan card PDF and most of pdf QR code is showed with yellow background. Also some PDF not opened and generate exception with message "Null check operator used on a null value".

current version used:
syncfusion_flutter_pdf: ^19.3.46-beta

This pdf file not opened.
15112000 INSTANT (1).pdf
password - 15112000

PDF show QR Code with yellow background.(We also tried remove password at the same time, may be issue occured from that)
24071988_UTI_(1).pdf
WhatsApp Image 2021-10-19 at 11 57 23 PM

@Anand3595
Copy link

Hi @vishwajit76 ,

Thanks for contacting Syncfusion support.

We can reproduce the reported issue with "Null check exception thrown while removing password from encrypted PDF document" in our end. We will validate and update further details on 22nd October 2021.

However, we are not able to reproduce the barcode preservation issue in our end with provided PDF documents. Please provide the below details to validate further in this.

  • Complete code snippet to reproduce the issue based on the PDF creation or manipulation process.
  • Details about the viewer used to view the output PDF document.

Regards,
Anand Panchamoorthi

@vishwajit76
Copy link
Author

We pass the file path and remove password from pdf and save it on temp directory then we open file using open_file plugin.

Future<String> getPdfPath(File pdfFile) async {
passwordTextEditingController.text = "";
String path = pdfFile.path;

String fileName = path.split("/").last;

 if (fileName.split("-").length > 1) {
        passwordTextEditingController.text = (fileName.split("-").first).trim();
 }

 String password = await Get.defaultDialog(
          title: "Enter Password",
          content: Column(
            children: [
              Text(
                  "If ${fileName} is protected then enter a valid Document Open Password:"),
              SizedBox(
                height: 10,
              ),
              TextField(
                controller: passwordTextEditingController,
              )
            ],
          ),
          onCancel: () => Get.back(result: ""),
          onConfirm: () {
            Get.back(result: passwordTextEditingController.text);
          });

        PdfDocument document = PdfDocument(
            inputBytes: pdfFile.readAsBytesSync(), password: password);

        PdfSecurity security = document.security;
        security.ownerPassword = "";
        security.userPassword = "";

       security.permissions.clear();

        Directory directory = await getTemporaryDirectory();
        String dirPath = directory.path;
        File file = File('$dirPath/${Utils.timestamp()}.pdf');

        List<int> bytes = document.save();
        document.dispose();
        await file.writeAsBytes(bytes, flush: true);
        return file.path;
}

String path = await getPdfPath(pickedFile);
OpenFile.open(path);

We also tried different pdf viewer and open file using open_file plugin but in all pdf QR code showed with yellow background.

Provide one more function to check pdf is password protected or not show, so user we show popup for password input.

Thank you.

@Anand3595
Copy link

Hi @vishwajit76 ,

Please find the details below,

Query: Provide one more function to check pdf is password protected or not show, so user we show popup for password input.
Response: We can determine whether the existing PDF document is password protected or not by catching the exception like below while loading protected PDF document without password.

late PdfDocument document;
try {
  //Load PDF document
  document =
      PdfDocument(inputBytes: await _readDocumentData('encrypted.pdf'));
} catch (e) {
  //Check the error thrown is from encrypted PDF document which is tried to load without password.
  if (e is ArgumentError &&
      e.message.toString() ==
          'Cannot open an encrypted document. The password is invalid.') {
    //Load PDF document with password.
    document = PdfDocument(
        inputBytes: await _readDocumentData('encrypted.pdf'),
        password: 'password');
    //Note: We can get password for this encrypted PDF here.
  } else {
    //Throw error for other cases
    throw e;
  }
}
//Remove password
document.security.userPassword = '';
document.security.ownerPassword = '';
document.security.permissions.clear();
//Save the document
List<int> bytes = document.save();
//Dispose the document
document.dispose();

Please find the sample from https://www.syncfusion.com/downloads/support/directtrac/general/ze/ReadPdfSample-729404296.

Query: PDF QR code showed with yellow background
Response: We cannot able to reproduce this issue in our end with provided PDF documents. Please let us know the below required details to proceed further in this and it will help us to provide prompt solution.

  • Flutter doctor details.
  • Viewer used to open PDF document with OpenFile package.
  • Device details which is used to open PDF document

Regards,
Anand Panchamoorthi

@vishwajit76
Copy link
Author

For qr yellow background

  1. Flutter Doctor
   [√] Flutter (Channel stable, 2.5.2, on Microsoft Windows [Version 10.0.19042.1288], locale en-IN)
    • Flutter version 2.5.2 at F:\Flutter\SDK
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 3595343e20 (3 weeks ago), 2021-09-30 12:58:18 -0700
    • Engine revision 6ac856380f
    • Dart version 2.14.3

[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at F:\Android\SDK
    • Platform android-31, build-tools 30.0.3
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
    ! Some Android licenses not accepted.  To resolve this, run: flutter doctor --android-licenses

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Android Studio (version 4.1)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)

[√] VS Code (version 1.61.2)
    • VS Code at C:\Users\vishw\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.27.0

[√] Connected device (3 available)
    • DN2101 (mobile) • 192.168.183.189:5556 • android-arm64  • Android 11 (API 30)
    • Chrome (web)    • chrome               • web-javascript • Google Chrome 94.0.4606.71
    • Edge (web)      • edge                 • web-javascript • Microsoft Edge 94.0.992.50

! Doctor found issues in 1 category.
  1. PDF Viewer
    (Google Drive PDF Viewer + Microsoft Office PDF Viewer)
    Same QR with yellow background

  2. Device
    OnePlus Nord 2, Xiaomi redmi 6A

And some PDF not opened - #461 (comment)

@Anand3595
Copy link

Hi @vishwajit76 ,

Please find the details below,

Query: Null check exception thrown while removing password from encrypted PDF document
Response:

We have validated the reported issue with “Null check exception thrown while removing password from encrypted PDF document” and it conformed as a defect. We will fix and include it our upcoming weekly release which will be available on 2nd November 2021.

You can track the status of this issue fix by https://www.syncfusion.com/feedback/29763/null-check-exception-thrown-while-removing-password-from-encrypted-pdf-document.

Query: PDF QR code showed with yellow background
Response:

Thanks for the details provided.

We have tried to reproduce the QR barcode image preservation issue with details provided and not able to reproduce in our end. Please find the output PDF screenshots from https://www.syncfusion.com/downloads/support/directtrac/general/ze/samples1936693076.

For further validation, kindly provide more details such as output PDF sample to reproduce the issue on our end. Or else we can have a web meeting to directly look into the issue in your machine and reproduce the issue with proper files and provided the solution at the earliest. Please let us know your availability for a web meeting, we will make every effort to have this scheduled at a time of your convenience.

Regards,
Anand Panchamoorthi

@marcellocamara
Copy link

I've got a similar issue here.

If I have an image resource and set security password at the pdf document, when I open it after enter the password the images got strange colors.

I'll wait the release version, at november 2 👍🏻

@vishwajit76
Copy link
Author

vishwajit76 commented Nov 2, 2021

QR with yellow background not solved in latest release version.
Thank you

WhatsApp.Video.2021-11-02.at.11.11.01.PM.mp4

.

@SF2381
Copy link

SF2381 commented Nov 8, 2021

Hi @vishwajit76 ,

Query: Null check exception thrown while removing password from encrypted PDF document

Response: We have included the fix for an issue with "Null check exception thrown while removing password from encrypted PDF document" into our weekly release with version '19.3.48-beta'. Please check and let us know if you need any further assistance in this.

Query: PDF QR code showed with yellow background

Response: We have tried to reproduce the QR barcode image preservation issue with details provided and still not able to reproduce in our end. As per the issue reported, we have ensured the QR barcode image preservation after removed encryption. But, the reported issue is not reproduced with PDF documents provided. Based on the last video, looks like the issue came from input encrypted PDF document itself.

We can have a web meeting to directly look into the issue in your machine and reproduce the issue with proper files and provided the solution at the earliest. Please let us know your availability for a web meeting, we will make every effort to have this scheduled at a time of your convenience.

Regards,
Anand Panchamoorthi

@vishwajit76
Copy link
Author

Please check below pdf

01011994 -UTI.pdf
pass - 01011994

518079700006153_signed.pdf
pass - 11092003

Yellow background on web & android both platform.

@vishwajit76
Copy link
Author

vishwajit76 commented Mar 8, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants