CAD file, I want to export as portrait or landscape, how to achieve it?

CAD file, I want to export as portrait or landscape, how to achieve it?

@wanyangye

There is no provision in API for setting up the orientation. You can toggle the height and width values as workaround to serve the purpose.

a3.zip (475.4 KB)

After conversion, the font content cannot be seen。

Is the result of apose processing(f0aa5a33-5e7e-41e1-9a8e-d86c029690ab cad.pdf)

source:

public static void CAD(String path){
        // load CAD for conversion
        //Image image = Image.load(path + "a0.dwg");
        // create instance & set resultant page size
        CadRasterizationOptions rasterizationOptions = new CadRasterizationOptions();
        rasterizationOptions.setPageSize(new SizeF(297, 210));


        rasterizationOptions.setDrawType(CadDrawTypeMode.UseObjectColor);
        rasterizationOptions.setNoScaling(true);


        rasterizationOptions.setLayouts(new  String [] { "Model" });
        CadImage cadImage = (CadImage) Image.load(path+"a0.dwg");

        for(Object style : cadImage.getStyles())
        {
            // Set the font name
            ((com.aspose.cad.fileformats.cad.cadtables.CadStyleTableObject)style).setPrimaryFontName("hztxt");
        }


        rasterizationOptions.setAutomaticLayoutsScaling(true);

        // save PDF

        PdfOptions pdfOptions = new PdfOptions();
        pdfOptions.setVectorRasterizationOptions(rasterizationOptions);
        //pdfOptions.setRotation(1010);
        cadImage.save(path + UUID.randomUUID()+" cad.pdf", pdfOptions);
    }

a4.zip (418.6 KB)

some file conversion has lines,i need conver to pdf。

@wanyangye

I have created a ticket with ID CADJAVA-923 in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.

There are many problems? Is it all recorded?

@wanyangye
The issue has been added for following:

Please share the details of issue with other DWG along with generated output and detail of individual issue in each of DWG rendering.

@wanyangye

At present, Aspose.CAD does not support .SHX fonts. All SHX font are replaced with default TTF font on the machine where rendering is done. So, you can override style font but only with TTF font.
Also, you can specify a font path if it differs from the system default path, for example:

String customFonts = "C:\\CustomFonts\\x.d";
LoadOptions loadOptions = new LoadOptions();
loadOptions.setCustomFontFolders( new String[] { customFonts } );
loadOptions.setCustomFontFolderOptions( CustomFontFolderOptions.AddFolderForAll );
CadImage cadImage = (CadImage)Image.load(fileName, loadOptions);
for (Object style : cadImage.getStyles()) {
    ((CadStyleTableObject)style).setPrimaryFontName("Arial");
}


//Perform rendering  now