Exporting Crystal Report 8.5 file to PDF using VB6 Coding

When I export Crystal Report 8.5 File to PDF file through VB6 code export is successful but cannot open the PDF file.
Error: File does not begin with '%PDF-'.

If I export the same report file directly from crystal reports to PDF then I can open the PDF file.
VENKATGVRAsked:
Who is Participating?
 
chandursConnect With a Mentor Commented:
VenkatGVR, Dll you need to refer in your project is CRAXDRT.dll. It should show as "crystal report Viewer Control" in your project reference list. physical location of the file will be something like this "C:program files\seagate software\viewers\activeXviewer".
Let me know if this one helps or not
0
 
jhanceCommented:
A PDF file will begin with the characters:

%PDF-1.3

or similar.  The "1.3" represents the PDF version used and that may change.

It sounds like you're doing something wrong.  Why don't you post the code you are using as it might be easier to find your mistake.
0
 
VENKATGVRAuthor Commented:
Hi Jhance,

Here is my code.

CRPT.Destination = crptToFile
CRPT.PrintFileName = "C:\Analysis\Rpt001.PDF"
CRPT.PrintFileType = crptCSV
CRPT.Action = 2

The Crystal version I am using is 8.5 and the PDF version is 5.0.
The file Rpt001.pdf is created but Error: File does not begin with '%PDF-'.


Thanks.
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
jhanceCommented:
>>>CRPT.PrintFileType = crptCSV

That's asking for a CSV file, NOT a PDF.  How about trying:

CRPT.PrintFileType = crptPDF

instead?
0
 
VENKATGVRAuthor Commented:
Jhance,

I tried with CRPT.PrintFileType = crptPDF, it gives error....!
0
 
jhanceCommented:
What error?
0
 
chandursCommented:
Try this program, which used Craxdrt control
dim crapp as craxdrt.application
dim crRpt as craxdrt.report
 set crRpt = crapp.openreport("your reportname")
crRpt.exportoptions.formattype=crEFTPortableDocFormat
crRpt.Exportoptions.DestinationType=crEDTDiskFile
crRpt.Exportoptions.DiskFileName = "pdf Filename with path"

CrRpt.Export False

You have to add reference to CRAXDRT dll in your project
0
 
assystCommented:
Try this....

Disable the "Display PDF in Browser" option in your reader software.

Use Start - Programs - Adobe Reader to run the program directly (instead of embedded inside the web browser).
Pull down the Edit menu and choose Preferences.
In the Internet settings page, de-select (uncheck) the "Display PDF in Browser" option.
0
 
VENKATGVRAuthor Commented:
Hi Chandu,
To declare as craxdrt.application what Reference I should add in VB project..
0
 
VENKATGVRAuthor Commented:
Hi Assyst,
I did as what you said but still I get the same error.
0
 
assystCommented:
Whats your Adobe reader version.

Please try installing Adobe Reader 7

And try opening the file after exporting from crystal report.
0
 
VENKATGVRAuthor Commented:

ThanQ..!

Right now I am using version 5.
I'll install version 7 and test.
0
 
VENKATGVRAuthor Commented:
Assyst,

I installed Version 7, but still says file is currepted when I open the exported file.
0
 
VENKATGVRAuthor Commented:

Chandu,
ThanQ..!
I'll do that and let you know.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.