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

  • Home
  • SEARCH
  • 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 6572865
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:03:35+00:00 2026-05-25T15:03:35+00:00

I am developing an application and i use the iTextSharp library. I am also

  • 0

I am developing an application and i use the iTextSharp library.

I am also reading the iText in action from Manning so i can get references.

In Chapter 12 it has the following code to change the metadata in Java.

PdfReader reader = new PdfReader(src);
PdfStamper stamper =
new PdfStamper(reader, new FileOutputStream(dest));
HashMap<String, String> info = reader.getInfo();
info.put("Title", "Hello World stamped");
info.put("Subject", "Hello World with changed metadata");
info.put("Keywords", "iText in Action, PdfStamper");
info.put("Creator", "Silly standalone example");
info.put("Author", "Also Bruno Lowagie");
stamper.setMoreInfo(info);
stamper.close();

How can i do the same in C#?

  • 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-25T15:03:36+00:00Added an answer on May 25, 2026 at 3:03 pm

    Conversion from Java to C# is usually pretty straightforward. By convention, Java properties use get and set prefixes so to convert to C# you just need to drop the prefix and turn it into a .Net getter/setter call. getInfo() becomes Info and setMoreInfo(info) becomes MoreInfo = info. Then you just need to convert the native Java types to their equivalent C# types. In this case the Java FileOutputStream becomes a .Net FileStream and the HashMap<String, String> becomes a Dictionary<String, String>.

    Lastly, I’ve updated the code to reflect recent changes to iTextSharp that now (as of 5.1.1.0) implement IDisposable now.

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Windows.Forms;
    using System.IO;
    using iTextSharp.text;
    using iTextSharp.text.pdf;
    
    namespace WindowsFormsApplication1
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }
    
            private void Form1_Load(object sender, EventArgs e)
            {
                string workingFolder = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
                string inputFile = Path.Combine(workingFolder, "Input.pdf");
                string outputFile = Path.Combine(workingFolder, "Output.pdf");
    
                PdfReader reader = new PdfReader(inputFile);
                using(FileStream fs = new FileStream(outputFile, FileMode.Create, FileAccess.Write, FileShare.None)){
                    using (PdfStamper stamper = new PdfStamper(reader, fs))
                    {
                        Dictionary<String, String> info = reader.Info;
                        info.Add("Title", "Hello World stamped");
                        info.Add("Subject", "Hello World with changed metadata");
                        info.Add("Keywords", "iText in Action, PdfStamper");
                        info.Add("Creator", "Silly standalone example");
                        info.Add("Author", "Also Bruno Lowagie");
                        stamper.MoreInfo = info;
                        stamper.Close();
                    }
                }
    
                this.Close();
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

While developing a C++ application, I had to use a third-party library which produced
I am developing an application to use httpconnection to get some data to a
I am thinking about developing Winforms application that would use c library to preform
I'm developing an application which make use of display lists offered by OpenGL. My
I am developing an application that needs to use regini (because of legacy reasons)
I am developing an iPhone application and I use HTML to display formatted text.
I am developing an application in which I want to use push notification service.
I am developing an application using Asp.net mvc and jquery. I'd like to use
I'm developing a web application I want to use the role authentication to control
I am developing a Win32 application and I would like to use an RSA

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.