Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8796905
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:43:47+00:00 2026-06-13T23:43:47+00:00

I am fundamentally doing something wrong here within this loop. The first time through

  • 0

I am fundamentally doing something wrong here within this loop. The first time through the loop, the Stream works fine, but subsequent times through the loop fail with the Stream being corrupted. I know am probably doing something silly. I tried to set the updateTemplate to 0 each time but the InputStream doesn’t support the seek. I am basically appending multiple forms that are filled in onto a List here. Any suggestions would be appreciated, especially ones that would result in better performance.

...
files.Add(PDFhelper.fillTemplate(template, mappings));

foreach (Update u in myObject.Updates)
{
    mappings = this.GenerateFieldMappings(u);
    Stream output = new MemoryStream();
    template.CopyTo(output);
    files.Add(PDFhelper.fillTemplate(output, mappings)); //First time stream is good  

}

return PDFhelper.MergeFiles(files);

...
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T23:43:48+00:00Added an answer on June 13, 2026 at 11:43 pm

    Well, here is one solution I found. although, I don’t find it very efficient. It does get the job done.

    files.Add(PDFhelper.fillTemplate(mainTemplate, mappings));
    byte[] templateData = updateTemplate.ReadToEnd();
    
    foreach (Update u in myobject.Updates)
    {
        mappings = this.GenerateFieldMappings(u);
        MemoryStream output = new MemoryStream();
        output.Write(templateData, 0, templateData.Length);
        output.Position = 0;
        files.Add(PDFhelper.fillTemplate(output, mappings));
    
     }
    
     return PDFhelper.MergeFiles(files);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I must be doing something fundamentally wrong here. I've got very simple code: private
I must be doing something fundamentally wrong, my implementation methods for the UITextViewDelegate aren't
I think i've run into a confused state where i'm doing something fundamentally wrong,
This can be easily repeated on the official examples here: http://www.jacklmoore.com/colorbox/example1/ Open the first
Fundamentally, what I want to do is within, for example, ViewControllerA display ViewControllerB and
i'm missing something fundamental here. i have a very simple custom class that draws
I have an unordered list (each list element contains some further markup but this
I think I'm missing something very fundamental here. I've created a UserControl with a
This hangs in Php (5.2.6-Win32 + Oracle10g) is it a bug, or I'm doing
VB.NET 2010, .NET 4 Hello, I tried running code analysis the first time and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.