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

HemlockPrinters
HemlockPrinters used Ask the Experts™
on
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?
thanks.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2011
Commented:
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
http://kenhamady.com/cru/comparisons/crystal-reports-viewers
If you would like to automate the process you can check this list of Crystal Schedulers
http://kenhamady.com/cru/comparisons/desktop-scheduling-engines

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

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

mlmcc
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
CrReportDocument.Export()

Open in new window

Senior .Net Consultant
Top Expert 2016
Commented:
if you build your own application in .Net, you can export to PDF and surely retrieve the invoice number. Have a look at http://emoreau.com/Entries/Articles/2006/10/Crystal-Reports--Part-II.aspx 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