pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Juho Terrijärvi <Juho.Terrija...@auramarine.com>
Subject String draw unicode or UTF-8
Date Fri, 09 Jan 2015 08:35:22 GMT
Hey all,

I'm using pdfbox 1.8.8 and trying to write unicode or UTF-8 with Cyrillic alphabets. The bookmarks
work correct:

PDOutlineItem subHeading = new PDOutlineItem();
subHeading.setTitle(allDocsToAddExp[i]);
page = (PDPage)pages.get( num );
dest = new PDPageFitWidthDestination();
subHeading.setDestination( dest );
dest.setPage( page );
heading.appendChild( subHeading );

But when I write to the document with:

// append the content to the existing stream
PDPageContentStream contentStream = new PDPageContentStream(doc, page, true, true, true);
contentStream.beginText();
// set font and font size
contentStream.setFont( PDType1Font.TIMES_ROMAN, 10f );
// set text color
contentStream.setNonStrokingColor(0, 0, 0);
if (rotate)
{
// rotate the text according to the page rotation
            contentStream.setTextRotation(Math.PI/2, x, y);
}
else
{
            contentStream.setTextTranslation(x, y);
}
contentStream.drawString(message);
contentStream.endText();
contentStream.close();

This only produces þÿ
________________________________
@
________________________________
0
________________________________
1
________________________________
>
________________________________
B
________________________________
0

What could be the problem?

Best,

Juho

Ps. I find your work amazing! With pdfbox I can do the months work I did before in a day.
So pdfbox has made it possible for me to spend 19 days in a month in more rational things.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message