c# - Chinese characters instead of text into the metadata called "Producer" -


i have problem when edit metadata of pdf itextsharp. save word document in pdf word. field called "producer" filled word text "microsoft word 210". after, edit metadata itextsharp , itextsharp tries edit field in order add text "modified using itextsharp 4.1.6".

the result producer(þÿmicrosoft® word 2010; modified using itextsharp 4.1.6 1t3xt). in adobe reader, field pdf producer in document properties shows chinese characters.

adobe can read field if remove manually characters þÿ.

do know why have problem ? can solve problem ?

just reference, works itext 2.1.7. java code, works c#.

    import java.io.file; import java.io.fileoutputstream;  import org.junit.test;  import com.lowagie.text.pdf.pdfdictionary; import com.lowagie.text.pdf.pdfname; import com.lowagie.text.pdf.pdfreader; import com.lowagie.text.pdf.pdfstamper; import com.lowagie.text.pdf.pdfstring;  public class apptest {      @test     public void testapp() throws exception {         pdfreader reader = new pdfreader(apptest.class.getresourceasstream("/msword2010.pdf"));          fileoutputstream fos = new fileoutputstream(new file("target", "modified_msword2010.pdf"));         pdfstamper stamper = new pdfstamper(reader, fos, '\0', true);          pdfdictionary infodict = stamper.getreader().gettrailer().getasdict(pdfname.info);         string producercleaned = null;          if (infodict != null) {             pdfstring producer = (pdfstring) infodict.get(pdfname.producer);             if (producer != null) {                 producercleaned = producer.tounicodestring();                 pdfstring cleanstrobj = new pdfstring(producercleaned);                 infodict.put(pdfname.producer, cleanstrobj);             }         }          stamper.close();     } } 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -