سلام
به نظر میاد در ابتدا باید گزارش رو به فایل PDF تبدیل کنی و سپس فایل PDF رو به تصویر
روش تبدیل به PDF درRuntime
Export a report to PDF at runtime (Dynamically)
How to generate a report to PDF... I had this requirement and after my research i came up with this.
You can generate a PDF by Using a Crystal Report and piece of code....
First: Generate a Crystal Report as per your requirements.
Second: Use the below code to generate the PDF.
Place the following name spaces at the top of the code page
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Variable Declaration
Dim CrReport As New CrystalReport1() ' Report Name
Dim CrExportOptions As ExportOptions
Dim CrDiskFileDestinationOptions As New DiskFileDestinationOptions()
Dim CrFormatTypeOptions as New PdfRtfWordFormatOptions()
Set the destination path and file name
CrDiskFileDestinationOptions.DiskFileName = "c:\RichText.pdf"
Specify a page range (optional)
crFormatTypeOptions.FirstPageNumber = 1 ' Start Page in the Report
crFormatTypeOptions.LastPageNumber = 3 ' End Page in the Report
crFormatTypeOptions.UsePageRange = True
Set export options
CrExportOptions = crReport.ExportOptions
With CrExportOptions
Set the destination to a disk file
.ExportDestinationType = ExportDestinationType.DiskFile
Set the format to PDF
.ExportFormatType = ExportFormatType.PortableDocFormat
Set the destination options to DiskFileDestinationOptions object
.DestinationOptions = CrDiskFileDestinationOptions
.FormatOptions = crFormatTypeOptions
End With
Trap any errors that occur on export
Try
Export the report
CrReport.Export()
Catch err As Exception
MessageBox.Show(err.ToString())
End Try
Thats it.... Now you are ready to create a PDF of the Report.
Hope it will be useful...
Plz add your comments and suggestions about the Article.
توسط این ابزار هم میتونی فایل PDF رو با هر فرومت عکس ذخیره کنی و کار های دیگه
البته این ابزار DEMO است .
http://www.tallcomponents.com/defaul...erizer2&ref=34
دانلود :
http://www.tallcomponents.com/defaul...ownload=200030
// open the PDF document
Document document = new Document( "test.pdf" );
// get the first page
Page page = document.Pages[0];
//create a raster image at 72 dpi
Bitmap bitmap = new Bitmap( (int) page.Width, (int) page.Height );
// wrap a graphics around the bitmap
Graphics graphics = Graphics.FromImage( bitmap );
// do the actual rendering
page.Draw( graphics );
// save the result as a bmp - could be any format
bitmap.Save( "test.bmp", ImageFormat.Bmp );