You are not logged in.
Pages: 1
Hello,
I create a PDF file from Metafiles.
The export seems to work fine, but the test position is nocht Ok.
Why?
As an investment the EMF file, the PDF file from synPDF (ERROR!) and for comparison, the PDF file as pressure in ScanSoftPDF.
PROCEDURE TppPrint.PrintPDF;
VAR
fDialogResult: boolean;
fNamePDF: STRING;
fIndex: integer;
fPageMetafile: TMetafile;
fPDF: TPdfDocumentGDI;
fPDFPage:TPDFPage;
BEGIN
fDialogResult := false;
IF fViewPrint.fSaveDialogDs <> NIL THEN
BEGIN
//
END
ELSE IF fViewPrint.fSaveDialog <> NIL THEN
BEGIN
fViewPrint.fSaveDialog.FileName :=
ChangeFileExt(fViewPrint.fPdfFileName, '.pdf');
fViewPrint.fSaveDialog.Filter := 'Adobe PDF (*.pdf)|*.pdf';
fViewPrint.fSaveDialog.DefaultExt := 'pdf';
fDialogResult := fViewPrint.fSaveDialog.Execute;
IF fDialogResult = true THEN
BEGIN
fNamePDF := fViewPrint.fSaveDialog.FileName;
END;
END;
IF fDialogResult = true THEN
BEGIN
fPageMetafile := TMetafile.Create;
TRY
fPDF := TPdfDocumentGDI.Create(false,0,true,nil);
TRY
fPDF.Info.CreationDate := Now;
fPDF.Info.Creator := 'DickSoft';
fPDF.Info.Title := 'Titel?';
// ...
fPDF.PDFA1 := true;
// ----
fPDF.DefaultPageWidth := Trunc(72 * self.fViewPrint.fMetafileWidth100MM/2540);
fPDF.DefaultPageHeight :=Trunc(72 * self.fViewPrint.fMetafileHeight100MM/2540);
fPDF.UseMetaFileTextPositioning := tpExactTextCharacterPositining;
// tpKerningFromAveragePosition
// tpSetTextJustification
// tpExactTextCharacterPositining
fPDF.NewDoc;
FOR fIndex := 1 TO fViewPrint.fMaxPage DO
BEGIN
fPageMetafile.Clear;
fPageMetafile.LoadFromFile(fViewPrint.fPfadFileName +
IntTostr(PageOffset + fIndex) + fViewPrint.fFileNameSuffix);
fPDF.AddPage;
fPDF.VCLCanvas.StretchDraw(Rect(0,0,
Trunc(Screen.PixelsPerInch * self.fViewPrint.fMetafileWidth100MM/2540),
Trunc(Screen.PixelsPerInch * self.fViewPrint.fMetafileHeight100MM/2540)),
fPageMetafile
);
END;
fPDF.SaveToFile(fNamePDF);
FINALLY
fPDF.Free;
END;
FINALLY
fPageMetafile.Free;
END;
END;
END;
https://ftp.wf-ib.de/filevista/link.ash … 940c9a.zipFiles and Code
Last edited by Dicki (2014-03-07 07:33:03)
Offline
Hello user,
we have found the "error".
The external program written in Delphi generated metafile with the scalierung by:
fMetafile := TMetafile.Create;
fMetafile.MMWidth := 19000; // = 190mm * 100
fMetafile.MMHeight := 30000; // = 300mm * 100
fMetafileCanvas := TMetafileCanvas.CreateWithComment(fMetafile, 0, '1', '2');
SetMapMode(fView_PLBP_MetafileCanvas.Handle, MM_HIMETRIC);
the Prgrammierer change the code as follows:
fMetafile := TMetafile.Create;
fMetafile.Width := 19000; // = 190mm * 100 = 19000 Pixel
fMetafile.Height := 30000; // = 300mm * 100 = 30000 Pixel
fMetafileCanvas := TMetafileCanvas.CreateWithComment(fMetafile, 0, '1', '2');
//SetMapMode(fView_PLBP_MetafileCanvas.Handle, MM_HIMETRIC); //This line is omitted
With this change we can generate from the metafiles PDF files.
In the Metafiles also circle segments are included (90 °, etc.) but these are not shown in the PDF file.
We use this SynPdf revision 2014-03-02.
Last edited by Dicki (2014-03-30 11:44:34)
Offline
Pages: 1