Hi,

Am 07.12.2012 12:46, schrieb Gerrit Lober:
Dear all,

I get no output after drawString().

I've this method:
private void drawHeader(PDPageContentStream stream) throws IOException
        {
                boolean drawGroupHeader = 
this.report.getBetisKey().toUpperCase().equals(BETIS_FOR_GROUP_HEADER);
                
                if (drawGroupHeader) {
                        stream.setNonStrokingColor(Color.GRAY);
                        stream.fillRect(START_X, 
distanceFromTop(HEADER_FROM_TOP + HEADER_HEIGHT), HEADER_WIDTH, HEADER_HEIGHT);
                        stream.setNonStrokingColor(Color.WHITE);
                } else {
                        stream.setNonStrokingColor(Color.BLACK);
                }
                
                stream.beginText();
                //stream.moveTextPositionByAmount(START_X + HEADER_TEXT_OFFSET, 
distanceFromTop(HEADER_FROM_TOP + (HEADER_WIDTH / 2) + (HEADER_FONT_SIZE / 2)));
                stream.moveTextPositionByAmount(0, 0);
                stream.drawString("Test");
                stream.endText();
        }

 From another Method where I draw some other things to my stream I call this 
method. Everything works fine when I comment out the drawString()-method. When 
I execute my program without outcommenting, nothing is drawed after this method 
call. That means, that I get the grey box and nothing more on my page.

What could be the reason?
Looking at your piece of code, it might be the fact that you're setting the non stroking color to white. Maybe that leads to white text on white ground. If it isn't a color issue, you should have a look at the pdf using the PDFDebugger coming with PDFBox. Have a look at the content stream of the page, maybe something else is mixed up.

BR

P.S.: You are still not subscribed to the mailing list. You should do so if you want to receive possible answers. You're getting this response because I'm cc'ing you manually.

BR
Andreas Lehmkühler


Reply via email to