![]() To do so, we can use the Cache API, store our File as Request in there using our URL, and then retrieve that File from the Cache in the ServiceWorker. Now, there are cases it can't be done, and for these, there is a convoluted way, which might not work in future versions of Chrome, and probably not in other browsers, requiring to set up a Service Worker.Īs we first said, Chrome parses the URI in search of a filename, so what we have to do, is to have an URI, with this filename, pointing to our blob:// URI. So if your original URI contains that filename, the easiest might be to simply make your 's data to the URI you fetched the pdf from directly, instead of going the Blob's way. Click on Appearance from the left, click on the drop-down bar beside the Font. To increase font size in Chrome, follow the steps given below: Open Google Chrome, click on the menu button and select Settings. ![]() If still the fonts in Chrome appear too small, then changing font size in Chrome can fix it. If it helps, the response has the following relevant headers: Content-Type: application/pdf charset=utf-8Ĭontent-Disposition: attachment filename*=utf-8''Invoice%2016246.pdf Ĭhrome's extension seems to rely on the resource name set in the URI, i.e the file.ext in protocol://domain/path/file.ext. Solution 3: Change The Font Size In Chrome. Now, under the 'Redirect URL' enter the website you want the New Tab page to redirect to. Is there any way, using native Javascript (including ES6, but no 3rd party dependencies other than Vue), to set the filename for a blob / object element in Chrome? After the extension finishes installing, click the New Tab Redirect icon and then select 'Extension options.' If the icon isn't on the extensions bar, click the Menu icon, select the extension, and then click on 'Extensions options' to open up the settings. The viewer and file name work as I'd hoped in Firefox it's only Chrome in which the file name is not used. ![]() However, in Chrome, the file name that I provide (here, my-file-name.pdf) is not used: I see a hash in the title bar of the PDF viewer, and when I download the file using either 'right click -> Save as.' or the viewer's controls, it saves the file with the blob's hash ( cda675a6-10af-42f3-aa68-8795aa8c377d or similar). The browser then displays the PDF using the PDF viewer. Then I display it by setting that URL as the data attribute of an object element. I convert it to a file, and generate an object url: const blobFile = new File(, `my-file-name.pdf`, ) In my Vue app I receive a PDF as a blob, and want to display it using the browser's PDF viewer.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |