packages.flutter icon indicating copy to clipboard operation
packages.flutter copied to clipboard

[pdfx] some pdf files are really slow to render

Open Arcturus5404 opened this issue 7 months ago • 0 comments

Describe the bug Some PDF files are really slow to render images from. I have included a PDF that takes a really long time per page to render: https://www.dropbox.com/scl/fi/hoo4fq0crfq6v4wcxg7g4/Kerstdeken-2022-met-kerstmis.pdf?rlkey=vp1zq12f4dsdm4k0d1jwqc741&st=quuyukt7&dl=0

To Reproduce Steps to reproduce the behavior:

Open the PDF

  final document = await PdfDocument.openFile(file.path);
  var page = await document.getPage(1);

  var size = 5464;
  var width = ((page.width / page.height) * size);
  var height = size;

// The following step takes at least 20 to 30s to render
var pageImage = await page.render(
    width: width,
    format: PdfPageImageFormat.jpeg,
    height: height,
  );

Expected behavior Fast render of the image, like how it was in version 2.5.0

For now I reverted back to the 2.5.0 with the Decoder issue fix, which does render the image quickly as opposed to the 2.6.0 release:

  pdfx: # See https://github.com/ScerIO/packages.flutter/issues/448 
    git:
      url: 'https://github.com/ScerIO/packages.flutter'
      ref: '4be9de9ffed5398fd7d5f44bbb07dcd3d3f1711b'

Smartphone (please complete the following information):

  • Device: iPhone14
  • OS: emulator 17.5.1

Additional context It seemed to work in the past, so I think it has to do with the 2.6.0 upgrade

Arcturus5404 avatar Jul 09 '24 07:07 Arcturus5404