Support PDF (hosted)
See original GitHub issueFeature request
Currently we can add images to our documents. But would be great to also be able to add PDF documents.
What problem does this feature solve?
We could add a PDF to our documents - which are common when creating knowledgebase style websites
How should this be implemented in your opinion?
In createBaseConfig.js , change the rule so it transfers PDFs to the assets as well as images
(Not tested this, but think that that is the code that needs extending)
config.module
.rule('images')
.test(/\.(png|jpe?g|gif)(\?.*)?$/)
.use('url-loader')
.loader('url-loader')
.options({
limit: inlineLimit,
name: `assets/img/[name].[hash:8].[ext]`
})
Are you willing to work on this yourself?
No
Issue Analytics
- State:
- Created 5 years ago
- Reactions:7
- Comments:14
Top Results From Across the Web
The 7 Best Tools to Present and Share Your PDF Files Online
The 7 Best Tools to Present and Share Your PDF Files Online · 1. Scribd · 2. Google Drive · 3. Box ·...
Read more >PDF Host - Free PDF Hosting
Upload, Store and Share your PDF documents instantly, for free, forever! No accounts or email addresses required. ... PDF Host is a completely...
Read more >PDF Upload - Tiiny Host
Tiiny Host is a simple tool to upload and host your PDF online. Sharing your PDF online can be complicated. With Tiiny Host,...
Read more >Where can I host a PDF online, so I can send people a link ...
Yes, you can Host your PDF file for free of cost, there are lots of websites where you can find PDF and Image...
Read more >Online PDF Hosting — Upload PDF to FlippingBook with Ease
You can upload, host, and share PDFs with any of our products. Choose the one that answers your needs best! Flippingbook Online. A...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I encountered the same problem and have finally worked out a solution.
The solution
Add the following in
.vuepress/config.js
:How I found it
What I need is to have some pdf documents along side the markdown files, and can be linked from markdown files.
For example, say I have a
xxx.md
and I would like to link to ayyy.pdf
just beside it like it’s a natural part of the document, not to place it underassets
orpublic
.I can’t get this to work in plain vuepress. After some search, I found this issue and what vuepress did for images, fonts etc. in https://github.com/vuejs/vuepress/blob/master/packages/%40vuepress/core/lib/webpack/createBaseConfig.js :
So I add the following in
.vuepress/config.js
:It should work like images but it didn’t.
But if I link to the pdf as an image somewhere in a markdown file, then it works ( pdf is copied to the some directory structure due to the
[path]
in optionname
).I used this image hack for a while, until I found https://github.com/vuejs/vuepress/issues/826 and noticed https://github.com/vuejs/vue-loader/blob/master/docs/zh/guide/asset-url.md and realized what made images special, it’s not something in vuepress but vueloader.
Combine these two options together, it worked. I don’t know if there’s any side effects yet, but it doesn’t seem to affect how vuepress handles markdown file links.
Hope it helps.
@chryw My solution here is generic: to “select what files webpack should copy”, just change
.test(/\.pdf$/)
to any path regex.