locked
How to Convert Dwg/Dxf to PDF RRS feed

  • Question

  • User2041008840 posted

    Hello, 
    I want to convert the dwg/dxf file into pdf. The dwg/dxf file exported from zw Cad software and The file contains the design of house so 
    I want to get that design and put it into pdf and export it. Is there any solution on it? 

    and another I also have the xml format of the diagram like this.

    <?xml version="1.0" encoding="UTF-8"?>
    <DATA_EXPORT>
      <REPORT reportId="G010220255980" />
      <VERSION coplanarity="" dormers="" precision="0" precisionUnits="" sourceVersion="1028" unitOfLength="FEET" />
      
      <STRUCTURES>
        <ROOF id="ROOF1">
          <FACES>
            <FACE designator="F1" id="F1" type="ROOF" children="">
              <POLYGON id="P1" orientation="163.56" path="L1,L2,L3" pitch="6" size="147" unroundedsize="146.63025485785005" />
            </FACE>
            <FACE designator="F2" id="F2" type="ROOF" children="">
              <POLYGON id="P2" orientation="73.56" path="L2,L4,L5,L6" pitch="6" size="84" unroundedsize="83.7887513948723" />
            </FACE>
            <FACE designator="F3" id="F3" type="ROOF" children="F14,F15,F16,F18">
              <POLYGON id="P3" orientation="163.56" path="L5,L7,L8,L9,L10,L11,L12,L13,L14" pitch="6" size="837" unroundedsize="836.691220873615" />
            </FACE>
            <FACE designator="F4" id="F4" type="ROOF" children="">
              <POLYGON id="P4" orientation="106.44" path="L1,L4,L7,L15,L16,L17,L18,L19" pitch="6" size="576" unroundedsize="576.4664585904721" />
            </FACE>
            <FACE designator="F5" id="F5" type="ROOF" children="F19">
              <POLYGON id="P5" orientation="16.44" path="L18,L20,L9,L21,L22,L23,L24,L25,L26,L27,L28" pitch="6" size="473" unroundedsize="472.6566417638446" />
            </FACE>
            <FACE designator="F6" id="F6" type="ROOF" children="">
              <POLYGON id="P6" orientation="106.44" path="L29,L30,L31,L25" pitch="6" size="25" unroundedsize="24.837368745952052" />
            </FACE>
            <FACE designator="F7" id="F7" type="ROOF" children="">
              <POLYGON id="P7" orientation="73.56" path="L32,L33,L31,L24" pitch="6" size="23" unroundedsize="23.041894331491847" />
            </FACE>
            <FACE designator="F8" id="F8" type="ROOF" children="">
              <POLYGON id="P8" orientation="16.44" path="L34,L35,L36,L37,L38,L30,L33" pitch="6" size="169" unroundedsize="168.9540002360366" />
            </FACE>
            <FACE designator="F9" id="F9" type="ROOF" children="">
              <POLYGON id="P9" orientation="106.44" path="L39,L40,L41,L37" pitch="6" size="25" unroundedsize="24.612934186252573" />
            </FACE>
            <FACE designator="F10" id="F10" type="ROOF" children="">
              <POLYGON id="P10" orientation="73.56" path="L39,L42,L43,L36" pitch="6" size="25" unroundedsize="24.61293835138986" />
            </FACE>
            <FACE designator="F11" id="F11" type="ROOF" children="">
              <POLYGON id="P11" orientation="106.44" path="L44,L45,L46,L10,L21,L47" pitch="7" size="294" unroundedsize="293.6336745920653" />
            </FACE>
            <FACE designator="F12" id="F12" type="ROOF" children="F17">
              <POLYGON id="P12" orientation="73.56" path="L48,L45,L49,L50" pitch="7" size="365" unroundedsize="364.8606892561623" />
            </FACE>
            <FACE designator="F13" id="F13" type="ROOF" children="">
              <POLYGON id="P13" orientation="73.56" path="L51,L52,L53,L54,L13" pitch="6" size="224" unroundedsize="224.07511271735993" />
            </FACE>
            <FACE designator="F14" id="F14" type="ROOFPENETRATION" children="">
              <POLYGON id="F14" orientation="163.56" path="L55,L56,L57,L58" pitch="6" size="8" unroundedsize="8.301146180787091" />
            </FACE>
            <FACE designator="F15" id="F15" type="ROOFPENETRATION" children="">
              <POLYGON id="F15" orientation="163.56" path="L59,L60,L61,L62" pitch="6" size="8" unroundedsize="8.301151382747818" />
            </FACE>
            <FACE designator="F16" id="F16" type="ROOFPENETRATION" children="">
              <POLYGON id="F16" orientation="163.56" path="L63,L64,L65,L66" pitch="6" size="8" unroundedsize="8.301150440283743" />
            </FACE>
            <FACE designator="F17" id="F17" type="ROOFPENETRATION" children="">
              <POLYGON id="F17" orientation="73.56" path="L67,L68,L69,L70" pitch="7" size="10" unroundedsize="10.464095178292416" />
            </FACE>
            <FACE designator="F18" id="F18" type="ROOFPENETRATION" children="">
              <POLYGON id="F18" orientation="163.56" path="L71,L72,L73,L74" pitch="6" size="6" unroundedsize="6.495190814509442" />
            </FACE>
            <FACE designator="F19" id="F19" type="ROOFPENETRATION" children="">
              <POLYGON id="F19" orientation="16.44" path="L75,L76,L77,L78" pitch="6" size="4" unroundedsize="4.2364560862402865" />
            </FACE>
          </FACES>
          <LINES>
            <LINE id="L1" type="HIP" path="C1,C2" />
            <LINE id="L2" type="HIP" path="C2,C3" />
            <LINE id="L3" type="EAVE" path="C3,C1" />
            <LINE id="L4" type="RIDGE" path="C2,C4" />
            <LINE id="L5" type="VALLEY" path="C4,C5" />
            <LINE id="L6" type="EAVE" path="C5,C3" />
            <LINE id="L7" type="HIP" path="C4,C6" />
            <LINE id="L8" type="RAKE" path="C6,C7" />
            <LINE id="L9" type="RIDGE" path="C7,C8" />
            <LINE id="L10" type="VALLEY" path="C8,C9" />
            <LINE id="L11" type="APRONFLASHING" path="C9,C10" />
            <LINE id="L12" type="RAKE" path="C10,C11" />
            <LINE id="L13" type="HIP" path="C11,C12" />
            <LINE id="L14" type="EAVE" path="C12,C5" />
            <LINE id="L15" type="STEPFLASHING" path="C6,C13" />
            <LINE id="L16" type="APRONFLASHING" path="C13,C14" />
            <LINE id="L17" type="STEPFLASHING" path="C14,C15" />
            <LINE id="L18" type="HIP" path="C15,C16" />
            <LINE id="L19" type="EAVE" path="C16,C1" />
            <LINE id="L20" type="RAKE" path="C15,C7" />
            <LINE id="L21" type="VALLEY" path="C8,C17" />
            <LINE id="L22" type="APRONFLASHING" path="C17,C18" />
            <LINE id="L23" type="STEPFLASHING" path="C18,C19" />
            <LINE id="L24" type="VALLEY" path="C19,C20" />
            <LINE id="L25" type="VALLEY" path="C20,C21" />
            <LINE id="L26" type="APRONFLASHING" path="C21,C22" />
            <LINE id="L27" type="STEPFLASHING" path="C22,C23" />
            <LINE id="L28" type="EAVE" path="C23,C16" />
            <LINE id="L29" type="EAVE" path="C21,C24" />
            <LINE id="L30" type="HIP" path="C24,C25" />
            <LINE id="L31" type="RIDGE" path="C25,C20" />
            <LINE id="L32" type="APRONFLASHING" path="C19,C26" />
            <LINE id="L33" type="HIP" path="C26,C25" />
            <LINE id="L34" type="STEPFLASHING" path="C26,C27" />
            <LINE id="L35" type="EAVE" path="C27,C28" />
            <LINE id="L36" type="VALLEY" path="C28,C29" />
            <LINE id="L37" type="VALLEY" path="C29,C30" />
            <LINE id="L38" type="EAVE" path="C30,C24" />
            <LINE id="L39" type="RIDGE" path="C29,C31" />
            <LINE id="L40" type="RAKE" path="C31,C32" />
            <LINE id="L41" type="EAVE" path="C32,C30" />
            <LINE id="L42" type="RAKE" path="C31,C33" />
            <LINE id="L43" type="EAVE" path="C33,C28" />
            <LINE id="L44" type="RAKE" path="C34,C35" />
            <LINE id="L45" type="RIDGE" path="C35,C36" />
            <LINE id="L46" type="RAKE" path="C36,C9" />
            <LINE id="L47" type="EAVE" path="C17,C34" />
            <LINE id="L48" type="RAKE" path="C37,C35" />
            <LINE id="L49" type="RAKE" path="C36,C38" />
            <LINE id="L50" type="EAVE" path="C38,C37" />
            <LINE id="L51" type="STEPFLASHING" path="C11,C39" />
            <LINE id="L52" type="APRONFLASHING" path="C39,C40" />
            <LINE id="L53" type="STEPFLASHING" path="C40,C41" />
            <LINE id="L54" type="EAVE" path="C41,C12" />
            <LINE id="L55" type="STEPFLASHING" path="C42,C43" />
            <LINE id="L56" type="STEPFLASHING" path="C43,C44" />
            <LINE id="L57" type="STEPFLASHING" path="C44,C45" />
            <LINE id="L58" type="STEPFLASHING" path="C45,C42" />
            <LINE id="L59" type="STEPFLASHING" path="C46,C47" />
            <LINE id="L60" type="STEPFLASHING" path="C47,C48" />
            <LINE id="L61" type="STEPFLASHING" path="C48,C49" />
            <LINE id="L62" type="STEPFLASHING" path="C49,C46" />
            <LINE id="L63" type="STEPFLASHING" path="C50,C51" />
            <LINE id="L64" type="STEPFLASHING" path="C51,C52" />
            <LINE id="L65" type="STEPFLASHING" path="C52,C53" />
            <LINE id="L66" type="STEPFLASHING" path="C53,C50" />
            <LINE id="L67" type="STEPFLASHING" path="C54,C55" />
            <LINE id="L68" type="STEPFLASHING" path="C55,C56" />
            <LINE id="L69" type="STEPFLASHING" path="C56,C57" />
            <LINE id="L70" type="STEPFLASHING" path="C57,C54" />
            <LINE id="L71" type="STEPFLASHING" path="C58,C59" />
            <LINE id="L72" type="STEPFLASHING" path="C59,C60" />
            <LINE id="L73" type="STEPFLASHING" path="C60,C61" />
            <LINE id="L74" type="STEPFLASHING" path="C61,C58" />
            <LINE id="L75" type="STEPFLASHING" path="C62,C63" />
            <LINE id="L76" type="STEPFLASHING" path="C63,C64" />
            <LINE id="L77" type="STEPFLASHING" path="C64,C65" />
            <LINE id="L78" type="STEPFLASHING" path="C65,C62" />
          </LINES>
          <POINTS>
            <POINT id="C1" data="0.0,0.0,9.84" />
            <POINT id="C2" data="14.259091520057991,-7.762671039626002,15.43916992" />
            <POINT id="C3" data="6.496420480050146,-22.02176584009081,9.84" />
            <POINT id="C4" data="20.551026960019954,-5.906551840491592,15.43916992" />
            <POINT id="C5" data="12.788355920012108,-20.165643360167742,9.84" />
            <POINT id="C6" data="25.032454879917204,-8.346248640157281,17.1989096" />
            <POINT id="C7" data="31.481685999957843,-6.443724000491201,20.47842416" />
            <POINT id="C8" data="40.28119784001261,-36.27257536008954,20.47842416" />
            <POINT id="C9" data="39.50134176002349,-35.94745520032942,20.15847" />
            <POINT id="C10" data="39.947484079920685,-37.45980744052678,20.15847" />
            <POINT id="C11" data="30.98147944001481,-40.10477647997439,15.599145359999998" />
            <POINT id="C12" data="22.997018080074337,-54.77127352051436,9.84" />
            <POINT id="C13" data="26.254661599951795,-9.011619599573313,17.6788392" />
            <POINT id="C14" data="37.265546160009684,-5.763409360311925,17.6788392" />
            <POINT id="C15" data="37.93091711999848,-4.5411993608251215,17.1989096" />
            <POINT id="C16" data="48.13328496005386,14.199323359727858,9.84" />
            <POINT id="C17" data="48.775062880050385,-23.912489040009675,14.799264879999999" />
            <POINT id="C18" data="49.05348240008578,-24.856276240199804,14.799264879999999" />
            <POINT id="C19" data="56.289205040046944,-22.72173751950264,11.119810079999999" />
            <POINT id="C20" data="40.60420240008272,-14.182801999934016,17.27889896" />
            <POINT id="C21" data="49.80851216004695,2.724410639517009,10.63988048" />
            <POINT id="C22" data="50.086931680082344,1.7806201600655913,10.63988048" />
            <POINT id="C23" data="51.6599147199234,2.2446515998616814,9.84" />
            <POINT id="C24" data="51.38149520007893,3.188438800051808,10.63988048" />
            <POINT id="C25" data="42.177185439923775,-13.718770560137926,17.27889896" />
            <POINT id="C26" data="57.862188080078916,-22.25770936049521,11.119810079999999" />
            <POINT id="C27" data="58.8059785601031,-21.979289840459824,10.63988048" />
            <POINT id="C28" data="57.41388751997612,-17.260340719409285,10.63988048" />
            <POINT id="C29" data="50.284341759947125,-13.379005199596286,13.43946544" />
            <POINT id="C30" data="54.16567727995105,-6.249459440521895,10.63988048" />
            <POINT id="C31" data="56.73357287998777,-11.476480559930204,13.43946544" />
            <POINT id="C32" data="55.10946775997523,-5.9710399204865094,10.63988048" />
            <POINT id="C33" data="58.357678000000305,-16.98192448016256,10.63988048" />
            <POINT id="C34" data="63.87570400000549,-19.457799680382013,14.799264879999999" />
            <POINT id="C35" data="67.03110663994681,-30.154083040207624,21.50006216" />
            <POINT id="C36" data="40.13309600006323,-38.08899999938905,21.50006216" />
            <POINT id="C37" data="70.18651256010402,-40.85036968082189,14.799264879999999" />
            <POINT id="C38" data="43.28850192002952,-48.78528336074203,14.799264879999999" />
            <POINT id="C39" data="31.646850400003604,-38.882569759748876,16.07907496" />
            <POINT id="C40" data="40.6128550401004,-36.237597439512605,16.07907496" />
            <POINT id="C41" data="44.2322924000537,-48.506867119967936,9.84" />
            <POINT id="C42" data="31.528806480015625,-14.92109392017126,19.33057504" />
            <POINT id="C43" data="30.18328815997578,-10.36001776073128,19.33057504" />
            <POINT id="C44" data="31.68813248008955,-9.916089440509676,20.0958056" />
            <POINT id="C45" data="33.03365079993848,-14.477165599949657,20.0958056" />
            <POINT id="C46" data="34.21984312009532,-24.04325280062854,19.33057504" />
            <POINT id="C47" data="32.87432480005547,-19.4821733603999,19.33057504" />
            <POINT id="C48" data="34.37916911997832,-19.038245040178296,20.0958056" />
            <POINT id="C49" data="35.724687440018165,-23.599321199618277,20.0958056" />
            <POINT id="C50" data="35.56536143994424,-28.60432896006852,19.33057504" />
            <POINT id="C51" data="36.91087975998409,-33.16540840029716,19.33057504" />
            <POINT id="C52" data="38.41572408009786,-32.721476800814266,20.0958056" />
            <POINT id="C53" data="37.070205760058016,-28.16040063984692,20.0958056" />
            <POINT id="C54" data="52.94901703995652,-36.67901328045875,20.1338044" />
            <POINT id="C55" data="58.62419767992105,-35.004835679866375,20.1338044" />
            <POINT id="C56" data="58.19528520005755,-33.55089040070772,21.044643999999998" />
            <POINT id="C57" data="52.52010456009302,-35.225067999772726,21.044643999999998" />
            <POINT id="C58" data="18.578569439947604,-29.999739359505472,11.19155352" />
            <POINT id="C59" data="19.262210000059568,-32.31716760061681,11.19155352" />
            <POINT id="C60" data="21.57963824002538,-31.63352703955024,12.369995199999998" />
            <POINT id="C61" data="20.895997679913414,-29.316098799966273,12.369995199999998" />
            <POINT id="C62" data="43.49166183995548,-18.896772079728542,16.57867472" />
            <POINT id="C63" data="44.04378095997963,-20.768366320617496,16.57867472" />
            <POINT id="C64" data="42.17218672004528,-21.320488719902933,17.5304028" />
            <POINT id="C65" data="41.62006760002114,-19.448894480541348,17.5304028" />
          </POINTS>
        </ROOF>
      </STRUCTURES>
    </DATA_EXPORT>
    
    

    Can I plot the point and get the diagram similar to Zw Cad Software from this xml file. 

    I want to perform it in asp.net core. 

    Tuesday, February 9, 2021 1:02 PM

All replies

  • User-939850651 posted

    Hi Prathamesh Shende,

    Aspose.CAD for .NET is a powerful CAD to PDF converter API that lets you convert DWG and DXF files to PDF format quiet easily. In addition, it allows you to convert the CAD drawings to raster images. The API also can be installed using the NuGet in VS.

    Simple code(DWG to PDF):

    using (Aspose.CAD.Image image = Aspose.CAD.Image.Load("sample.dwg"))
    {                
    	// Create an instance of PdfOptions
    	Aspose.CAD.ImageOptions.PdfOptions pdfOptions = new Aspose.CAD.ImageOptions.PdfOptions();
    
    	// Export CAD to PDF
    	image.Save("result.pdf", pdfOptions);
    }

    For more details, you could refer to this link:

    https://blog.aspose.com/2020/09/02/convert-autocad-dwg-dxf-to-pdf-using-csharp/

    Best regards,

    Xudong Peng

    Wednesday, February 10, 2021 1:52 AM
  • User2041008840 posted

    Okay Got it.

    and is there any option to get point from xml point and draw polygon from it.
    the xml code I already post here 

    Wednesday, February 10, 2021 11:45 AM