Text is not searchable after EMF to PDF conversion

Hi Aspose support,

In out product we started to use EMF to PDF conversion via Aspose, and after some research with different ways and different Aspose libraries we found that the optimal one is to use Aspose.Words.dll to insert EMF picture into document, convert to Word document to PDF and then optimize PDF with Aspose.PDF.dll. In this case conversion speed and resulted PDF file size and quality are optimal.

Actually the base of the conversion method is taken from example: https://docs.aspose.com/words/net/convert-a-document/

But with this method we noticed problems with content in resulted PDF file.
Checked with:
Aspose.Words.dll v 19.7.0
Aspose.PDF.dll v19.7.0

After conversion from EMF to PDF resulted PDF has not ability to select, copy, etc. text. After conversion we expect to see PDF with text which can be selected, etc.
See EMF file: EMF.ZIP (4.6 KB)
Is there something wrong with attached EMF file?

See project codes for details:
EmfToPdf.zip (6.0 KB)

Please help.

@licenses,

We have logged your requirement/problem in our issue tracking system. Your ticket number is WORDSNET-18952. We will further look into the details of this problem and will keep you updated on the status of the linked issue.

@licenses,

Regarding WORDSNET-18952, after further investigation it turns out to be an expected behavior. Metafile contains unsupported raster operation and Aspose.Words performs fallback to bitmap metafile rendering through GDI+. And text in the bitmap cannot be searchable. As a workaround please switch to MetafileRenderingMode.Vector. Hope, this helps.

string[] images = Directory.GetFiles(@"E:\Temp\EMF", "*.emf", SearchOption.AllDirectories);

Aspose.Words.Document doc = new Aspose.Words.Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.PageSetup.LeftMargin = ConvertUtil.MillimeterToPoint(8);
builder.PageSetup.RightMargin = ConvertUtil.MillimeterToPoint(8);

for (int i = 0; i < images.Length; i++)
{
    // Read the image from file, ensure it is disposed.    
    using (Metafile image = (Metafile)System.Drawing.Image.FromFile(images[i]))
    {
        // Insert a section break before each new page
        if (i != 0)
            builder.InsertBreak(BreakType.SectionBreakNewPage);

        // We want the size of the page to be the same as the size of the image.
        // Convert pixels to points to size the page to the actual image size.
        PageSetup ps = builder.PageSetup;
        ps.PageWidth = ConvertUtil.PixelToPoint(image.Width, image.HorizontalResolution);
        ps.PageHeight = ConvertUtil.PixelToPoint(image.Height, image.VerticalResolution);

        // Insert the image into the document and position it at the top left corner of the page.
        builder.InsertImage(
            image,
            RelativeHorizontalPosition.Page,
            0,
            RelativeVerticalPosition.TopMargin,
            0,
            ps.PageWidth,
            ps.PageHeight,
            WrapType.Through);
    }
}

var saveOptions = new Aspose.Words.Saving.PdfSaveOptions()
{
    Compliance = PdfCompliance.Pdf15,
    EmbedFullFonts = true,
    UseCoreFonts = true
};

saveOptions.MetafileRenderingOptions.RenderingMode = MetafileRenderingMode.Vector;

doc.Save(@"E:\Temp\EMF\\19.7.pdf", saveOptions);

@licenses,

Regarding WORDSNET-18952, we have completed the work on your issue and concluded to close this issue as ‘Not a Bug’. Please see my previous message for analysis details.

Thanks for the response.