[wp-trac] [WordPress Trac] #39216: PDFs with non-opaque alpha channels can result in previews with black backgrounds.

WordPress Trac noreply at wordpress.org
Fri Dec 9 21:05:48 UTC 2016


#39216: PDFs with non-opaque alpha channels can result in previews with black
backgrounds.
--------------------------+-----------------------------
 Reporter:  gitlost       |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Media         |    Version:  4.7
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 If a PDF has a non-opaque alpha channel it can result in a black
 background when rendering the preview. Attached is a real-world example
 and also a simple blank(ish) test pdf.

 One way around this is to use the `Imagick::ALPHACHANNEL_REMOVE` mode of
 `setImageAlphaChannel()`, as in the attached patch, added as an extra
 `pdf_process()` method in view of #38832. The unittest requires the blank
 test pdf to be uploaded to the test data images directory.

 The blank test pdf was generated using TCPDF (https://tcpdf.org):

 {{{
 #!php
 <?php
 $dirname = dirname( __FILE__ );
 $tcpdf_dirname = $dirname . '/tcpdf';
 require $tcpdf_dirname . '/tcpdf.php';

 $pdf = new TCPDF();
 $pdf->AddPage();
 $pdf->SetAlpha(0);
 $pdf->Output( $dirname . '/test_alpha.pdf', 'F' );
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/39216>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list