We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Issue with tab characters when converting EMF image to PDF

I’m having an issue with converting an EMF image to PDF, where the EMF image contains text that has a few tab characters in it, which looks fine in the image. However when converted to PDF, the resulting PDF gets rid of the tabs and shows small squares instead.

I have attached a zip containing the EMF file, along with the converted PDF. In addition, a snippet of the code being used is below. I’m currently using Aspose Words

Any suggestions are greatly appreciated. Thanks!

Private Sub convertEmfToPdf(pdfFileName As String, tempEmfFilePaths As List(Of String))
Dim doc As New Aspose.Words.Document()
Dim builder As New Aspose.Words.DocumentBuilder(doc)

    Dim imageNum As Integer = 1
    For Each tempEmfFilePath As String In tempEmfFilePaths
        If imageNum > 1 Then builder.InsertBreak(Aspose.Words.BreakType.SectionBreakNewPage)

        'Read the image from file, ensure it Is disposed.
        Using image As Drawing.Image = Drawing.Image.FromFile(tempEmfFilePath)
            'Find which dimension the frames in this image represent. For example 
            'The frames of a BMP Or TIFF are "page dimension" whereas frames of a GIF image are "time dimension". 
            Dim dimension As New Drawing.Imaging.FrameDimension(image.FrameDimensionsList(0))

            'Get the number of frames in the image.
            Dim framesCount As Integer = image.GetFrameCount(dimension)

            'Loop through all frames.
            For frameIdx As Integer = 0 To framesCount - 1
                'Insert a section break before each New page, in case of a multi-frame TIFF.
                If (frameIdx <> 0) Then builder.InsertBreak(Aspose.Words.BreakType.SectionBreakNewPage)

                'Select active frame.
                image.SelectActiveFrame(dimension, frameIdx)

                '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.
                Dim ps As Aspose.Words.PageSetup = builder.PageSetup
                ps.PageWidth = Aspose.Words.ConvertUtil.PixelToPoint(image.Width, image.HorizontalResolution)
                ps.PageHeight = Aspose.Words.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, Aspose.Words.Drawing.RelativeHorizontalPosition.Page, 0, Aspose.Words.Drawing.RelativeVerticalPosition.Page, 0, ps.PageWidth, ps.PageHeight, Aspose.Words.Drawing.WrapType.None)
        End Using

        imageNum += 1

    'Save the document to PDF.
End Sub

tab issue.zip (28.2 KB)


We tested the scenario and managed to reproduce the same problem on our end. For the sake of correction, we have logged this problem in our issue tracking system. The ID of this issue is WORDSNET-17796. We will further look into the details of this problem and will keep you updated on the status of correction. We apologize for your inconvenience.