We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Aspose for online PDF mapping

Hello,

We have a couple of PDF documents in our online software that we allow our customers to map dynamic custom data to overlay on the PDF. Currently, our mapping system requires the user to enter X,Y coordinates to map data. We are looking into being able to draw regions with a mouse where data from our online application would overlay.

It seems like this might be possible with a combination of Aspose.PDF and Aspose.HTML, but I couldn’t quite tell.

Any clarity that could be provided would be helpful.

@nathanbartell

I have observed your comments. Can you please share more details along with some sample so that I may investigate this on my end to help you out.

@Adnan.Ahmad - Thank you for your reply!

To be clear - we have not purchased Aspose yet.

We currently have a web interface that is simple text boxes requesting X,Y coordinates to overlay custom data on a pdf. Sometimes the PDF is blank, sometimes it’s a form. Using X,Y coordinates is clunky as you can imagine. You enter X,Y values, preview the PDF to see where the data is overlayed, and then adjust X,Y values accordingly.

What we would like to do is give our users the ability to draw boxes on the screen with their mouse where they would like data to overlay. We need to be able to capture the region drawn by the user.

Does this make sense? And this is something that the Aspose suite of tools could help us accomplish? I’ve been playing around with the Aspose online pdf editor to see if the functionality exists but was unable to find anything that would allow me to draw regions on the PDF.

Thank you for helping, @Adnan.Ahmad

@nathanbartell

Thanks for elaborating further.

The editor application uses to convert PDF pages into images and displays converted images in HTML Canvas for further operations (e.g. stamping, annotating, commenting, etc.). This is for demonstration of some features which can be implemented using Aspose.PDF for .NET in code-bhind.

Regarding your original requirement (i.e. draw boxes on the screen with mouse and capture the coordinates to use in PDF for adding text), mouse coordinates can be captured using following formula. Please note that pdfx is x coordinate inside PDF file and pixelX is mouse X coordinates over screen.

pixelX = (pdfX/72)* DPI
pdfX = pixelX * 72 / DPI

Where DPI is screen resolution and usually its 96 can be calculated programmatically.

[C#]

float dpiX, dpiY;
Graphics graphics = this.CreateGraphics();
dpiX = graphics.DpiX;
dpiY = graphics.DpiY;
Console.WriteLine("DPIx = " + dpiX + " DPIy " + dpiY);

You can notice in the above code that resolution is considered as 96dpi which cannot be considered for sure in case of the web applications as they can be used on screens with different resolutions. Nevertheless, an investigation ticket as PDFNET-36826 has already been logged in our issue tracking system to determine whether this functionality can be achieved or not i.e. Convert mouse coordinates to pdf units.

We have linked the ticket ID with this forum thread so that you will be notified as soon as it is resolved. Please be patient and spare us some time. In case you need further assistance or have any other inquiry, please feel free to let us know.

Thank you for your response!

I’m working on a proof of concept for this to show my managers so we can move forward with a purchase. Could you possibly send links code snippets or documentation that might help me get up and running quickly?

Thank you for your time.

@nathanbartell

You can surely check the Developer Guide of Aspose.PDF for .NET where you can find various examples and articles related to functionality that API provides.