Writing Code
 Crystal Reports Forum : Crystal Reports for Visual Studio 2005 and Newer : Writing Code
Message Icon Topic: Exporting PDF from winforms into Intranet Post Reply Post New Topic
Author Message
tgreenstreet
Newbie
Newbie
Avatar

Joined: 19 Nov 2007
Location: United States
Online Status: Offline
Posts: 2
Quote tgreenstreet Replybullet Topic: Exporting PDF from winforms into Intranet
    Posted: 19 Nov 2007 at 10:59am
Help, please!
 
I have a VB.NET 2005 application with a Crystal Report that loads and prepares data, prints directly to the printer, and then exits.
 
Before printing, I need it to export a PDF copy (automatically, without user awareness or intervention) to an Intranet address like http://mycompanysite/my%20documents%20list/
 
Could someone please help with the code for doing this export?  Thanks!
 
--Taf Greenstreet
 
IP IP Logged
tgreenstreet
Newbie
Newbie
Avatar

Joined: 19 Nov 2007
Location: United States
Online Status: Offline
Posts: 2
Quote tgreenstreet Replybullet Posted: 29 Nov 2007 at 11:17am
Okay, I found the solution.
 
Because ExportToDisk will not write to anything but a local disk resource, I found the UNC path to my Intranet storage folder.  That allowed me to use ExportToDisk to write to my C:\ and then use the integrated Windows I/O abilities to copy it to the UNC path.  Below is a sample of the code I used.
 

Dim strExportPath As String = "\\servername\folder parent\target folder\"

Dim strExportFile As String = "DocumentName.pdf"

Dim localCopy As String = "C:\" & strExportFile

Dim remoteCopy As String = strExportPath & strExportFile

objReport.ExportToDisk(ExportFormatType.PortableDocFormat, localCopy)

FileIO.FileSystem.CopyFile(localCopy, remoteCopy, False)

FileIO.FileSystem.DeleteFile(localCopy)



Edited by tgreenstreet - 29 Nov 2007 at 11:19am
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.015 seconds.