on 05-20-2014 10:38 PM
I'm having trouble creating PDF files in a Web Forms app deployed to a new server. I've done this successfully a few times using apparently identical configurations, so I'm not sure what's going on. Facts about the situation:
1. PB Classic 12.5.1 Web Forms target
2. IIS 7.5 on a remote Windows Server 2008 R2 server
3. Ghostscript 8.71
4. To determine whether Ghostscript was the problem, I installed a Win32 version of the PB app on the IIS server computer and tested. SaveAs() works as expected in the Win32 target.
5. To determine whether file system permissions were a problem, I used the Web Forms app to SaveAs() a text document and performed the DownloadFile(). The file downloads as expected.
6. It is the SaveAs() function call that is failing. The line
dw_report.SaveAs(<filename>, PDF!, FALSE)
returns -1
Thanks in advance for any suggestions...
Hi all,
1) Install GS (I use GS 8.64)
2) Add the instalation folder to your system path
3) Create a system variable named GS_DLL and point it to BIN folder of the instalation folder of GS
4) If IIS 7.5 then go to IIS manager, go to Application Pools. On PBAppPool right clic, then select Advanced and change the value of Identity of Proccess Model to NetWorkService.
5) Install PS printer using the INF from the LIB folder of GS instalation folder
6) Verify IIS_USER privileges.
Step 4 very important for IIS 7.5.
HTH
__________________
AUS Julán Tagarro
NeoSistemas SRL
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ronnie,
Here is some code that I use in a webform application to create a PDF file and send it as an attachment. Remember that you have to do MapVirtualPath so you can find the file after you do dw_1.saveas...
Also, when I had trouble it was because I named my printer 'Sybase Datawindow' instead of 'Sybase Datawindow PS'.
Chris Pollach recently posted some great step by step installation procedures for 32 and 64 bit machines.
Best,
Paul
//Email Datawindow Saved As PDF Button
long random_number
string random_number_string
randomize( cpu() )
random_number = rand(9999)
random_number_string = string(random_number)
string user_id
user_id = trim(email)
string bodytext
bodytext = 'Dear XXX, ' + '~r~n' + '~r~n' + 'Please find attached the XXX report in PDF format.' + '~r~n' + '~r~n' + 'Thank you,' + '~r~n' + '~r~n' + 'XXX' + '~r~n' + '1-888-888-8888'
string filename
string filepathname
//create the path to use LATER for the attachment
#if defined PBWEBFORM then
filepathname = MapVirtualPath("c:\XXX-Detailed-" + trim(report_name) + "-" + random_number_string + ".pdf")
//create the path and filename to use NOW and save the file in the virtual directory
filename = "c:\XXX-Detailed-" + trim(report_name) + "-" + random_number_string + ".pdf"
long returncode
returncode = dw_1.SaveAs(filename,PDF!,false)
if returncode = 1 then
string subject
subject = "XXX Report-"+report_name
string fromaddresstext
fromaddresstext = "xxx@xxx.com"
System.Net.mail.MailMessage message
message = create System.Net.mail.MailMessage
message.subject = subject
message.body = bodytext
System.Net.Mail.MailAddress fromaddress
fromaddress = create System.Net.Mail.MailAddress("xxx@xxx.com", "XXX Operations")
message.From = fromAddress
System.Net.Mail.MailAddress toaddress
message.To.Add(user_id);
System.Net.Mail.Attachment attach
attach = create System.Net.Mail.Attachment(filepathname,"application/pdf");
//Helper.Mail.AddAttachment(message, attach)
message.Attachments.Add(attach);
System.Net.Mail.SmtpClient smtpclient
smtpclient = create System.Net.Mail.SmtpClient
smtpclient.host = "xxx.xxx.com"
smtpclient.port = 25
//smtpclient.send(message)
TRY
smtpclient.send(message)
CATCH (System.Net.Mail.SmtpException ex )
MessageBox( "SMTP Error", "Sorry. There is a problem sending the XXX email. " + ex.Message )
END TRY
mle_1.text = "XXX Report has been emailed to : " + user_id
else
mle_1.text = "Sorry, there was a problem generating the file."
destroy message
destroy smtpclient
end if
#end if
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ron;
Since this is W2008R2 and IIs 7.5 - my guess is that its either an issue with ...
1) IIS_USER privileges on the `Virtual Folder`for the Webforms application.
2) GS`s `BIN` folder is not in the System Path
3) You did not create a GS_DLL environment variable
or
4) IIS_User does not have privileges on the `Sybase Datawindow PS' printer.
Sorry that I can not be more specific as I use IIS 7.5 & W2008R2 with Appeon.
Appeon has built-in PDF support and does not need GS.
Good luck!
Regards ... Chris
User | Count |
---|---|
76 | |
9 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.