You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to print a file of type Metafile (ImageExportFormat.Metafile), but an error occurs when executing imageExport.Export(report, memoryStream);
If I change it to ImageExportFormat.Png or ImageExportFormat.Bmp the error does not occur.
Its a bug or a 'me' error?
The error is (for each page of the document):
System.ArgumentException: Parameter is not valid.
at System.Drawing.SafeNativeMethods.Gdip.CheckStatus(Int32 status)
at System.Drawing.Image.get_Height()
at FastReport.Export.Image.ImageExport.ExportPageBegin(ReportPage page)
at FastReport.Export.ExportBase.ExportPageNew(Int32 pageNo)
My code:
private void Print2()
{
var reportPath = Path.Combine(_webHostEnvironment.WebRootPath, "reports", "List.frx");
var report = new Report();
report.Load(reportPath);
report.RegisterData(_dataSet, _dataSet.DataSetName);
report.Prepare();
var imageExport = new ImageExport
{
ImageFormat = ImageExportFormat.Metafile, //changing to Png works
SeparateFiles = true
};
var metaFileStreams = new List<Stream>();
for (int i = 0; i < report.PreparedPages.Count; i++)
{
var memoryStream = new MemoryStream();
imageExport.PageRange = PageRange.PageNumbers;
imageExport.PageNumbers = (i + 1).ToString();
imageExport.Export(report, memoryStream);
memoryStream.Position = 0;
metaFileStreams.Add(memoryStream);
}
Log.Information($" -- files in memory: {metaFileStreams.Count}");
PrintMetaFileFromMemory(metaFileStreams);
}
I'm trying to print a file of type Metafile (ImageExportFormat.Metafile), but an error occurs when executing imageExport.Export(report, memoryStream);
If I change it to ImageExportFormat.Png or ImageExportFormat.Bmp the error does not occur.
Its a bug or a 'me' error?
The error is (for each page of the document):
My code:
The text was updated successfully, but these errors were encountered: