#1 2013-04-24 08:30:34

LeonardU
Member
Registered: 2013-04-23
Posts: 4

Problem converting emf file - "invisible" text

Hello!

I have an sample generated emf file wich I need to convert into a PDF document. The generated emf file is displayed correctly by the Windows Default Picture Viewer and by the EMFExplorer.

The problem is that after i convert the emf, and open the generated PDF with Acrobat Reader, only the first word is visible. I know that the rest of the text is there, and positioned correctly, because after I select the text from my PDF viewer, I can see the highlighted background block where the text should be. And after I copy and paste it into an simple text editor, the entire text is there. But when I paste it into an document editor, the text is displayed as in the PDF and the font color of the "invisible" text is white.

Here is a sample code, how I use the RenderMetaFile procedure and save the PDF file:

procedure SaveMyEMF;
var
  MTF : TMetafile;
  Pdf: TPdfDocument;
begin
  MTF := TMetafile.Create;
  MTF.LoadFromFile('sample.emf');
  Pdf := TPdfDocument.Create;
  Pdf.DefaultPageWidth := MulDiv(MTF.Width,72,Pdf.ScreenLogPixels);
  Pdf.DefaultPageHeight := MulDiv(MTF.Height,72,Pdf.ScreenLogPixels);
  Pdf.AddPage;
  Pdf.Canvas.RenderMetaFile(MTF);
  Pdf.SaveToFile('test.pdf');
  FreeAndNil(MTF);
  FreeAndNil(Pdf);
end;

The question is: what am I doing wrong? Is something wrong with the font color in the EMF file?  If it is, then why in my EMF viewers the EMF file is displayed correctly and how should I change the default font color for the MetaFile renderer?

Last edited by LeonardU (2013-04-24 08:35:01)

Offline

#2 2013-04-24 09:52:05

LeonardU
Member
Registered: 2013-04-23
Posts: 4

Re: Problem converting emf file - "invisible" text

I've downloaded the latest source from the repository, and now it works great!

Offline

Board footer

Powered by FluxBB