VB.Net 2008, Creating PDF Files

Posted on 2013-06-26
Last Modified: 2013-07-05
Good Morning,

 I have a sub routine that creates a pdf file of a report that was created using Crystal Reports 2008.  I'm doing the following:

rptDoc.ExportToDisk(ExportFormatType.PortableDocFormat, g_strPDFPath & "\" & strFileName & "" & ".pdf")

The Issue:  Only on 2 machines (out of 40) do I have this issue.  Whenever they run this piece of code, they get an error that says <application name> has encountered a probelm and needs to close.  We are sorry for the inconvenience.

This only happens whne creating the PDF file.  I've tried commented out the displaying of the crystal report and just creating the pdf, that failed.  I tried commenting out the PDF and just displaying the crystal reprot and that worked.  I don't see why the above code is causing the issue.  Has anyone experienced this before??


Question by:transstates
  • 3
  • 2
  • 2
  • +2
LVL 42

Expert Comment

ID: 39278288
can u wrap with try/catch when calling ExportToDisk?
the exception will tell you where the problem is.
LVL 100

Expert Comment

ID: 39278342
What are the differences on the 2 machines?

I assume the PDF export modules are installed on them?


Author Comment

ID: 39278454
When putting it in a try catch, it appearently gets to the .ExportToDisk and they bombs and never logs a message.  It a hard crash that exits the program and takes the user back to the desktop.

I changed it up a little....


                Dim strFileName As String = "Remove" & " - " & cboPartNumber.Text
                With reportDocument1
                    .Load(g_strAssemblyChange) 'Path of the report
                    .ExportToDisk(ExportFormatType.PortableDocFormat, g_strPDFPath & "\" & strFileName & "" & ".pdf")
                End With

            Catch ex As Exception
                g_strCode = "ERR"
                g_strMessage = ex.Message.ToString()
                Call WriteErr(g_strCode, "Form1", "Printeport()", g_strMessage, "", ex.Message, 0)
                MsgBox("error has been written")
            End Try
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

LVL 100

Expert Comment

ID: 39278519
Have you tried other export types like Excel or Word?

LVL 15

Accepted Solution

Ess Kay earned 250 total points
ID: 39278602
reinstall crystal on the pc
LVL 18

Assisted Solution

vasto earned 250 total points
ID: 39278743
I guess the problem is not in your code. Try to show the report in a viewer ( on screen) and export to PDF from the viewer. If it fails again then you probably need to take time to fix Crystal runtime on these machines

Author Comment

ID: 39278841
I will try to reinstall crystal.  This may take a bit, I have to wait for the user(s) to be gone or at a break point.  I will respond as soon as I can.  Thank you all!!
LVL 18

Expert Comment

ID: 39278920
Try first to export from the viewer.
LVL 100

Expert Comment

ID: 39278987
Crystal isn't installed on a client.  

Is this running as a thick or thin client application?


Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Get Client IP on RDS - VB.NET 15 44
updating order of the rows, N+1 query issue, C#,, MVC, SQL Server 3 25
REXEX help Part 2 2 22
Powershell File Sort 8 24
In my previous two articles we discussed Binary Serialization ( and XML Serialization ( In this article we will try to know more about SOAP (Simple Object Acces…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question