#1 Re: PDF Engine » About emf with chinese characters to pdf » 2013-07-06 02:53:30

ab wrote:

AFAIK this is not possible with the current implementation scheme.

I do not have clear idea about it could be done, due to some missing glyphes.

1. If the computer has install all chinese fonts, can  I use the fonts define in emf file?
2. How can I get API document and samples of PDF Engine?

#2 PDF Engine » About emf with chinese characters to pdf » 2013-07-05 13:09:38

yiyun18
Replies: 3

Hello,
    These codes can convert emf file with chinese characters to pdf, but the font is 'Arial Unicode MS'. How can  I use the fonts define in emf file?

Thanks.

procedure TForm1.emfchineseClick(Sender: TObject);
var
  emf : TMetafile;
  Pdf: TPdfDocument;
begin
  emf := TMetafile.Create;
  Pdf := TPdfDocument.Create;   
  try
    Pdf.EmbeddedTTF := True;
    pdf.StandardFontsReplace := true;
    pdf.PDFA1 := true;
    Pdf.UseFontFallBack := true;
    Pdf.FontFallBackName := 'Arial Unicode MS';
    Pdf.DefaultPageWidth := MulDiv(emf.Width,72,Pdf.ScreenLogPixels);
    Pdf.DefaultPageHeight := MulDiv(emf.Height,72,Pdf.ScreenLogPixels);
    Pdf.AddPage;       
    emf.LoadFromFile('c:\0.emf');
    Pdf.Canvas.RenderMetaFile(emf);
    pdf.SaveToFile('c:\test.pdf');
  finally
    FreeAndNil(emf);
    FreeAndNil(pdf);
  end;
end;

#3 PDF Engine » some emf image can't convert to pdf file » 2013-06-20 14:13:04

yiyun18
Replies: 1

Hello,
   I need to create a pdf file from the emf image. The code below can work well to some emf images, but other emf images can't work. The emf file can be download from http://url.cn/FBFSBe .

thanks

procedure TForm1.Button2Click(Sender: TObject);
const
  OutputFileName = 'c:\1.pdf';
  InputFileName = 'C:\tmpemf\3.emf';
var
  PdfDoc   : TPDFDocumentGDI;
  Emf       : TMetafile;
  R          : TRect;
  Gdip    : TGDIPlusFull;
begin
  Emf := TMetafile.Create();
  Emf.LoadFromFile(InputFileName);
  
  Gdip := TGDIPlusFull.Create;

  PdfDoc := TPdfDocumentGDI.Create;
  PdfDoc.CompressionMethod := cmFlateDecode;
  PdfDoc.DefaultPaperSize := psA4;
  PdfDoc.AddPage;

  R.Left := 0;
  R.Top := 0;
  R.Bottom := Emf.Height;
  R.Right := Emf.Width;
  Gdip.DrawAntiAliased(Emf, PdfDoc.VCLCanvas.Handle, R, smAntiAlias, trhClearTypeGridFit);

  PdfDoc.SaveToFile(OutputFileName);
  PdfDoc.Free();

  FreeAndNil(Emf);
  end;

Board footer

Powered by FluxBB