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

C#.NET App Servers

Avatar of undefined
Last Comment
Shaun Vermaak

8/22/2022 - Mon
Chinmay Patel

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
Shaun Vermaak

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Your help has saved me hundreds of hours of internet surfing.
fblack61