Free Support Forum - aspose.com

Issue rendering DXF file to PDF - Issue setting custom font?


#1

I have a problem rendering the following file to PDF

This is the output file:
s3://csdisco-devteam/test_sources/cad/native-cad-foreign-language.DXF/6a1f3641-0f21-4667-a2a7-fff2ccbad2ee.pdf

I am guessing I need to use a custom font, which I am trying using Arial Unicode MS
in the code below.

   String tempFileName = FileUtilities.getTempFile( ".pdf");

    // Create an instance of CadRasterizationOptions class
    CadRasterizationOptions rasterizationOptions = new CadRasterizationOptions();
    rasterizationOptions.setPageHeight(1600);
    rasterizationOptions.setPageWidth(1600);


    // Set the Entities type property to Entities3D.
    rasterizationOptions.setTypeOfEntities(TypeOfEntities.Entities3D);

    rasterizationOptions.setAutomaticLayoutsScaling(true);
    rasterizationOptions.setNoScaling(false);
    rasterizationOptions.setContentAsBitmap(true);

    // Set Layouts
    rasterizationOptions.setLayouts(new String[] {  "Model" });

    // Set Graphics options
    rasterizationOptions.getGraphicsOptions().setSmoothingMode(SmoothingMode.HighQuality);
    rasterizationOptions.getGraphicsOptions().setTextRenderingHint(TextRenderingHint.AntiAliasGridFit);
    rasterizationOptions.getGraphicsOptions().setInterpolationMode(InterpolationMode.HighQualityBicubic);


    // Create an instance of CadRasterizationOptions and set its various properties
    rasterizationOptions.setBackgroundColor(com.aspose.cad.Color.getWhite());

    // Iterate over the items of CadStyleDictionary
    for (CadStyleTableObject style : (Iterable<CadStyleTableObject>)image.getStyles())
    {
        // Set the font name
        style.setPrimaryFontName( "Arial Unicode MS");
    }

    // Create an instance of PDF options class
    PdfOptions pdfOptions = new PdfOptions();
    pdfOptions.setVectorRasterizationOptions(rasterizationOptions);

    image.save(tempFileName, pdfOptions);

I also enclose a copy of the font file


#2

I guess what might be missing is an API to specify a custom folder where to load the fonts from
like the one other Aspose Products (Words, Slides, etc…) provide


#3

@russ.nichols,

Can you please share generated result along with environment detail so that we may further investigate to help you out.


#4

This is the output file:


As you can see on the bottom left, asian text is not correctly displayed, but you can
instead see invalid characters

I am running this code on an AWS lambda image running Amazon Linux


#5

@russ.nichols,

I have worked with the file shared by you and have been able to observe the issue specified. An issue with ID CADJAVA-467 has been created 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.