auto assign pdf file name when print crystal report to PDF using PDF printer

HemlockPrinters used Ask the Experts™
We have crystal report which generate Invoice for our clients, crystal report's  name is invoice.rpt.  When crystal report is created and print to PDF file, the default pdf file name is invoice.pdf.
is there a way to change the pdf name to the invoice number (which is a variable inside crystal report)?
for example, we open inovice.rpt to create a invoice 10000, can we print to pdf file and name set to 1000 by default, instead of invoice.pdf?
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2011
You cannot do this from Crystal reports. You can use 3rd party tool though.
If you are printing the invoice manually you can check this list of Crystal viewers
If you would like to automate the process you can check this list of Crystal Schedulers

There are some free, but even the paid will return the money very fast.
Mike McCrackenSenior Consultant
Most Valuable Expert 2011
Top Expert 2013

Agree.  You could also create your own application to do the export.

If you roll your own application to generate the report via the CR viewer object, you could set that quite simple. Have a look at the help documents from BusinessObjects (now SAP) here and here for details.

The interesting parts of the code look like

Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared


Dim crReportDocument As World_Sales_Report
Dim crExportOptions As ExportOptions
Dim CrDiskFileDestinationOptions As DiskFileDestinationOptions


CrDiskFileDestinationOptions = New DiskFileDestinationOptions()
CrDiskFileDestinationOptions.DiskFileName = “C:\exported.pdf”
CrExportOptions = crReportDocument.ExportOptions
With crExportOptions
    .DestinationOptions = crDiskFileDestinationOptions
    .ExportDestinationType = ExportDestinationType.DiskFile
    .ExportFormatType = ExportFormatType.PortableDocFormat
End With

Open in new window

Senior .Net Consultant
Top Expert 2016
if you build your own application in .Net, you can export to PDF and surely retrieve the invoice number. Have a look at for the export to PDF.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial