Hi Katyayny,
Your project still does not run on my system (missing - nuget.org/v3/index.json).
Here are some code snippets I use.
The attachments contains 2 pdf files which shows the issue. There is also an image from a print preview included.
// create metafile C#
Graphics g = CreateGraphics();
IntPtr hdc = g.GetHdc();
MemoryStream ms = new MemoryStream();
Metafile mf = new Metafile(ms, hdc, EmfType.EmfPlusOnly);
g.ReleaseHdc(hdc);
g = Graphics.FromImage(mf);
g.CompositingMode = CompositingMode.SourceOver;
g.SmoothingMode = SmoothingMode.HighQuality;
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
Font fnt = new Font(“Microsoft Sans Serif”, 9f, FontStyle.Regular);
using (SolidBrush sb = new SolidBrush(ForeColor))
{
StringFormat stringFormat = new StringFormat()
{
Alignment = StringAlignment.Center,
LineAlignment = StringAlignment.Center
};
g.DrawString(“Please add a some text”, fnt, sb, new Rectangle(0, 0, 100, 100), stringFormat);
stringFormat.Dispose();
}
g.Dispose();
ms.Close();
ms.Flush();
ms.Dispose();
// create report (VB)
Dim rpt As New SectionReport
rpt.Document.Printer.PrinterName = e.DefaultPageSettings.PrinterSettings.PrinterName
rpt.Document.Printer.PrinterSettings = e.DefaultPageSettings.PrinterSettings
rpt.Document.Printer.DefaultPageSettings = e.DefaultPageSettings
rpt.PageSettings.Margins.Left = 0
rpt.PageSettings.Margins.Right = 0
rpt.PageSettings.Margins.Top = 0
rpt.PageSettings.Margins.Bottom = 0
Dim tmpPage As New Page()
Dim destRect As RectangleF
With destRect
.X = MmToInch(info.MmMargins.Left)
.Y = MmToInch(info.MmMargins.Top)
.Width = tmpPage.Width - MmToInch(info.MmMargins.Left + info.MmMargins.Right)
.Height = img.Height * .Width / img.Width
End With
tmpPage.DrawImage(img, destRect.X, destRect.Y, destRect.Width, destRect.Height)
rpt.Document.Pages.Add(tmpPage)
‘’ create preview
arvMain.Document = rpt.Document
‘’ create pdf
Dim pe As New Export.Pdf.Section.PdfExport
pe.Version = Export.Pdf.Section.PdfVersion.Pdf17
pe.ImageQuality = Export.Pdf.Section.ImageQuality.Highest
pe.NeverEmbedFonts = “” '“Times New Roman;Verdana”
pe.FontFallback = “Microsoft Sans Serif”
pe.Export(_rpt.Document, newname)
issues.zip