473,396 Members | 2,039 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Dynamic PDF in ASP.NET

1
Hello.



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

Try

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

Try

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

Else

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

System.IO.Directory.CreateDirectory(FolderPath)

End If



If User = "" Then

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

Else

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

System.IO.Directory.CreateDirectory(EmpFolderPath)

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)

P17Document.Append(Server.MapPath(Path))

P17Page = P17Document.Pages(x)



'Print P17 details

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



P17Page.Elements.Add(P17.Name)



P17Document.Draw(OutputFile)

P17Document.Draw(OutputEmpFile)

End If

Next i



Thanks.


[/u]
Sep 10 '07 #1
1 1781
jhardman
3,406 Expert 2GB
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.

Jared
Sep 10 '07 #2

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

Similar topics

0
by: Roel Wuyts | last post by:
CALL FOR CONTRIBUTIONS International Workshop on Revival of Dynamic Languages http://pico.vub.ac.be/~wdmeuter/RDL04/index.html (at OOPSLA2004, Vancouver, British Columbia, Canada, October...
0
by: Pascal Costanza | last post by:
Dynamic Languages Day @ Vrije Universiteit Brussel ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Monday, February 13, 2006, VUB Campus Etterbeek The VUB (Programming Technology Lab,...
5
by: bearophileHUGS | last post by:
I often use Python to write small programs, in the range of 50-500 lines of code. For example to process some bioinformatics data, perform some data munging, to apply a randomized optimization...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.