Skip to Content
Former Member
Feb 08, 2011 at 06:50 PM

Exporting to PDF format


Hi all,

How do I get CR to print to a file as in a PDF file.

Now I am printing on to a pre printed form.

I want to save it to a file called X.pdf (where X (var) is the Bill No which is a numeric field as in 12345.pdf or 4567.pdf)

and the x.pdf is to be saved into a folder called LabBills. If the x.pdf exisists in the folder then overwrite without prompting.

my Code:

Dim crFormulas As FormulaFieldDefinitions

Dim MyReport As New CrystalDecisions.CrystalReports.Engine.ReportDocument


Dim crFormulaTextField1 As FormulaFieldDefinition

Dim crFormulaTextField2 As FormulaFieldDefinition

crFormulas = MyReport.DataDefinition.FormulaFields

crFormulaTextField1 = crFormulas.Item("FrBlno")

crFormulaTextField2 = crFormulas.Item("FrDt")

crFormulaTextField1.Text = vBlno

crFormulaTextField2.Text = "'" & dtp1.Text & "'"

MyReport.PrintToPrinter(1, False, 0, 0)