DomCR / ACadSharp

C# library to read/write cad files like dxf/dwg.
MIT License
415 stars 116 forks source link

HELP WANTED: How to convert cadDocument into a pdf file. #391

Open KyleeChangg opened 3 months ago

KyleeChangg commented 3 months ago

As the title suggests, I currently have a cadDocument but cannot find in the documentation how to convert this document into a pdfFile. Any help would be appreciated, thanks!

DJGosnell commented 3 months ago

It is a complicated process and to my knowledge, there is no public .NET solution for this, which is why my company needed to create this system from scratch. Our system uses SKIA as the PDF creation engine.

The process is as follows: Convert all the simple objects to their equivalent SKIA counterparts. Render the blocks into SKPictures then apply the transformation matrix to them to place them into the correct location. Rendering the text is also a bit tricky as you have to parse MText values. I have an old version of our parser located in this PR.

DomCR commented 3 months ago

Hi @KyleeChangg

The current state of the library doesn't allow to export the file in PDF, I might take a look after the v1 is released.

DomCR commented 2 months ago

It not functional yet but I started to take a look:

https://github.com/DomCR/ACadSharp.Pdf