i cant open pdf file in angular
i have a local path and i need to open the file in a new tab
i try to do that with _blank and it not worked
thanks !
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Rajanikant HawaldarRank #110 · 20.2K reputationPosted Jan 29, 2020, 3:23 AM EST
Marvin ReidRank #1,963 · 746 reputationPosted Feb 7, 2023, 3:07 PM EST
You can load a PDF using the DocumentFactory loadFromUri method in Angular. You can then view the pdf using a DocumentViewer object. Here is a snippet of the code which highlights this from the below example.
loadDefaultDoc = async (viewer, interactiveSelect) => { try { const url = https://demo.leadtools.com/images/pdf/leadtools.pdf; let doc = await lt.Document.DocumentFactory.loadFromUri(url, null); doc.isReadOnly = false; viewer.setDocument(doc); } catch (error) { console.error(error) }https://www.leadtools.com/help/sdk/tutorials/html5-js-display-files-in-the-document-viewer.html
https://www.leadtools.com/help/sdk/v22/dh/javascript/doxui/documentviewer.html
Naimish MakwanaRank #324 · 7.7K reputationPosted Feb 8, 2023, 12:37 AM EST
If Window.Open() with _balnk not working than you can try with Iframe.
EX:
pdfUrl = '/path/to/your/file.pdf';Thanks
Naimish Makwana