Skip to content
VeryPDF Knowledge Base

VeryPDF Knowledge Base

Knowledge Base to VeryPDF Products

  • Home
  • Products
    • PDF to Any Converter
      • PDF to Word Converter
      • PDF to Word OCR Converter
      • PDF to Excel Converter
      • PDF to Excel OCR Converter
      • PDF to Text Converter
      • PDF to Text OCR Converter
      • PDF to HTML Converter
      • PDF Extract TIFF
      • PDF to Image Converter
      • PDF to PowerPoint Converter
    • Any to PDF Converter
      • AutoCAD to PDF Converter
      • PCL to PDF Converter
      • Image to PDF Converter
      • Image to PDF OCR Converter
      • HTML to PDF Converter
      • Document Printer
      • Document Converter
      • PowerPoint to Flash Converter
      • PowerPoint Converter
      • Free Text To PDF Converter
      • Metafile To PDF Converter
      • Office to Any Converter
    • PDF Utilities
      • PDFcamp Printer
      • PDF Editor
      • PDF Password Remover
      • Encrypt PDF
      • PDF Stamper
      • PDF Print
      • PDF Form Filler
      • Advanced PDF Tools
      • PDF Split-Merge
      • PDF Size Splitter
      • PDF Manual Splitter
      • PDF Optimizer
      • PDF Crop
      • PDF to PDF/A Converter
      • PDF Batch Print
    • Graphics Tools
      • TIFF Toolkit
      • Raster to Vector Converter
      • PDF to Flash Flip Book Converter
      • Image to Text OCR Converter
    • Business & OCR
      • PDF to Excel Converter
      • PDF to Excel OCR Converter
      • Scan to Excel OCR Converter
      • PDF to Word Converter
      • PDF to Word OCR Converter
      • Scan to Word OCR Converter
      • Office to Any Converter
      • Screen OCR
      • TIFF Toolkit
    • Multimedia
      • Flash to Image Converter
      • PowerPoint to Video Converter
      • Flash to Animated GIF Converter
      • PowerPoint to Flash Converter
      • PowerPoint Converter
    • Virtual Printer
      • PDFcamp Printer
      • Document Printer
      • Document Converter
      • Mini EMF Printer Driver
    • Development
      • Doc Converter COM Component
      • PDF Editor OCX Control
      • PDF to Text Converter SDK
      • Image to PDF Converter SDK
      • Image to PDF OCR Shell
      • HTML Converter Command Line
      • PDF to Image Converter SDK
      • PCL to PDF Converter SDK
      • PDF Password Remover SDK
      • Encrypt PDF SDK
      • PDF Split-Merge SDK
      • PDF Stamp SDK
      • PDF Print SDK
      • PDF Form Filler OCX
      • Advanced PDF Tools SDK
      • PDF Editor Toolkit SDK
      • Document Converter SDK
    • Customization
      • Custom Development Solution
    • More >>
  • Solutions
    • Web Viewer Solution
    • Web Annotator Solution
    • OCR Solution
    • PDF to Office Solution
    • PDF Form Filler Solution
    • Document Security Solution
    • Printer Intercept and Capture
    • PDF Extraction Solution
    • Paperless Printing Solution
    • Document Conversion
    • PDF Digital Signature
    • More >>
  • Blog
    • Advanced PDF Tools
    • docPrint Pro
    • PDFcamp Printer
    • PDF Editor
    • PDF Print
    • OCR Products
    • HTML to PDF Converter
    • PDF to Image Converter
    • Image to PDF Converter
    • PDF to Word Converter
  • Company
    • About Us
    • Contact Us

How to edit Metadata of PDF File with C#?

Posted on 2013/10/182013/10/18Author Ada / 1108 Views

Question:I am searching for methods or libraries to edit metadata of a PDF file. I want to write a program and I need this option in this program. Perhaps you have some samples for c#. Is there any solution on VeryPDF?

Answer: When you need to edit metadata from C#, maybe you can have a free trial of this software VeryPDF Advanced PDF Tools SDK, by which you can edit metadata by two methods. Meanwhile the SDK version provides libraries to edit metadata of a PDF file. One method is that you can edit metadata by editing title, author and others separately  and the other is editing metadata by output metadata to XML file and then edit them in XML file. After editing, you can import XML file back to PDF file. Please get more information of this software on homepage, in the following part, I will show you how to use this software.

Contact Us for Custom Development Solutions
Response within 24 hours

Step 1. Free download Advanced PDF Tools SDK

  • Please download the SDK version as there are some code templates of calling this software from other programming languages.
  • When downloading finishes, please extract it to some folder then you can call it from C# more easily.

