Hello it's me again
I'm a french student and I'm actually trying to learn how to use Magento 2. I'm actually trying to put 2 pdf in my module that i can open in a certain page but i can't do it, i can only display them by putting them in the media folder but it's not very good for what i have to do can someone explain me how i can use them since my module folder please.
Solved! Go to Solution.
Add pdf file in your module,
app/code/{Vendor}/{Modulename}/view/adminthml/web/pdf/custom1.pdf app/code/{Vendor}/{Modulename}/view/adminhtml/web/pdf/custom2.pdf
Then do static content deploy.
If works then mark as solution.
You can add your pdf in your custom module.
Add pdf file in your module,
app/code/{Vendor}/{Modulename}/view/frontend/web/pdf/custom1.pdf app/code/{Vendor}/{Modulename}/view/frontend/web/pdf/custom2.pdf
now run command for deployment,
php bin/magento setup:static-content:deploy
Now you can use your pdf file in any template file like this,
$pdf1 = $block->getViewFileUrl('Vendor_Modulename::pdf/custom1.pdf'); <a href="<?php echo $pdf1;?>">pdf1</a> $pd2 = $block->getViewFileUrl('Vendor_Modulename::pdf/custom2.pdf'); <a href="<?php echo $pdf2;?>">pdf1</a>
Please let me know if you have query.
If solutions helpful, click Kudos and Accept as solutions
Thanks for your answer
after a try i have an error 404 here is the url link given by the href of the pdf
mymagentofile/pub/static/version1499066266/adminhtml/Magento/backend/en_US/Vendor_Modulename/pdf/custom1.pdf
Add pdf file in your module,
app/code/{Vendor}/{Modulename}/view/adminthml/web/pdf/custom1.pdf app/code/{Vendor}/{Modulename}/view/adminhtml/web/pdf/custom2.pdf
Then do static content deploy.
If works then mark as solution.
It work thanks you very much Sunil and Rakesh