WebAssembly |
This installation guide will guide you trough all the needed steps to get started with ASP.NET Core PDF Viewer. Please make sure to follow the instructions depending on the technology you're using in your project.
In your HTML section of the page, you will need to add 2 CSS links.
File location: wwwroot\{YOUR_PAGE}l (e.g. indexl)
<link rel="stylesheet" href="/_content/Terminalworks.PdfViewer.AspNetCore/css/tw-pdf-viewer.css" /> <link rel="stylesheet" id="tw-web-theme" href="/_content/Terminalworks.PdfViewer.AspNetCore/css/themes/light/tw-pdf-viewer-theme.css" />
tw-pdf-viewer.css is a general CSS of TWPdfViewer and we recommend that you don't change it.
tw-pdf-viewer-theme.css is theme specific.
You can read more about changing theme at Changing the theme
Our CSS must be loaded before our tw_viewer.js.
Add needed Javascript as shown in the example below
File location: wwwroot\{YOUR_PAGE}l (e.g. indexl)
<body> <!-- your other body content --> <script src='/_content/Terminalworks.PdfViewer.AspNetCore/js/pdf.js'></script> <script src='/_content/Terminalworks.PdfViewer.AspNetCore/js/tw_viewer.js'></script> </body>
Add the component to your page
File location: Pages\{YOUR_PAGE}.razor (e.g. Index.razor)
@using TWWebCorePdfViewer.Pages.Shared; <TWPdfViewer IsStatic="@("Yes=")" />
For examples how to set initial parameters look at Viewer options