Support » Plugin: PDF Thumbnails » program generates blank thumbnails

  • Resolved mohamed.belhassen

    (@mohamedbelhassen)


    Hi,

    For some PDF documents, the plugin generates blank thumbnails.

    You can see the problem in this image (https://goo.gl/miWJLg)

    After a manual replacement of the image thumbnail, my website show the image correctly (see https://goo.gl/2KycJ6)

    Note that the inserted pdf that cause the problem are not password protected (see example here https://goo.gl/VmAvPd)

    I checked the log of my websites and did not noticed new entries.

    Could you please assist me to resolve this problem?

    Cordially,
    Mohamed

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author stianlik

    (@stianlik)

    I can try. Do you have a PDF available for testing? It’s hard to pinpoint the reason before I’m able to reproduce the problem. It could be related to the file size, is this a large PDF? The code I use to generate a thumbnail is as follows:

    $imagick = new Imagick($filename);
    $imagick->setIteratorIndex(0);
    $imagick->setImageFormat('jpg');
    return $imagick->getImageBlob();
    

    Other than that, it’s mostly just code to update metadata for WordPress, not directly related to image generation.

    Image generation can be overridden by the pdf_thumbnails_generate_image_blob filter as described under developer API for this plugin. If you feel confident coding PHP, I suggest using that filter and see if you can figure out how Imagick handles the uploaded files that are failing, maybe you can get some useful debugging information from there.

    • This reply was modified 3 years, 1 month ago by  stianlik.

    Dear stianlik,

    In my post, I have already given a sample of pdf that generates the problem (third link).
    As you can see it is a small file (less than 1 MB).

    Cordially,
    Mohamed Belhassen

    Plugin Author stianlik

    (@stianlik)

    Than you. I can confirm that I’m getting the same error on my side. Will look into the issue.

    Plugin Author stianlik

    (@stianlik)

    The problem is that the PDF does not have a background, and the transparency is rendered as black. I did not find any good solutions to handle this type of PDF, other than saving the PDF with a white background before uploading. You can observe the same problem by using ImageMagick in the command line:

    `
    convert 275_tp1_integration_web_statique_html_css.pdf[0] foo.jpg
    `

    Currently, it does not seem to be a good solution that handles these PDFs using imagick. I was able to avoid the issue by opening the file in a PDF-editor and setting page background to white. Marking the issue as resolved.

    mohamed.belhassen

    (@mohamedbelhassen)

    Dear Stialik,

    Coould you please mention the name of the PDF editor that let us modify the backgroud?
    I am using Foxit Reader but no similar option is available.

    Cordially,
    M.B

    Plugin Author stianlik

    (@stianlik)

    For the first test, I opened the file using LibreOffice, set background to white and saved the file. However, LibreOffice did not handle the PDF too well, some of the text got scrambled. It looks like the PDF originally was generated using Word, so it may be possible to fix the background using Word.

    In my second test, I simply opened the PDF using Evince, and chose print to PDF, and uploaded the “printed” file. Evince gave good results. I’m testing on Linux, but I assume there is similar functionality in Windows or OSX.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘program generates blank thumbnails’ is closed to new replies.