Getting the coordinates of a clicked portion in a PDF using ng2-pdf-viewer

I am looking to retrieve the position of an element from a PDF document. I am currently utilizing the ng2pdf viewer for this task.

In my stackblitz example, I am trying to extract the coordinates of the clicked image within the PDF file.

https://stackblitz.com/edit/ng2-pdf-viewer

Is there a way to achieve this using the ng2pdf viewer library in Angular? Any recommendations for other libraries that can accomplish this are also welcome.

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

Answer №1

I'm facing a similar challenge without any knowledge of existing libraries that offer this feature.

One possible solution is to overlay a Canvas on top of the PDF viewer and track cursor positions in relation to the canvas. From there, you can implement a method for the conversion process you've described.

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

Extracting a value from a datetimepicker in Angular 6

Currently employing a datetimepicker within Angular. Once the datetime is chosen, how can I retrieve that value and display it in the paragraph element below? <dl-date-time-picker minuteStep="15" ></dl-date-time-picker> <p class="text-sec ...

Seasonal calendar selector

Currently, I am searching for a Quarterly date picker utilizing ng-bootstrap. Right now, I already have a Month and Year picker, as shown in this STACKBLITZ, but my goal is to switch the Month to Quarter. https://i.sstatic.net/1kWN3.png Can ng-bootstrap ...

Exploring an array of objects to find a specific string similar to the one being

I recently developed a TypeScript code snippet that searches for objects in a list by their name and surname, not strictly equal: list = list.filter( x => (x.surname + ' ' + x.name) .trim() .toLowerCase() .sear ...

Angular CLI version incompatibility has been encountered. This particular version of CLI is specifically designed to work with Angular versions ^13.0.0 || ^13.3.0-rc.0. However, the system detected Angular version 14

After updating my ionic project to Angular 14, everything worked smoothly when running ionic s. However, when I attempted to test it on my android device by running ionic cordova run android, I encountered the following error: [ng] This version of CLI is o ...

Is there a method for executing ng-serve alongside expressjs?

I am currently following an Angular6/Express tutorial. In the tutorial, they utilize the following scripts: "scripts": { "ng": "ng", "start": "ng build && node ./bin/www", "build": "ng build", "test": "ng test", "lint": "ng lint", "e2e ...

Combining JavaScript files into a single JavaScript file with Angular

For my Angular 8 project, I have successfully imported Bootstrap CSS files into my styles.css file using the following code: /* You can add global styles to this file, and also import other style files */ @import "~bootstrap/dist/css/bootstrap.min.css"; @ ...

TypeScript abstract class generics: `Class<?>` type

When working with TypeScript, I often utilize a Java-like type called Class: interface Class<T = void> { new(...args: any[]): T; } Unfortunately, this type doesn't seem to be compatible with abstract classes: abstract class Bar {} class ...

Can an Angular library be imported without utilizing npm?

We have a request from management to integrate a new Angular application into our existing main app. The goal is to develop and deploy the new app independently, without needing to deploy the main app every time. I considered creating a library project th ...

Show information from the state using React and Typescript

I successfully retrieved data from an API using axios and stored it in the state of my React component. However, I am struggling to display this data on the web so that I can list all the information obtained from the API request. I have tried using the ma ...

What is the reasoning behind ngOnInit not being the initial lifecycle hook in Angular?

As a beginner in Angular 2, I'm curious about why ngOnInit is not the initial hook called after a component or directive's constructor? Reference: https://angular.io/docs/ts/latest/guide/lifecycle-hooks.html https://i.sstatic.net/aDJ5l.png ...

Error TS2307 - Module 'lodash' not found during build process

Latest Update I must apologize for the confusion in my previous explanation of the issue. The errors I encountered were not during the compilation of the Angular application via Gulp, but rather in the Visual Studio 'Errors List'. Fortunately, I ...

Adding a component to a grid row with a click action

I have a grid of items and I want to display another component that takes up the full width below the clicked item when it's selected. Here is an illustration of what I'm trying to accomplish: https://i.sstatic.net/5XIvf.png Within my button-li ...

What is the best method for incorporating a variable into an Ionic iframe?

Can anyone help with integrating a variable into an Ionic iframe? <ion-content> <iframe src="http://local/server_api/pr.php?p={{insert-variable-here}}" style="width: 100%; min-height: 100%; height: 100%;" frameborder= ...

KeysOfType: Identifying the precise data type of each property

I came across a solution called KeysOfType on a post at : type KeysOfType<T, TProp> = { [P in keyof T]: T[P] extends TProp? P : never }[keyof T]; Here are the interfaces being used: interface SomeInterface { a: number; b: string; } interface A ...

Navigating to different HTML pages by utilizing <a> elements in Angular 2

As a newcomer to Angular 2, I've decided to build my personal website using this framework. The main page of my website contains bio information, while the other page will feature blog content. Both pages will have a shared header and footer, but diff ...

Send information to the child.component.ts file, not the child template

A scenario I am working on involves passing a value from a parent component to a child component. However, prior to displaying this value in the child.component.html file, I have a requirement to increment it by 2 within the app.component.ts file, and then ...

Tips for effectively generating a JSON object array in Typescript

Currently, I'm attempting to construct an array of JSON objects using TypeScript. Here is my current method: const queryMutations: any = _.uniq(_.map(mutationData.result, function (mutation: Mutation) { if (mutation && mutation.gene) { co ...

What is the correct way to interpret a JSON file using TypeScript?

Encountering Error Error TS2732: Cannot locate module '../service-account.json'. It is suggested to use the '--resolveJsonModule' flag when importing a module with a '.json' extension. import serviceAccountPlay from '../ ...

Angular 8: Monitoring the inner element within a component that is not directly accessible

I added the MuiOrgChartModule to display my nested data in a tree view, but I can only access the entire element like this: <mui-org-chart #chart (itemClick)='showOuManagementDialog($event)' [topEmployee]="displayOuResult" direction="vertical ...

Creating a subtype in typescript involves specifying values for certain fields and getting rid of any optional members in the type definition

interface Person{ name:string, age:number, gender?:string } interface Employee extends Person{ name='John Doe', age:number } I am trying to achieve the above structure for a person and employee in TypeScript. I am also curious if something simi ...