Quantcast

Indic Ligaturizer for iTextSharp

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Indic Ligaturizer for iTextSharp

blackhorn
Hi All,


Today i joined the itext mailing list so that i could contribute something.


I've written a basic indic ligaturizer for itextsharp (for indian character support), much similar to what exists for Arabic. I've tested it with iText source code, and it seems to work pretty well. The Indic ligaturizer is very basic and simple, but it does solve a majority of issues with Hindi, sanskrit and other devanagari characters. Also to note as there are several languages (around 600, with 15 being the major ones) which are in use in india, i haven't taken into account all those languages. For e.g. the present code doesn't deal with telugu, kannada, tamil etc. (using the south indian/dravidian characters). But does seem to work with hindi, sanskri, nepali, marathi (all languages using the devanagari character set). Though i've added support for gujarati too, but when i generated the PDF it was empty, dont know why, but the visual studio debugger did show that the characters were generated properly by the ligaturizer.

Due to limited time availability and also because i'am totally unfamiliar with the iText code, as i hardly studied it, i just wrote a new file IndicLigaturizer.cs with a class and several static methods (followed the concept of ArabicLigaturizer.cs).

I am calling my IndicLigaturizer at this place, i don't know whether this is the right place to do so, but i wanted a quick way to test my code, hence the following.


Inside the PdfDocument.cs files


                case Element.CHUNK: {
                    // if there isn't a current line available, we make one
                    if (line == null) {
                        CarriageReturn();
                    }

                    Chunk c = (Chunk) element;

                    StringBuilder s = new StringBuilder(c.ToString());
                    string p = IndicLigaturizer.FormatIndicString(s, IndicLigaturizer.LANG_GUJR);


                    Chunk c1 = new Chunk(p, c.Font);
                    
                    // we cast the element to a chunk
                    PdfChunk chunk = new PdfChunk(c1, anchorAction);


I tested the code by creating a sample csharp project and including the newly generated itext dll.


Kindly let me know whether this could be of use to iText and could be added there. If the moderators consider this worthy,  we could develop it further. Also let me know how, when and where i can post my code, so that others can have a look at it and comment upon it.



Thanks
Ram

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
iText-questions mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: http://itextpdf.com/themes/keywords.php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Indic Ligaturizer for iTextSharp

iText Info
Op 16/08/2012 14:44, blackhorn schreef:
> Kindly let me know whether this could be of use to iText and could be
> added there. If the moderators consider this worthy,  we could develop
> it further. Also let me know how, when and where i can post my code,
> so that others can have a look at it and comment upon it.

There's a contribution policy on the site:
http://itextpdf.com/terms-of-use/policy.php
Basically, you are asked to sign a Contributor License Agreement as soon
as the contributed code exceeds 20 lines (which it probably does in your
case). Once you've submitted the signed CLA, dedicated iText developers
will accept your code by mail. As soon as they've examined it, it's
eligible for inclusion in the code base on SourceForge.

If you do not wish or are not allowed to sign the CLA, the iText
developers are not allowed to look at your code.

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
iText-questions mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: http://itextpdf.com/themes/keywords.php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Indic Ligaturizer for iTextSharp

Paulo Soares-4
I'm very much curious about this. It will also be a good pretext to
support the open type tables and have a good quality rendering.

Paulo

On Thu, Aug 16, 2012 at 2:04 PM, iText Info <[hidden email]> wrote:

> Op 16/08/2012 14:44, blackhorn schreef:
>> Kindly let me know whether this could be of use to iText and could be
>> added there. If the moderators consider this worthy,  we could develop
>> it further. Also let me know how, when and where i can post my code,
>> so that others can have a look at it and comment upon it.
>
> There's a contribution policy on the site:
> http://itextpdf.com/terms-of-use/policy.php
> Basically, you are asked to sign a Contributor License Agreement as soon
> as the contributed code exceeds 20 lines (which it probably does in your
> case). Once you've submitted the signed CLA, dedicated iText developers
> will accept your code by mail. As soon as they've examined it, it's
> eligible for inclusion in the code base on SourceForge.
>
> If you do not wish or are not allowed to sign the CLA, the iText
> developers are not allowed to look at your code.
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> iText-questions mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/itext-questions
>
> iText(R) is a registered trademark of 1T3XT BVBA.
> Many questions posted to this list can (and will) be answered with a reference to the iText book: http://www.itextpdf.com/book/
> Please check the keywords list before you ask for examples: http://itextpdf.com/themes/keywords.php

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
iText-questions mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: http://itextpdf.com/themes/keywords.php
Loading...