0

I have tried to enable the pdf extension in the editor this way https://developersushant.wordpress.com/2015/04/16/magento-enable-pdf-extension-on-wysiwyg/.

Although, this file there is not in the directory it described.

Has anyone tried to do something like this?

Do you know any other (free) way to insert pdf attachments in products?

Thanks for your help.

1
  • The URL which you mension above is for Magento 1. You are asking question for Magento 2. Oct 27 '17 at 10:25
0

In Magento-2 you need to do this things using custom extnsion.

Create di.xml file in your custom extension. The path of file something like this.

app/code/NAMESPACE/EXTENSION/etc/di.xml

Add the following code.

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Magento\Cms\Model\Wysiwyg\Images\Storage">
        <arguments>
            <argument name="resizeParameters" xsi:type="array">
                <item name="height" xsi:type="number">75</item>
                <item name="width" xsi:type="number">100</item>
            </argument>
            <argument name="extensions" xsi:type="array">
                <item name="allowed" xsi:type="array">
                    <item name="jpg" xsi:type="number">1</item>
                    <item name="jpeg" xsi:type="number">1</item>
                    <item name="png" xsi:type="number">1</item>
                    <item name="gif" xsi:type="number">1</item>
                    <item name="pdf" xsi:type="number">1</item>
                </item>
                <item name="image_allowed" xsi:type="array">
                    <item name="jpg" xsi:type="number">1</item>
                    <item name="jpeg" xsi:type="number">1</item>
                    <item name="png" xsi:type="number">1</item>
                    <item name="gif" xsi:type="number">1</item>
                </item>
                <item name="media_allowed" xsi:type="array">
                    <item name="flv" xsi:type="number">1</item>
                    <item name="swf" xsi:type="number">1</item>
                    <item name="avi" xsi:type="number">1</item>
                    <item name="mov" xsi:type="number">1</item>
                    <item name="rm" xsi:type="number">1</item>
                    <item name="wmv" xsi:type="number">1</item>
                    <item name="pdf" xsi:type="number">1</item>
                </item>
            </argument>
            <argument name="dirs" xsi:type="array">
                <item name="exclude" xsi:type="string"/>
                <item name="include" xsi:type="string"/>
            </argument>
        </arguments>
    </type>
</config>

Clean cache using this command :

php bin/magento cache:clean

Now check your Editor.

7
  • not working...! Mar 1 '18 at 9:02
  • Aftr implementing above things, please run caching command and then check. Mar 1 '18 at 9:08
  • i done that but still not working got this message "unsupported image format" Mar 1 '18 at 9:42
  • This code apply in my custom module but not working. get error unsupported image format. Oct 30 '20 at 2:45
  • @JigarPatel which Magneto Version you are using currently? Oct 30 '20 at 4:25

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.