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 7028499
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:23:44+00:00 2026-05-28T00:23:44+00:00

I have a canvas that has a bitmap image of a document and several

  • 0

I have a canvas that has a bitmap image of a document and several textboxes in various places on it. The text boxes exist to block out the text behind it but also may contain text over top (imagine blocking out text in a confidential document). This all needs to be saved as a tiff file.

I have been able to save the image easily however saving the text boxes over top has proved to be the real challenge. Here is what I have currently.

//The document bitmap is the first item in the canvas
foreach (Control redaction in canvas.Children)
{
    Size sizeOfControl = new Size(redaction.Width, redaction.Height);
    renderBitmap = new RenderTargetBitmap((Int32)sizeOfControl.Width, (Int32)sizeOfControl.Height, 96d, 96d, PixelFormats.Pbgra32);
    renderBitmap.Render(redaction);
    tiffEncoder.Frames.Add(BitmapFrame.Create(frame));
}
FileStream fs = new FileStream(outputFileName, FileMode.Create);
tiffEncoder.Save(fs);
fs.Flush();
fs.Close();

When I don’t add the document bitmap to the tiffEncoder, it saves a black image, which tells me that it isn’t converting the text boxes correctly (or at least the way I want it to).

So is this even possible?

  • 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-05-28T00:23:45+00:00Added an answer on May 28, 2026 at 12:23 am

    Why do you render each control individually? Also you are not using renderBitmap but frame to add to the encoder (not sure where that comes from). This should render the canvas and all controls on it:

    var bm = new RenderTargetBitmap((int)canvas.Width, (int)canvas.Height,
                                    96d, 96d, PixelFormats.Pbgra32);
    tiffEncoder.Frames.Add(BitmapFrame.Create(bm));
    
    using (var fs = new FileStream(outputFileName, FileMode.Create))
    {
        tiffEncoder.Save(fs);
    }
    

    Also note that the canvas must be visible (so window must not be minimized) otherwise WPF won’t bother rendering it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a grid/canvas that has an element (say an icon with an image
I have a bitmap that has greater dimensions than the canvas to which it
I have a Silverlight user control that has several canvas controls within a Stack
I have a Canvas in a Flex application which has items inside it that
I have a Silverlight application which has on it a Canvas. On that Canvas,
I have a wpf application that has some shapes on a canvas I want
I created a custom object that has a Bitmap field. I'm drawing several of
Everyone, I have a WPF app that has a canvas that I have wrapped
I would like to have a Canvas that supports the DragDelta event. My first
I Have a canvas and would like to place silverlight elements within that canvas

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.