1

I want to create a pdf file in magento 2.

For that I'm using dompdf from weprovide.

Pdf was generating perfectly but the image was missing. Instead of showing the image it shows an 'Image not found or type unknown'.

enter image description here

I've checked the HTML code that was passed to the dompdf, which has proper image link.

While I'm searching for this issue, somewhere they are mentioned to set options(isRemoteEnabled) for the PDF. Link

So can you help me to solve this issue.

If I want to set options in dom pdf means, how can I integrate that options in weprovide/dompdf code.

Thanks in advance.

0

I've solved this issue by enabling the RemoteEnabled option.

Updated Code:

<?php
namespace WeProvide\Dompdf\Controller\Result;

...
use Dompdf\Dompdf as PDF;
use Dompdf\Options as Options;
...

class Dompdf extends AbstractResult
{
    public $pdf;
    public $options;
    ...

    /**
     * Dompdf constructor.
     */
    public function __construct(PDF $domPdf,Options $options)  {
        $this->pdf = $domPdf;
        $this->options = $options;
    }

    /**
     * Set Option
     */
    public function setRemoteOption()  {
        $this->options->setIsRemoteEnabled(true);
        $this->pdf->setOptions($this->options);
    }

    ....
    ...
}
?>

I've enabled the remote and then set the option for DOM pdf.

I hope this will helpful for someone.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.