EMF to PDF Conversion

Hello,

in incident 275093 we were talking about checking on our side, which problems we have creating an EMF which afterwards should be converted by your file formatting tools.

We are still checking on problems on our side, but we´re convinced, that your tools still have a bug regarding the alignment of regular text. As you can see in the example, the bold text ist aligned to the right side (which is right) where the regular text ist not correctly aligned. We where checking in our GDI+ commands and the alignment is correctly done on our side.

Could you please check and correct your tools regarding this issue. We will then continue testing.

This is our code:

using (PdfDocument doc = new PdfDocument())                               
 {                                    
     doc.PageSettings.Size = PdfPageSize.A4; // in points                                    
     doc.PageSettings.Margins.All = 0;                                   
      for (int i = 0; i < emfFiles.Length; i++)                                   
      {                                        
          string emfFile = emfFiles[i];                                        
          string tempEmfFile = Path.Combine(tempPath, uniqueFileString + "_Metafile_" + i.ToString() + ".emf");                                       
          File.Copy(emfFile, tempEmfFile);                                        
          PdfPage page = doc.Pages.Add();                                        
          PdfGraphics graphics = page.Graphics;                                        
          graphics.ScaleTransform(0.96f, 0.96f);                                        
          graphics.TranslateTransform(12, 12);   // 16.66667 px --> 12 pts                                        
          PdfMetafileLayoutFormat format = new PdfMetafileLayoutFormat();                                        
          format.SplitImages = true;                                       
          format.SplitTextLines = true;                                        
          format.Layout = PdfLayoutType.OnePage;                                        
          using (PdfMetafile metaChart = new PdfMetafile(tempEmfFile))                                        
               {                                            
                    metaChart.PageUnit = GraphicsUnit.Pixel;                                            
                    metaChart.Draw(page, Point.Empty, format);                                        
               }                                   
}                                    
doc.Save(pdfFile);                                    
doc.Close(true);                                
}

What we don´t understand, is why we have to put in this line"graphics.ScaleTransform(0.96f, 0.96f); " to get a correct page and why the alignment of regular text doesn´t work, but the text with bold fontstyle works perfectly.

I attached 4 files in a zip:

- 2 EMF Files (representing the first and the second page)
- 1 PDF File generated from both EMF Files with your library
- 1 PDF File generated from both EMF Files via PS Printer and then ghostscript

Thanks in advance. If it helps we can establish contact between your developer and the developer on our side who is working on those EMF Files.

Stefan

Attachment: EMF_2_PDF_1fe1663e.zip

2 Replies

SL Sowmiya Loganathan Syncfusion Team June 23, 2020 01:56 PM UTC

Hi Stefan,    
   
Thank you for contacting Syncfusion support.    
   
We were able to reproduce the reported issue and suspect that this to be a defect. Currently, we are validating on this and will update the further details on June 25, 2020.    
 
Regards, 
Sowmiya Loganathan 



SL Sowmiya Loganathan Syncfusion Team June 29, 2020 04:45 AM UTC

Hi Stefan,  

Please refer the incident under your direct trac account for further follow up about this query.  

Regards, 
Sowmiya Loganathan 


Loader.
Up arrow icon