# PDF::Writer and unicode

**URL:** <https://www.ruby-forum.com/t/pdf-writer-and-unicode/78002>\
**Category:** Ruby\
**Created:** [December 2, 2006, 3:45pm UTC](https://www.ruby-forum.com/t/pdf-writer-and-unicode/78002 "2006-12-02T15:45:24Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Simon\_KrSSSSger](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/6f9a4e/32.png) [@Simon\_KrSSSSger](https://www.ruby-forum.com/u/Simon_KrSSSSger)\
**Post date:** [December 2, 2006, 3:45pm UTC](https://www.ruby-forum.com/t/pdf-writer-and-unicode/78002/1 "2006-12-02T15:45:24Z")

</div>

Hi!

Ok, I know there is (or was) no easy way to do that, but the PDF::Writer  
doc says:

If all of the conditions are correct, the following code  
should display the Japanese characters[…]

pdf.text("\xfe\xff\x65\xe5\x67\x2c\x8a\x9e")

Well obviously not all conditions are correct in my environment, i don’t  
see  
any Japanese character, i get “Ã¾Ã¿eÃ¥g,Å Å¾” (if my newsgroup client gets it  
right).

All i need are three special chars: ÅŸ ÄŸ and Ã§

Is there any way to create a pdf document with these chars using  
PDF::Writer?

cheers and thanks

Simon

---

<div class="post-metadata">

**Author:** ![Simon\_KrSSSSger](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/6f9a4e/32.png) [@Simon\_KrSSSSger](https://www.ruby-forum.com/u/Simon_KrSSSSger)\
**Post date:** [December 2, 2006, 4:27pm UTC](https://www.ruby-forum.com/t/pdf-writer-and-unicode/78002/2 "2006-12-02T16:27:29Z")

</div>

On 12/2/06, Simon Kröger [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hi!  
> Ok, I know there is (or was) no easy way to do that, but the PDF::Writer doc says:
> 
> If all of the conditions are correct, the following code  
> should display the Japanese characters[…]
> 
> pdf.text(“\xfe\xff\x65\xe5\x67\x2c\x8a\x9e”)
> 
> Well obviously not all conditions are correct in my environment, i don’t see  
> any Japanese character, i get “þÿeåg,Šž” (if my newsgroup client gets it right).

Yes. You won’t, either. The PDF::Writer document is incorrect; I  
understand the reason why it won’t, but I haven’t been able to  
implement it as of yet. There’s a bit of wedding-related stuff for me  
to clean up, but I should be able to get UTF-16 working sometime in  
2007.

-austin

---

<div class="post-metadata">

**Author:** ![Simon\_KrSSSSger](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/6f9a4e/32.png) [@Simon\_KrSSSSger](https://www.ruby-forum.com/u/Simon_KrSSSSger)\
**Post date:** [December 3, 2006, 12:31am UTC](https://www.ruby-forum.com/t/pdf-writer-and-unicode/78002/3 "2006-12-03T00:31:24Z")

</div>

Austin Z. wrote:

> Yes. You won’t, either. The PDF::Writer document is incorrect; I  
> understand the reason why it won’t, but I haven’t been able to  
> implement it as of yet. There’s a bit of wedding-related stuff for me  
> to clean up, but I should be able to get UTF-16 working sometime in  
> 2007.
> 
> -austin

In other words: “no way” ?

That makes me sad, really. Thanks anyway for such a great tool,  
it’s a pity i can’t use it.

(The character substitution table doesn’t help me either, right?)

cheers

Simon

---

<div class="post-metadata">

**Author:** ![Simon\_KrSSSSger](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/6f9a4e/32.png) [@Simon\_KrSSSSger](https://www.ruby-forum.com/u/Simon_KrSSSSger)\
**Post date:** [December 3, 2006, 12:40pm UTC](https://www.ruby-forum.com/t/pdf-writer-and-unicode/78002/4 "2006-12-03T12:40:30Z")

</div>

Hi,

In [eks395$ld$removed\_email\_address@domain.invalid](mailto:eks395$ld$removed_email_address@domain.invalid)  
“PDF::Writer and unicode” on Sat, 2 Dec 2006 23:45:08 +0900,  
Simon KrÃ¶ger [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> All i need are three special chars: ÅŸ ÄŸ and Ã§
> 
> Is there any way to create a pdf document with these chars using PDF::Writer?

You can do the thing if you use Pango and cairo (Ruby/Pango  
and rcairo).

## Thanks,

kou

---

<div class="post-metadata">

**Author:** ![Simon\_KrSSSSger](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/6f9a4e/32.png) [@Simon\_KrSSSSger](https://www.ruby-forum.com/u/Simon_KrSSSSger)\
**Post date:** [December 3, 2006, 6:42am UTC](https://www.ruby-forum.com/t/pdf-writer-and-unicode/78002/5 "2006-12-03T06:42:01Z")

</div>

On 12/2/06, Simon Kröger [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Austin Z. wrote:
> 
> > Yes. You won’t, either. The PDF::Writer document is incorrect; I  
> > understand the reason why it won’t, but I haven’t been able to  
> > implement it as of yet. There’s a bit of wedding-related stuff for me  
> > to clean up, but I should be able to get UTF-16 working sometime in  
> > 2007.  
> > In other words: “no way” ?

No, “not yet.”

The tools to do this within PDF::Writer don’t yet exist and I will not  
be adding them until sometime in the new year (I’ve had a far more  
important project this year, and I’m merely one week after the event).

> (The character substitution table doesn’t help me either, right?)

It can, sort of. You won’t get Japanese out of it, but there’s a patch  
out there for PDF::Writer 1.1.3 (I have not integrated it into my code  
because it changes a few things that I’m not comfortable changing for  
future directions, at least the way they were changed) that will allow  
you to use particular Japanese fonts in specific code pages. It works,  
and it works amazingly well. But it’s not going to be Unicode.

I’m not going to put timelines on any of this right now, but my first  
order of business is to fix a few outstanding bugs (that’s PDF::Writer  
1.1.4) long overdue for fixes. I hope that the author of the Japanese  
patch will work with me shortly thereafter for a monkeypatch version  
of his code so that his code can simply extend mine. That’s  
PDF::Writer 1.1.5.

Then I have some serious decisions to make. When I did the  
PDF::Presentation and PDF::SVG code last year, I rewrote some of the  
code that generates the objects. This change is not backwards  
compatible with PDF::Writer 1.1, but it makes the _writing_ code  
cleaner. However, it doesn’t do anything to make creating the objects  
from existing PDFs any better. So if I keep that code, which works  
well, I’ll spend some time pushing things out that will have to be  
rewritten yet again to work with PDF::Reader[1]. Or, I can start  
looking at the code I was experimenting with for the “next generation”  
of Ruby PDF tools, which is far better for dealing with reading PDFs  
but may be a little uglier for creation.

PDF::Writer is most certainly not dead, but as I have had to tell  
people all year, getting married is more important to me than anyone’s  
PDF projects. I’ve got someone who is willing to help me with some  
adjunct code, and I’m certainly interested in taking advantage of his  
offer, but before we can move forward with any of this I have to sort  
out several other things and even push a couple of other projects out  
the door (there is a planned update to Transaction::Simple to  
hopefully fix a significant memory leakage and speed up PDF::Writer as  
well as make it possible to generate larger tables if necessary).

-austin  
[1] I am well aware that someone else has created a project that they  
are calling PDF::Reader. As far as I can tell, they have not made  
anything that is ultimately compatible with PDF::Writer. It seems to  
be a nice project, but it’s not the PDF::Reader that I have been  
planning. It doesn’t much matter because when I get around to actually  
making this all work, I will probably end up making it a different  
name. If I don’t, however, don’t be surprised if there are conflicts  
between my PDF::Reader and this other project’s PDF::Reader.
