Product: Server SDK
Product Version:11.3
Please give a brief summary of your issue:
(Think of this as an email subject)
Is there an API to add a scale in the PDF SDK?
We’re currently using:
_PDFView.ConvScreenPtToPagePt(ref downX, ref downY, _PageNumber);
to calculate the distance between points. It would be really helpful if there were a built-in API for applying and managing scale, similar to what’s available in the WebViewer.
Please describe your issue and provide steps to reproduce it:
(The more descriptive your answer, the faster we are able to help you)
Please provide a link to a minimal sample where the issue is reproducible:
1 Like
Hello, I’m AiRon, an automated tech support bot 
While you wait for one of our customer support representatives, I can help you with your question.
In Apryse’s PDF SDK for .NET, there isn’t a direct API specifically designed to manage measurement scales like in WebViewer. However, you can achieve similar functionality by leveraging the existing APIs for coordinate conversion and custom annotation tools. The
PDFView
class provides methods like
ConvScreenPtToPagePt
for converting screen points to page points, which can be used to calculate distances and apply custom scaling logic.
Some things you can try:
- Use
PDFView.ConvScreenPtToPagePt
to convert screen coordinates to page coordinates, and then apply your own scale factor to calculate distances.
- Create a custom annotation tool that allows users to set a reference scale on the PDF document, which you can then use to scale measurements.
- Consider implementing a custom user interface element that allows users to define a scale (e.g., 1 inch = 10 feet) and apply this scale to distance calculations.
Here are some resources that might help you:
- Apryse WebViewer Measurement Tools - Although this is for WebViewer, it can provide insight into implementing similar tools in .NET.
- SDF / COS Object Model - Learn about low-level PDF manipulation, which might be useful for creating custom measurement tools.
- Annotations Guide - Useful for creating custom annotations to represent scales or measurements on the PDF.
- PDFViewWPF Sample - Example of using PDFView in a WPF application, which can be extended to include custom measurement logic.
Hopefully, this helps you solve your problem while you wait for a human to get back to you.
1 Like
Hello,
Thank you for reaching out!
Could you clarify further which kind of scale you are looking to add?
Are you looking to add an annotation that displays the measurement? or are you looking to manipulate the scale of the page or area?
We appreciate your patience and clarifications while we look into this.
Currently we are trying to add an annotation that displays the measurement. I am able to find the distance between the points using this _PDFView.ConvScreenPtToPagePt(ref downX, ref downY, _PageNumber);
would like to get the inches conversion which i can display on the annotation which i am drawing. Is there helper function or API available?