Hi!
I have a VB.Net program that currently exports a report to a pdf file. The problem is that it comes out funny looking. For some reason the export capability for PDF files just isn't quite perfect yet.
However, when I manually print the report to a pdf file using the "Adobe PDF" printer, it comes out fine. So, what I'd like to do is change the VB.Net program so it prints to a PDF file. However, I can't figure out how to specify an output filename within the code. Here's the original code:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
strPDFFilename = "\TodaysReport.pdf"
rpt.Load("c:\CrystalReports\TodaysReport.rpt", OpenReportMethod.OpenReportByTempCopy)
rpt.ExportToDisk(ExportFormatType.PortableDocFormat, strPDFFilename)
Application.Exit()
This works, but the output has some formatting problems.
So I need to replace the export file code with the following:
rpt.PrintOptions.PrinterName = "Adobe PDF"
rpt.PrintToPrinter(1, True, 1, 999)
However, I don't know how to specify the output file name for the PDF file.
Any guidance would be greatly appreciated.
Thanks!
Karen Grube
klgrube@yahoo.com
I have a VB.Net program that currently exports a report to a pdf file. The problem is that it comes out funny looking. For some reason the export capability for PDF files just isn't quite perfect yet.
However, when I manually print the report to a pdf file using the "Adobe PDF" printer, it comes out fine. So, what I'd like to do is change the VB.Net program so it prints to a PDF file. However, I can't figure out how to specify an output filename within the code. Here's the original code:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
strPDFFilename = "\TodaysReport.pdf"
rpt.Load("c:\CrystalReports\TodaysReport.rpt", OpenReportMethod.OpenReportByTempCopy)
rpt.ExportToDisk(ExportFormatType.PortableDocFormat, strPDFFilename)
Application.Exit()
This works, but the output has some formatting problems.
So I need to replace the export file code with the following:
rpt.PrintOptions.PrinterName = "Adobe PDF"
rpt.PrintToPrinter(1, True, 1, 999)
However, I don't know how to specify the output file name for the PDF file.
Any guidance would be greatly appreciated.
Thanks!
Karen Grube
klgrube@yahoo.com