Thomas Jodes created PDFBOX-1518:
------------------------------------

             Summary: ClassCastException writing text to a page
                 Key: PDFBOX-1518
                 URL: https://issues.apache.org/jira/browse/PDFBOX-1518
             Project: PDFBox
          Issue Type: Bug
          Components: Writing
    Affects Versions: 1.8.0
         Environment: Windows x86_64, jdk1.6.0u31
            Reporter: Thomas Jodes
            Priority: Critical


I switched from 1.7.1 to 1.8.0-SNAPSHOT. Following code did not work any longer:

        @Test
        public void testGenerateNewDocument() throws IOException, 
COSVisitorException {
                PDDocument doc = null;
                try {
                        doc = new PDDocument();

                        PDPage page = new PDPage();
                        doc.addPage(page);
                        PDFont font = PDType1Font.HELVETICA_BOLD;
                
                        PDJpeg image = new PDJpeg(doc, getLogoInputStream() );

                        PDPageContentStream contentStream = new 
PDPageContentStream(doc, page, true, true);

                        contentStream.beginText();
                        contentStream.setFont(font, 12);
                        contentStream.moveTextPositionByAmount(100, 700);
                        contentStream.drawString("Hello World!");
                        contentStream.endText();

                        contentStream.drawImage(image, 20, 20);

                        contentStream.close();

                        doc.save( getWorkDirectory() + File.separator + 
"pdfbox-testGenerateNewDocument.pdf" );
                } finally {
                        if (doc != null) {
                                doc.close();
                        }
                }
        }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to