Showing pdf documents without relying on third-party software

Within my Angular application, I have integrated the following snippet into an HTML template:

<embed src="../assets/AOK_T2DM.pdf" style="width: 100%;height: 500px" type="application/pdf">

The representation of this code is as seen below:

https://i.sstatic.net/AXV5t.png

Upon clicking on 'open', the PDF file undergoes a download process.

Is there a method to simply exhibit the content rather than initiating a download?

Answer №1

<iframe src="https://docs.google.com/viewer?url=https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf&embedded=true" frameborder="0" height="600" width="100%"></iframe>

Here is the code to embed a PDF using Google Docs Viewer:

<iframe src="https://docs.google.com/viewer?url=File_URL&embedded=true" frameborder="0" height="1100px" width="100% "></iframe>

You can adjust the height based on your requirements or set it to 100% and manage the height of the parent div accordingly. Test it out and make any necessary adjustments.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Is it possible to obtain Literal types for object keys dynamically in typescript?

I am looking to extract the type of object keys. Below is a generic function for objects with keys as strings: type GenericInput = { [key:string]: {value:string,type:HTMLInputTypeAttribute,placeholder:string,min?:number,max?:number,required?:boolean, err ...

Update the router URL without switching pages, yet still record it in the browser history

One of the features on my search page allows users to perform searches and view results. Initially, I faced a challenge in updating the router URL without navigating, but I managed to overcome this by utilizing the "Location" feature. In my ngOnInit meth ...

A guide on resolving deprecated warnings for typographical errors

Every time I try to npm install I am bombarded with numerous errors. typings WARN deprecated 9/9/2016: "registry:dt/node#6.0.0+20160831021119" is deprecated (updated, replaced or removed) My experiences with typescript have been nothing but a series ...

Could there be a coding issue stopping <div class="rating"> from aligning more centrally along the horizontal axis on the screen?

Just wondering, could there be something in my code that's preventing <div class="rating"> from moving closer to the center? And is there a way to make it move closer horizontally? (On a side note, CSS layout and positioning still puzz ...

Tips for incorporating Response_type id_token+code into a login URL within an Angular application through the MSAdal library

We are currently utilizing the msadal library for Azure ad B2C login. I am now looking to include the response_type in the URL https://login.microsoftonline.com/common/oauth2/authorize when a user logs in. Here is the code being used for login: if (!this ...

Tips for substituting @media (max-width) with Stylish or Greasemonkey?

I am encountering an issue when trying to access this specific website on my desktop browser. The site has a responsive/fluid design that switches to displaying a mobile menu button instead of a horizontal nav-bar when the browser width is less than 990px. ...

Issue with 'else if' statement in React Typescript: Unneeded 'else' block following 'return' statement

I am encountering an issue with the else if statement below. Even after removing the last pure Else statement, I am still getting an error on ElseIf from Lint. How can I fix this problem? Error message: Unnecessary 'else' after 'return&apo ...

To grab a specific CSS attribute from a stylesheet using JavaScript

I am looking for a way to extract the value from a CSS file using a JavaScript function. Take a look at my code snippet below: HTML file -> <link rel="stylesheet" type="text/css" href="test_css.css" /> <script type="text/javascript ...

Alignment problem detected in Firefox and Safari, but works perfectly in Chrome

Currently dealing with a CSS problem on my website that is only appearing in Safari and Firefox, while Chrome displays it correctly. The images are not positioning correctly and are stacking instead of being placed in each box as intended. I've expe ...

Dependency mismatch in main package.json and sub package.json

Imagine you have a project structure in Typescript set up as follows: root/ api/ package.json web/ package.json ... package.json In the main package.json file located in the root directory, Typescript is installed as a dependency to make ...

Choosing between running a single unit test or multiple tests using Karma toggle switch

Currently, I am working on writing unit tests using the Karma/Jasmine combination and I'm curious if there's a way to target a specific spec file for testing instead of running all the spec files in the files array defined in the karma.conf.js fi ...

Is it possible for an Angular App to function as an authenticated user for a real-time database?

Just a question, no code included. I want to restrict access to reading from RTDB only to authenticated users. However, I don't want every user to have to sign up individually. Instead, I would like to have one login tied to the angular app that auto ...

Tips for automatically scrolling to the bottom of a page and focusing on an iframe

My website features a large banner image with content followed by an embedded YouTube video within an iframe. While the webpage is responsive, on mobile devices the header appears too big and users have to scroll down to see the video. I want the webpage ...

Utilizing the component within the template could potentially result in a cyclical dependency if it were to be imported

I have encountered an issue with two components that reference each other in a recursive manner. Ever since I upgraded to Angular 13, I am unable to use it and I keep receiving the error mentioned in the title. Component A (field.component.html): <app- ...

Differentiate various collections of shapes

My application has a specific workflow: 1) Next to the name of Patient X, there is a "Check In" button. Once clicked, this action is recorded on the server side. 2) Upon clicking the "Check In" button, a dropdown menu appears with various locations for t ...

I am experiencing some difficulty with the GetServerDate using the JSON protocol in JQuery; it's

I am facing an issue while trying to execute a basic ajax call to fetch data from a file on a server. Even though I can access the file via the web browser and have diligently followed tutorials related to this topic, I have hit a dead end. Here is the sn ...

The z-index of the React Apex Chart toolbar menu icon is too high. Is there a way to decrease it?

Is there a way to adjust the z-index value of the icons within React Apexchart's toolbar menu? Even when I position my element at a higher level, they remain on top of it. ...

Tricks to access value from a Nativescript array of Switch elements when tapping a Button

Scenario: In my project, I am using Nativescript 5.0 with Angular. The data is fetched from an API and displayed in customers.component.ts I am successfully rendering the elements based on the received IDs in customers.component.html When the user inter ...

Limit the covariance of properties in generic arguments

When I define a generic argument of object type with specific mandatory properties (for example, in this function it requires the object to have timestamp: string), TypeScript allows for using a more specialized attribute type as a generic argument - as sh ...

Tips for implementing fluid transitions between mouse X and Y coordinates using JavaScript

I recently developed a function that enables a DOM element to follow the mouse cursor. You can check out the code here. Currently, I am looking for suggestions on how to add a nice animation to this feature. Ideally, I want to incorporate a slight delay w ...