15-11-15, 09:16 PM
السلام عليكم ورحمة الله
أخي عدنان
كما ذكر لك الأخوة، بالامكان استغلال Microsoft Reports لتحويل الصور إلى ملفات بصيغة PDF،
والكود التالي يقوم بذلك بعد أن تقوم بـ:
إنشاء تقرير وتضيف فيه Parameter باسم ImagePath
وصورة تربطها بال ImagePath
ثم تضيف ReportViewer للفورم وتربط التقرير به
أخي عدنان
كما ذكر لك الأخوة، بالامكان استغلال Microsoft Reports لتحويل الصور إلى ملفات بصيغة PDF،
والكود التالي يقوم بذلك بعد أن تقوم بـ:
إنشاء تقرير وتضيف فيه Parameter باسم ImagePath
وصورة تربطها بال ImagePath
ثم تضيف ReportViewer للفورم وتربط التقرير به
PHP كود :
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If PictureBox1.Image IsNot Nothing Then
Dim tmpFilename As String = IO.Path.GetTempFileName & ".jpg"
PictureBox1.Image.Save(tmpFilename)
ReportViewer1.LocalReport.EnableExternalImages = True
ReportViewer1.LocalReport.SetParameters(New Microsoft.Reporting.WinForms.ReportParameter("ImagePath", tmpFilename))
ReportViewer1.RefreshReport()
Using saveFile As New SaveFileDialog
saveFile.Filter = "PDF files (*.pdf)|*.pdf"
If saveFile.ShowDialog = Windows.Forms.DialogResult.OK Then
Dim pdfContent As Byte() = ReportViewer1.LocalReport.Render("PDF", Nothing, Nothing, Nothing, Nothing, Nothing, Nothing)
IO.File.WriteAllBytes(saveFile.FileName, pdfContent)
End If
End Using
End If
End Sub