Step 2. Edit metadata from C#.

  • When you need to edit metadata from C#, you may need the following parameters, please have a check.
  • -t "Title"               : Set title
    -a "Author"          : Set author
    -s "Subject"          : Set subject
    -k "Keywords"     : Set keywords
    -d "CreatedDate"     : Set create date
    -m "ModifyDate"      : Set modify date
    -c "Creator"         : Set creator
    -p "Producer"      : Set producer
    -D                          : Write document summaries into PDF file in ASCII
    -e "MetaData"     : Set MetaData, select a XML file for set metadata or "" to clear metadata
    Here are some code templates:
    pdftools -i c:\input.pdf -e "c:\metadata.xml"
    pdftools -i c:\input.pdf -o c:\out.pdf -t title -s subject -l c:\err.log
    pdftools -i c:\input.pdf -t title -a author -k "123,456" -d "2003-11-11"
    pdftools -i c:\input.pdf -k "+PDF Tools"
    pdftools -i c:\pdfdir\*.pdf -o d:\ -s subject -k "book,rtf,doc,text,pdf"

  • Now let us check how to call it from C#.
  • #include <stdio.h>
    #include <string.h>
    #include <stdlib.h>
    #include <time.h>
    #include <io.h>
    #include <sys/types.h>
    #include <sys/stat.h>
    #include <conio.h>
    #include <ctype.h>
    #include <windows.h>

    __declspec(dllexport)
    int WINAPI VeryPDF_PDFTools(LPCTSTR lpCommand);
    void main()
    {
        char szCommandLine[1024];
        char *lpLicenseKey = "XXXXXXXXXXXXXX";
        sprintf(szCommandLine,""pdftools.exe \"-e="c:\metadata.xml"\
        \" -i \"%s\" -o \"%s\"",
        lpLicenseKey, "C:\\test.pdf", "C:\\_test.pdf");
        int nRet = VeryPDF_PDFTools(szCommandLine);

    }

Please note when you need to export XML file for editing metadata, please make sure import XML file back by the following command line template:
pdftools -i c:\input.pdf -o D:\out.pdf -e "c:\metadata.xml"

By this method, you can edit metadata from C# easily. During the using, if you have any question, please contact us as soon as possible.

Contact Us for Custom Development Solutions
Response within 24 hours

Related Posts

  • How to Add Custom Fields to PDF Files Using VeryPDF PDFTools (And Avoid Common Errors), with an emphasis on troubleshooting the issue of corrupted PDF files and field visibility in PDF viewers like Adobe Acrobat and NitroPDF Pro
  • View document and edit metadata
  • How to use CCITT G4 compression to reduce pdf size
  • Make pdf files opened in continuous-facing by using the Advanced PDF Tools
  • How to hide the menu bar and window controls of pdf reader
  • How to change size of PDF document to be customized paper?
  • Assemble pdf pages using command line

Related posts:

How to edit PDF titles by using Advanced PDF Tools?
Specify pages to process using command line
Edit pdf content of even number page using command line
Edit pdf content left offset of specified pages using command line
Edit pdf attachment using command line
Use flate monochrome to reduce pdf size
Use CCITT G4 compression to reduce pdf size
How to use VeryPDF tool to find whether a batch of PDF files are secured or not?
Category: Advanced PDF Tools Tag: edit metadata

Post navigation

Previous PostHow to compare two PDF files through command line?
Next PostCan a PDF be converted to a raster image format that can be printed from .VB?

Custom Development Services

VeryPDF offers customized development services to meet your unique business needs, including PDF Processing, Document Automation, Document Analysis, Format Conversion, OCR, DRM, Barcode Solutions, Virtual Printer, Digital Signature, AI Integration, and more. Contact us today to get a personalized solution!

Meta

  • Log in
  • Entries RSS
  • Comments RSS
  • VeryPDF.com
  • VeryDOC.com
  • VeryUtils.com
  • imPDF.com

Recent Solutions

  • image_thumb.pngPDF/A-3 vs ZUGFeRD: Custom PDF to PDF/A e-Invoice Development with VeryPDF
  • image_thumb.pngCustom PDF to PDF/A-3 + ZUGFeRD Development by VeryPDF (Simple Guide for Bu…
  • image_thumb.png[Solution] VeryPDF Virtual Printer Driver SDK OEM Licensing, Full Source Co…
  • image_thumb.png[Solution] Secure Redaction of PII and Sensitive Data from PDFs Without Clo…
  • image_thumb.png[Solution] VeryPDF AI-Powered Smart Redact Server Solution: Permanently Rem…

Recent Posts

  • image_thumb.pngHow to Automatically Convert PDF Customer Orders to Excel Using PDF to Exce…
  • image_thumb.pngPrint Management Software Needs PCL Preview? How to Convert PCL to PDF or I…
  • image_thumb.pngVeryPDF Virtual PDF Printer SDK for Windows: Bundle a PDF Virtual Printer I…
  • image_thumb.pngPCL Converter Command Line Developer License FAQ: Can I Redistribute It wit…
  • image_thumb.pngHow to Highlight Part Numbers in Large PDF Drawings Automatically (Mac and …

Categories

Archives

Calendar

October 2013
M T W T F S S
« Sep   Nov »
 123456
78910111213
14151617181920
21222324252627
28293031  
© 2026 VeryPDF Knowledge Base / VeryPDF.com / VeryDOC.com / VeryUtils.com / Support
Contact
Us