Thursday, November 6, 2014

PdfSharp Chinese Encoding


Recently I started to use PdfSharp open source project, this is a great tool and its document rendering speed is great with small-medium sized pdf docs.

Anyway, in our program's pdf export function, it has a requirement to be able to cater for different languages such as CJK (Chinese, Japanese, Korean), etc. I got some hints from pdfsharp's forum, here's what's going to solve the issue:

  Private Sub DefineStyles()
        ' Get the predefined style Normal.
        Dim style As Style = Me.document.Styles("Normal")
        ' Because all styles are derived from Normal, the next line changes the
        ' font of the whole document. Or, more exactly, it changes the font of
        ' all styles and paragraphs that do not redefine the font.
        style.Font.Name = "Arial Unicode MS" 'This font will make Chinese characters display
   
        ' Create a new style called Table based on style Normal
        style = Me.document.Styles.AddStyle("Table", "Normal")
        style.Font.Name = "Arial Unicode MS"  
        style.Font.Size = 10    'Default font
    End Sub

Thursday, February 20, 2014

Don't save any sensitive data into your MS Office products

Just don't do it, it takes a person less 1 minute to search on google and crack whatever password that you put on to 'protect' your file.

E.g. http://uknowit.uwgb.edu/page.php?id=28850

there are quite a few programs out there to crack your MS access password, so use SQL server if you can, access is really for fun.