cancel
Showing results for 
Search instead for 
Did you mean: 

New issue - programmatically export to PDF

Former Member
0 Kudos

Strange in the last week when clients now run a report from their desktop they get the following error:

C:\Users\GPAXXX~1\AppData\Local\Temp\JIYlAFCl.pdf.part could not be saved, because the source file could not be read.

Try again later, or contact the server administrator.

During the download/transfer from the server to the client system this error shows up at the same time as the Save or View Now dialog.

Any ideas or hints...???

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Yes - would make sense to provide addition details... this is a web based ASP.NET (v4) application.

Issue exist only in Firefox v33 browser.  It is when the file tries to temporarily write to the client machine.

Here is an example of the code (VB.NET) than generates the reports.  BTW again to be clear this all worked fine up until 10 days ago...

Code:

'===============================================================================================

Dim crExportOptions As ExportOptions = New ExportOptions()
Dim crDiskFileDestinationOptions As DiskFileDestinationOptions
crDiskFileDestinationOptions = New DiskFileDestinationOptions

If Request.QueryString("format") = "pdf" Then

Dim Fname As String
' The following code can be placed directly after
' the call to InitializeComponent() in the form’s constructor,
' or inside of a Button_Click event where the button is used
' by the client to get a printable copy of the report.

'ICReportPdfTemp = On server temp file creation
Fname = ICReportPdfTemp & Session.SessionID.ToString & ".pdf"

crDiskFileDestinationOptions.DiskFileName = Fname
crExportOptions = crReportDocument.ExportOptions
With crExportOptions
.DestinationOptions = crDiskFileDestinationOptions
.ExportDestinationType = ExportDestinationType.DiskFile
.ExportFormatType = ExportFormatType.PortableDocFormat
End With

crReportDocument.Export()
'' 'The following code writes the pdf file
'' 'to the Client’s browser.
szReportName = szReportName & ".pdf"
'crReportDocument.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, False, szReportName)
Dim szContent As String = Nothing
Dim szHeaderValue As String = Nothing
szContent = "content-disposition"
szHeaderValue = "attachment;filename=" & szReportName
Response.ClearContent()
Response.ClearHeaders()
Response.Buffer = True
Response.ContentType = "application/pdf"
Response.AddHeader("content-type", "application/pdf")
Response.AddHeader(szContent, szHeaderValue)
Response.WriteFile(Fname)
Response.Flush()
Response.Close()

' delete the exported file from disk
Try
If System.IO.File.Exists(Fname) Then
System.IO.File.Delete(Fname)
End If
Catch ex As Exception
'message for the alert
szMessage = "Cannot delete PDF temp file(information code #1651)" & "\n" & ex.Message & "\n\n INFORMATION"
strScript = "<script>alert('" & szMessage & "');</script>"
'run the alert
ClientScript.RegisterStartupScript(Me.GetType(), "ClientScript", strScript.ToString())
szRetval = "<font face='arial'><p>Was not able to delete PDF temp file.<br/>" & ex.Message & "</p></font><input onclick='window.close()'type='button' value='Close Window'>"
Response.Write(szRetval)
End Try
Response.End()
former_member183750
Active Contributor
0 Kudos

Hi Gary

Since the app works for a number of other users / clients, I suspect the code is not the issue. Two things I am missing though that may prove to be quite important:

The version of CR (perhaps the best place to find out is to look for the crpe32.dll)

The version of .NET (v4 just is not enough as this could be VS 2008, 2010, 1012, 2013)

Sorry, may appear retentive re the details, but they really are important.

- Ludek

Former Member
0 Kudos

Actually the real issue is Firefox v33

Under v32 not an issue...  though I have to find a work around.

Works fine with Opera, IE and Chrome.

Crystal for MSVS 13.0.10.1385 running on VS 2010 SP1

Thanks!

Gary

former_member292966
Active Contributor
0 Kudos

Hi Gary,

Can the user view this report in FireFox v33?

I have a feeling the newer version of FireFox added some security though I don't know what that would be.  Try resetting the options in FireFox back to default.

When the report is run, a temp file is created and the viewer works against the temp file.  The error indicates the temp file isn't available, this is why I would like to see if the report can be viewed or not.  If you can view it, it should export (in most cases).

I'm assuming the error is real and isn't a generic error that's thrown because it doesn't know why it erred out.

Sadly this is looking more like an issue on the FireFox side than Crystal but hopefully you get some ideas on where to proceed.

Good luck,

Brian

former_member183750
Active Contributor
0 Kudos

Looking at the Supported Platforms for CRVS:

I suspect that may be the core issue here(?). SP 12 should be released end of this week / mid next week and you can try that. I don't know what version of FF is tested on that SP yet.

- Ludek

former_member183750
Active Contributor
0 Kudos

By more context, I believe Ido means:

Version of CR - including any Service Packs

If this is an app - is it developed by you, or is it an app developed by some 3rd party?

What CR SDK was used to create the app?

Is the app win or web?

OS?

Browser?

That may do for starters... The more info, the better. I wrote a blog a long time ago that explains what is typically needed for a quick resolution:

- Ludek

Senior Support Engineer AGS Product Support, Global Support Center Canada

Follow us on Twitter

ido_millet
Active Contributor
0 Kudos

The title of your post implies the export is done by some application. But you provide no context. Consider posting to the related forum (Visual Studio?  Legacy?  Java?) and providing more context.