Extract DXF Entities and transform their XY coordinates to PDF XY Coordinates

I need to manipulate an existing PDF by looking at some Text, Mtext, Circle, and Line entities within a DXF file. The location(s) of these entities need to be translated to PDF coordinates to compare to existing PDF coordinates in a related PDF file. With this question, I am extracting data from the DXF file, I already have the PDF data I need (so this is not an Apsose.PDF question). I already successfully extract these entities, it’s method(s) to apply to them, if they exist, I am looking for.

@REDiehlAssoc

To keep progress on this scenario (“Extract DXF Entities and transform their XY coordinates to PDF XY Coordinates I need to manipulate an existing PDF by looking at some Text, Mtext, Circle, and Line entities within a DXF file. The location(s) of these entities need to be translated to PDF coordinates to compare…”), start by validating the hypothesis around Input Document.docx: PDF Accessibility Removing Colors from Input fields Hello Aspose Support Team, We are currently testing PDF conversion using Aspose.Words version 22.5.0.0 and have encountered an issue related to color preservation in the out… (source: docs.aspose.com).

This is a best-effort explanation based on partial or unverified information because No retriever returned supporting documents yet and Only low-trust or forum sources were retrieved; please validate it against official documentation once supporting evidence is available.

Checklist / next steps:

  • Input Document.docx (docs.aspose.com): PDF Accessibility Removing Colors from Input fields Hello Aspose Support Team, We are currently testing PDF conversion using Aspose.Words version 22.5.0.0 and have encountered an issue related to color preservation in the out…
  • Apsose.PDF usage (question): Inspect recent commits or release notes for changes to this API’s defaults or layout behaviour.
  • Share these hypotheses with support engineers alongside logs, code samples, and the exact SDK version so they can confirm the behaviour.
  • Question summary: Extract DXF Entities and transform their XY coordinates to PDF XY Coordinates I need to manipulate an existing PDF by looking at some Text, Mtext, Circle, and Line entities within a DXF file. The location(s) of these entities need to be translated to PDF coordinates to compare…

@REDiehlAssoc,
Hi,
I’m afraid we need more information what exactly you need. DXF coordinates and PDF coordinates are different and may depend the conditions PDF was created on. Was the PDF file created from DXF, or they have no relation? Could you please share some numerical example of PDF, DXF, what is the result of entities extraction from DXF and what exactly you need?

I am looking to add annotations to a PDF. The location/size of these annotations are based upon the coordinates of different shapes that appear in the PDF.

It is difficult (read: impossible) to divine shape location in a PDF.

The PDF and the DXF that I want to read come from a single, original architectural drawing.

Aspose has software that converts DXF to PDF, so obviously Aspose is in possession of the code that translates the entire contents (individual entities, blocks, etc.) of a DXF to PDF.

When I retrieve entity data, for example for a ‘Circle’, I get a XY location and a radius.

Aspose.PDF has a ‘Transform’ method that will allow a person to remap from one coordinate system to another.

A PDF page that is 42" x 30" would give us a rectangle ranging from (0,0) in the lower-left to (3024,2160) in the upper-right. This is calculated using 72 points-per-inch.

I have a DXF that uses -(I think)- (-5702.096616,-462.935871) for the lower-left and (-78.88380417,4814.371422) for the upper-right.

It is relatively trivial using Y = aX + b to develop the translation:

(See attached image) … OK, I thought we could add images, maybe not. :roll_eyes:

I am not so sure this is correct, unless it is and $EXTMIN values, in this case, (-5702.096616,-462.935871), and $EXTMAX values (-78.88380417,4814.371422) really do map to the corners, or if there is a margin of some kind that I am missing.

On the same drawing, the $LIMMAX values are (12,9) and the $PEXTMAX values are (42,30).

So, the core of my question is: Does Aspose have a function -available to customers- within Aspose.CAD that does the ‘aX+b’ etc. calculations for per entity? You obviously do, since you can write PDFs, but is it available to customers?

@REDiehlAssoc,
Well, this is an interesting question :slight_smile: I believe the answer is “no”, we don’t have such a function neither in public API nor directly internally. If you create the simple DXF drawing with circle entity and make it blocked, you will see that the real center of the circle (which you are going to map to PDF) is not stored in DXF file directly anymore - all transformations of the block should be applied to calculate it. The same works for circle inside two or more blocks :slight_smile: So our internal processing includes all of this as well as a lot of other various nuances for different entities, and we care about DXF coordinates, not PDF. We also use transformation matrices in some cases instead of calculation final coordinates. Please note that this is just first brief idea, I guess it will be more complexities with such mapping in practice.