Posts

Showing posts from May, 2011

How to add standard and custom Metadata to PDF using iTextSharp

In a previous blog, I explained How to add custom metadata using Syncfusion library. But this package gives so many difficulties when adding metadata to pdf. Such problems are,    1. When once add custom meta data to a pdf, it does not able to change or remove those custom meta data from the pdf.    2. It does not compatible with meta data search engines. It does not show custom meta data properly when those are searched through the search engines. Due to these reasons, Syncfusion is not good library for custom meta data. But, iTextSharp provides flexible framework to deal with custom meta data as well as standard meta data for PDF. Below I have provided the source code to show usage of iTextSharp library. You can download iTextShrp.dll from here                              PdfReader pdf = new PdfReader(input_path); ...

How To Kill WinWOrd Process In C#

When You open MS Word Document pro-grammatically using 'Microsoft.Office.Interop.Word', you are creating 'winword' process. So after dealing with opened MS Word document  pro-grammatically though you close it using 'close' method, the 'winword' process is not terminating, it is still running on your OS. So you have to terminate it in the end of the program otherwise, it creates so many 'winword' processes for each time you open MS Word document and you may face to memory problems later.  You can use below code to kill 'Winword' process. foreach (System.Diagnostics.Process p in System.Diagnostics.Process.GetProcessesByName("winword"))             {                 if (!p.HasExited)                 {             ...

DSOFile.SummaryProperties.DateCreated

When we want to get the Created Date Meta Date from MS Document we can use ' DSOFile.SummaryProperties.DateCreated ' instance variable. This variable is given the date of file is originally created.                     System.IO.FileInfo file = new System.IO.FileInfo(@""+input_path);                     string creation_date = file.CreationTime.ToString(); This creation date does not mean originally created date of the document. For example, Consider I create MS Word document and save it in 'D' Storage of the memory and then I copy and paste it into MyDocument. Then the created date of copied document is considered as the copied time in above code. But, ' DSOFile.SummaryProperties.DateCreated ' is taking created date as the date of document originally created in Location 'D'

How To Add & Get Custom Meta Data To PDF or PDF/A

Here I use Syncfusion.Pdf.Base.dll to add custom meta data to PDF type documents. This DLL uses XMP based framework to define document properties for Adobe type documents. It is based on RDF which is W3C standard for XMP based Meta data. A dobe designed the st a nd a rd XMP schem a s. a mework permits the in tegr a tion of a ny schem a th a t is structured in a ccord a nce with the specific a tion. Some Examples for Adobe XMP Schemas   XMP Basic Schema   Adobe PDF Schema   Dublin Core Schema   Custom Schema      You can get more info from : http://www.pdfa.org/doku.php?id=artikel:en:pdfa_metadata          Now We Will See How To Deal with Meta Data using Syncfusion.Pdf.Base.dll First make a reference to particular DLL (Select & Right click on the project name in 'solution explorer' -> Add Reference ->  Browse -> Give the path of DLL) Then add this source code to code file ...

How to Add Metadata to MS Word Document In C#

We can use DSOFile.dll to add metadata to MS Word Document or any other type MS Documents such as MS Excel, MS Powerpoint  and Images. Not only standard meta data such as created date, author, subject, category it also supports to add custom meta data. You can download  Microsoft Developer Support OLE File Property Reader 2.1 Sample (KB 224351) and get the DSOFile.dll from here Setup DSOFile.dll Create a new project in visual studio. File -> New ->Project -> select console application in 'New Project' wizard. Then Give suitable name and browse particular location to save project. then select References from Solution Explorer and Right Click on it. Select 'Add Reference' and select COM-> DSO OLE Document Properties Reader 2.1, click 'ok' Create the source code to add meta data Select on the Project name in solution explorer and right click on it. Add -> New Item -> Code File and give suitable name. Then add this code to it...