Click here to Skip to main content
15,940,550 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I have a requirement to create DXF file from HTML div content/ image/pdf . I have tried many methods. but nothing was success. i can create dwg/dxf file. but its not opening in some case or may be blank.

What I have tried:


This is for image conversion
image_path = 'C:/Users/Downloads/home.jpg'
        with open(image_path, "rb") as image_file:
            encoded_string = base64.b64encode('utf-8')
        base64_image = encoded_string
        image_data = b64decode(base64_image)
        doc ="R2000")
        temp_image_path = 'temp_image.jpg'
        with open(temp_image_path, 'wb') as f:
        image =
        width, height = 800, 400  
        my_image_def = doc.add_image_def(filename=temp_image_path, size_in_pixel=(width, height))

        msp = doc.modelspace()
        image_width, image_height = 400, 200  
        msp.add_image(insert=(2, 1), size_in_units=(image_width, image_height), image_def=my_image_def, rotation=0)

        dxf_output_path = "new_dxf.dxf"


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900