Solved

VB.Net 2008, Creating PDF Files

Posted on 2013-06-26
9
384 Views
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??

Thanks,

Jim
0
Comment
Question by:transstates
  • 3
  • 2
  • 2
  • +2
9 Comments
 
LVL 42

Expert Comment

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

Expert Comment

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

I assume the PDF export modules are installed on them?

mlmcc
0
 

Author Comment

by:transstates
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....

Try

                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
0
 
LVL 100

Expert Comment

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

mlmcc
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 15

Accepted Solution

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

Assisted Solution

by:vasto
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
0
 

Author Comment

by:transstates
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!!
0
 
LVL 18

Expert Comment

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

Expert Comment

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

Is this running as a thick or thin client application?

mlmcc
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

708 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now