Open iadcode opened 2 years ago
These changes fix some bugs in SynPDF relating to filling regions.
Before the changes After the changes
This behaviour can be tested with code such as
procedure EmfToPdf(EmfFilename: String; PdfFilename: String); const C_PDFPPI = 72; C_MMperInch = 25.4; var PDFDocument: TPdfDocument; Metafile: TMetafile; Scale: Single; begin Metafile := TMetafile.Create; try Metafile.LoadFromFile(EmfFilename); PDFDocument := TPdfDocument.Create(False, 0, False); try PDFDocument.DefaultPaperSize := psA4; PDFDocument.ScreenLogPixels := C_PDFPPI; PDFDocument.AddPage; Scale := C_PDFPPI / Trunc((Metafile.Width * 100) / (Metafile.MMWidth / C_MMperInch)); PDFDocument.Canvas.RenderMetaFile(Metafile, Scale, Scale, 0, 0, tpSetTextJustification, 99, 101, tcAlwaysClip); PDFDocument.SaveToFile(PdfFilename); finally FreeAndNil(PDFDocument); end; finally FreeAndNil(Metafile); end; end;
And using an EMF such as the one in this zip: BugsEMF.zip
These changes fix some bugs in SynPDF relating to filling regions.
Before the changes
After the changes
![image](https://user-images.githubusercontent.com/18545429/147026897-6cb021b8-004a-47a1-8c80-93a99fae85e5.png)
This behaviour can be tested with code such as
And using an EMF such as the one in this zip: BugsEMF.zip