Link to home
Start Free TrialLog in
Avatar of mainrotor
mainrotor

asked on

I need help converting a Stream into a PDF document, in my C#.Net Windows Service

Hello Experts:

1. I need help converting a Stream into a PDF document, in my C#.Net Windows Service.
2. I need to save the newly created PDF document into the following location:  C:\MyClaims\

Here my current code.  I have a Stream variable named mergeClaims, which i need to create into a PDF doc.

                if (_rejectLetter.Count() > 0)
                {
                    foreach (var r in _rejectLetter)
                    {
                        int cdo =  r.CDO.Value;
                        long MisdirectedID = r.MisdirectedID;
                        string market = r.Market.ToString();
                        string healthplan = r.HealthPlan.ToString();
                        string GROUP_ID = r.GROUP_ID.ToString();
                        string runType = r.RunType.ToString();
                        string dcn = r.Intermediary_Claim_Number.ToString();
                        string ClaimType = r.ClaimType.ToString();

                        Utilities.GenerateMisdirectedLetter ltr = new GenerateMisdirectedLetter();
                        Stream coverLetter = ltr.CreateMisdirectedLetter(cdo, market, healthplan, runType);
                        new Utilities.DB(connRejLetter).insertMisdirectedPrintDate(MisdirectedID);

                        Utilities.getClaimForm claim = new Utilities.getClaimForm();
                        Stream Claim = new MemoryStream();
                        Claim = claim.ExportForm(dcn, ClaimType, true);

                        List<Stream> claims = new List<Stream>();
                        claims.Add(coverLetter);
                        claims.Add(Claim);
                        Stream mergeClaims = _pdf.mergePDFs(claims);  //NEED TO CONVERT THIS STREAM INTO A PDF
                    }
                }

Open in new window

Avatar of Chinmay Patel
Chinmay Patel
Flag of India image

What is the data in the stream? is it just text? or HTML? Also it seems you already have pdf generation ability (_pdf object), can you clarify a bit on the scenario you are trying to handle?

You can always use https://sourceforge.net/projects/itextsharp/ to generate PDFs from stream but some clarity on the background of your issue will really help.
ASKER CERTIFIED SOLUTION
Avatar of Shaun Vermaak
Shaun Vermaak
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial