By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,706 Members | 2,046 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,706 IT Pros & Developers. It's quick & easy.

Dynamic PDF in ASP.NET

P: 1

I am working on a project where users can automatically create personnel advices on the mainframe through a .NET Web Service.

My current problem is that I am trying to call a function multiple times to write out the advices to different folder, based on the color sent to the function. However, the program only writes the advices out to one folder. Can you help based on the code that I am attaching to the email?


Public Function DoAciFunction(ByVal Key As String, ByVal Flag As String, ByVal UserID As String, ByVal ChgType As String, ByVal OrgPH As String, ByVal DocType As String) As String

Dim SendKey As String = " " & Key

Dim Color As String = "Blank"

Dim ColorFile As String = "Goldenrod"

Dim ColorPayroll As String = "Yellow"

Dim ColorBenefits As String = "Green"

Dim z As Integer

Dim PDFColor()

PDFColor(0) = Color

PDFColor(1) = ColorFile

PDFColor(2) = ColorPayroll


For z = 0 To 2

If PDFColor(z).GetValue = 0 Then

Exit For

End If

CreateP17PDF(Flag, UserID, SendKey, PDFColor(z)) ‘This is supposed to happen 3 times!!!!!!

Next z

Dim TestKey As String = Flag & SendKey & OrgPH

Return "0000" & TestKey 'Run without errors.

Catch ex As Exception

DoAciFunction = ex.ToString

Dim TestKey As String = Flag & SendKey & OrgPH

Return "999X" & ex.Message & TestKey 'Run with errors.

End Try

Public Function CreateP17PDF(ByVal FlagCode As String, ByVal User As String, ByVal Key As String, ByVal Color As String) As String


imp = ImpersonationHelper.Impersonate("SCDOT", Me.GetType(), "SCDOT")

For i = 0 To P17.EMP.Length - 1

If Trim(P17.EMP(i)) = "" Then

i = P17.EMP.Length


DocName = "P17" & Mid(Key, 4, 4) & Mid(Key, 2, 2) & Trim(P17.ORG(i)) & Mid(P17.PH(i), 2, 2) & Trim(P17.EMP(i)) & "A" & Trim(P17.LCX(i)) & ".pdf"

Select Case Color

Case "Blank"

FolderPathColor = "Original\"

Case "Goldenrod"

FolderPathColor = "File\"

Case "Yellow"

FolderPathColor = "Payroll\"

Case Else

FolderPathColor = "Original\"

End Select

FolderPath = P17Doc() & "\" & Mid(Key, 4, 4) & Mid(Key, 2, 2) & FolderPathColor ‘This is supposed to print out to three different folders.

If Not System.IO.Directory.Exists(FolderPath) Then


End If

If User = "" Then

DocEmpName = P17.EMP(i) & "ET.pdf"


DocEmpName = P17.EMP(i) & "U" & User & ".pdf"

End If

'DocEmpName = P17.EMP(i) & ".pdf"

EmpFolderPath = P17Doc() & "\" & Mid(Key, 4, 4) & Mid(Key, 2, 2) & FolderPathColor & "\EmployeeIDs\"

If Not System.IO.Directory.Exists(EmpFolderPath) Then


End If

OutputFile = FolderPath & DocName

OutputEmpFile = EmpFolderPath & DocEmpName

Dim x As Integer = 0

Dim P17Page As ceTe.DynamicPDF.Page

Dim P17Document As New MergeDocument

Dim Path As String

P17PageDims = New PageDimensions(PageSize, PageOrientation)

P17PageDims.LeftMargin = LeftMargin

P17PageDims.RightMargin = RightMargin

P17PageDims.TopMargin = TopMargin

P17PageDims.BottomMargin = BottomMargin

Select Case Color ‘These are the different forms that the web service is pulling, based on the color sent.

Case "Blank"

Path = "BlankForms\P-17Blank.pdf"

Case "Goldenrod"

Path = "BlankForms\P-17File.pdf"

Case "Yellow"

Path = "BlankForms\P-17Payroll.pdf"

Case Else

Path = "BlankForms\P-17Blank.pdf"

End Select

P17Page = New Page(P17PageDims)


P17Page = P17Document.Pages(x)

'Print P17 details

P17Name = New Label(P17.NAME(i), colName, Row1, Width(cwName), LineSize, Font, FontSize, Left)




End If

Next i


Sep 10 '07 #1
Share this Question
Share on Google+
1 Reply

Expert 2.5K+
P: 3,405
Hi, Murdla, and Welcome to the Scripts Developer Network.

We have several technical forums here (this isn't one of them), and it looks like your question belongs in the .NET forum. I'll see if I can move it along for you.

Sep 10 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.