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

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.
HemlockPrintersAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

vastoCommented:
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 ConsultantCommented:
Agree.  You could also create your own application to do the export.

mlmcc
frankhelkCommented:
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

Éric MoreauSenior .Net ConsultantCommented:
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.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows 7

From novice to tech pro — start learning today.