You are not logged in.
Pages: 1
Hello
We have the following code:
const
OutputFileName = 'test.pdf';
InputFileName = 'test.emf';
var
PdfDoc: TPDFDocumentGDI;
PdfPage: TPdfpage;
Emf: TMetafile;
begin
Emf := TMetafile.Create();
Emf.LoadFromFile(InputFileName);
PdfDoc := TPdfDocumentGDI.Create;
PdfDoc.CompressionMethod := cmFlateDecode;
PdfDoc.DefaultPaperSize := psUserDefined;
PdfPage := PdfDoc.AddPage();
PdfPage.PageWidth := Round(72 * Emf.MMWidth / 2540);
PdfPage.PageHeight := Round(72 * Emf.MMHeight / 2540);
PdfDoc.VCLCanvas.StretchDraw(Rect(0, 0, Round(Screen.PixelsPerInch * Emf.MMWidth / 2540), Round(Screen.PixelsPerInch * Emf.MMHeight / 2540)), Emf);
PdfDoc.SaveToFile(OutputFileName);
PdfDoc.Free();
FreeAndNil(Emf);
end;
You can download my metafile from here:
https://docs.google.com/file/d/0B5Z5axE … dCN00/edit
The ouput file ha some artefacts (unnecessary frames):
https://docs.google.com/file/d/0B5Z5axE … dnMnc/edit
Offline
I don't know what you mean.
Offline
I don't know how it is drawn. I got the metafile from ministry of treasures and I have to use it as background in my report.
Offline
I tried to use a tool like EmfExplorer to guess what is wrong here.
http://frazmitic.free.fr/emfexplorer/
It was crashing when running it...
And EmfExplorer is known to be very efficient.
So I guess the emf content is just somewhat non standard and difficult to work with.
What about just rendering the page as bitmap in the target pdf, then draw your text over it?
Offline
In my opinion EmfExplorer works fine, but you have to switch off "GDI+" option:
https://docs.google.com/file/d/0B5Z5axE … 1XNkE/edit
As you can see there aren't any boxes in the attached screenshoot.
Offline
For SynPDF, we use a similar technique than the one used with "GDI+" option, i.e. reading the metafile records, and rendering them.
If EMFExplorer is not able to render the metafile (this is the first time I see it), I guess this is of bad taste...
For you, the easiest is to render the page as bitmap (black/white) using default GDI command, then print the bitmap on the PDF canvas, and add your text.
Offline
Pages: 1