Re: 1.7 release?
the new parser is - unfortunately - still in it's early state and not in any way helpful. I wanted to complete the SimpleParser, which takes the tokens from the PDF Lexer and creates the COS level objects this week. All this is still in preparation for the ConformingParser. WRT 1.7 I agree with Timo that the enhancements made so far do validate a new release esp the new NonSequentialParser Timo created has already proven to solve a number of issues raised. Maybe this could be the default for the time being? regards Maruan Am 14.05.2012 um 09:54 schrieb Timo Boehme: Hi, Am 13.05.2012 10:24, schrieb Andreas Lehmkuehler: Am 07.05.2012 10:50, schrieb Timo Boehme: ... In my opinion there are already a number of improvements in current trunk compared to 1.6 and there is no reason to not release another 1.8 before PDFBOX-1000 is really ready. As I see it we should bump the version to 2.0 if PDFBOX-1000 finally lands. I just thought about a kind of beta version of the new parser, so that one can test ist without building its own version. As I see it we are currently not there. However this is a point Maruan is the only one who knows about current state. ... Nevertheless I'd like to have your opinion on a release and expertise doing it :-) The release process uses the maven release plugin and therefore it is quite easy to perform. If you are interested in acting as release manager you have to provide a key which will be used to sign the release. This key should be signed by at least one member of The Apache Web of Trust, see [1] and [2]. Thanks for the pointers. Since I'm currently a bit short of time I really appreciate that you volunteer as RM. I'll volunteer as RM for the next release. What do you think about cutting the release in one week from now on 22th? As I won't be available in the first 2 weeks of june the next reasonable target date could be june 26th, if we need some more time to include more stuff. 22nd is perfect for me. Best regards, Timo -- Timo Boehme OntoChem GmbH H.-Damerow-Str. 4 06120 Halle/Saale T: +49 345 4780474 F: +49 345 4780471 timo.boe...@ontochem.com _ OntoChem GmbH Geschäftsführer: Dr. Lutz Weber Sitz: Halle / Saale Registergericht: Stendal Registernummer: HRB 215461 _
[jira] [Issue Comment Edited] (PDFBOX-1306) Transparent PNG file display with black border
[ https://issues.apache.org/jira/browse/PDFBOX-1306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13274462#comment-13274462 ] Manoj Patel edited comment on PDFBOX-1306 at 5/14/12 9:02 AM: -- I have tried the same and it's working fine for African_Elephant_Transparent.png. Now have tried with NEW.png and it's gives gray border around fonts. I have attached NEW.png, iText_NEW.pdf and PDFBox_NEW.pdf files. You can compare result of both PDF files. was (Author: patelmanoj): I have tried the same but there is no change in result. I have built new PDFbox jar from latest svn code and tested it but its still giving black border around the image. Transparent PNG file display with black border --- Key: PDFBOX-1306 URL: https://issues.apache.org/jira/browse/PDFBOX-1306 Project: PDFBox Issue Type: Bug Reporter: Manoj Patel Assignee: Andreas Lehmkühler Fix For: 1.7.0 Attachments: African_Elephant_Transparent.png, GeneratedFileIText.pdf, GeneratedFilePDFBox.pdf Hi, I have added Transparent PNG file in PDF with PDFBox and it's display black border around image. I have added same PNG file with IText and it's display good in PDF. I have used below function to add PNG file. I am using latest PDFBox SVN code to add PNG file. public void createPDFFromImage( String inputFile, String image, String outputFile ) throws IOException, COSVisitorException { // the document PDDocument doc = null; try { doc = PDDocument.load( inputFile ); //we will add the image to the first page. PDPage page = (PDPage)doc.getDocumentCatalog().getAllPages().get( 0 ); PDXObjectImage ximage = null; /*if( image.toLowerCase().endsWith( .jpg ) ) { ximage = new PDJpeg(doc, new FileInputStream( image ) ); } else if (image.toLowerCase().endsWith(.tif) || image.toLowerCase().endsWith(.tiff)) { ximage = new PDCcitt(doc, new RandomAccessFile(new File(image),r)); } else { BufferedImage awtImage = ImageIO.read( new File( image ) ); FileInputStream inputStream = new FileInputStream(image); PDStream stream = new PDStream(doc, inputStream); ximage = new PDPixelMap(stream); //throw new IOException( Image type not supported: + image ); }*/ System.out.println(Testing); BufferedImage stampImage = null; try{ stampImage = ImageIO.read(new File(image)); }catch(Exception e){ e.printStackTrace(); } ximage = new PDJpeg(doc, stampImage ); //ximage = new PDPixelMap(doc, stampImage); COSStream stream = ximage.getCOSStream(); PDStream pdStream = new PDStream(stream); ximage = new PDPixelMap(pdStream); //BoxImage imageData = BoxImage.getInstance(image); //System.out.println(+imageData.getImageType()); PDPageContentStream contentStream = new PDPageContentStream(doc, page, true, true, true); AffineTransform transform = new AffineTransform(stampImage.getWidth(), 0, 0, stampImage.getHeight(), 20, 200); //contentStream.drawImage( ximage, 20, 20 ); contentStream.drawXObject(ximage, transform); contentStream.close(); doc.save( outputFile ); } 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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Issue Comment Edited] (PDFBOX-1306) Transparent PNG file display with black border
[ https://issues.apache.org/jira/browse/PDFBOX-1306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13274516#comment-13274516 ] Manoj Patel edited comment on PDFBOX-1306 at 5/14/12 9:06 AM: -- Attachments NEW.png, iText_NEW.pdf and PDFBox_NEW.pdf was (Author: patelmanoj): I have used NEW.png file and it's gives gray border around image it's working fine with iText. I have attached PDFBox_New.pdf and iText_NEW.pdf files Transparent PNG file display with black border --- Key: PDFBOX-1306 URL: https://issues.apache.org/jira/browse/PDFBOX-1306 Project: PDFBox Issue Type: Bug Reporter: Manoj Patel Assignee: Andreas Lehmkühler Fix For: 1.7.0 Attachments: African_Elephant_Transparent.png, GeneratedFileIText.pdf, GeneratedFilePDFBox.pdf, NEW.png, PDFBox_NEW.pdf, iText_NEW.pdf Hi, I have added Transparent PNG file in PDF with PDFBox and it's display black border around image. I have added same PNG file with IText and it's display good in PDF. I have used below function to add PNG file. I am using latest PDFBox SVN code to add PNG file. public void createPDFFromImage( String inputFile, String image, String outputFile ) throws IOException, COSVisitorException { // the document PDDocument doc = null; try { doc = PDDocument.load( inputFile ); //we will add the image to the first page. PDPage page = (PDPage)doc.getDocumentCatalog().getAllPages().get( 0 ); PDXObjectImage ximage = null; /*if( image.toLowerCase().endsWith( .jpg ) ) { ximage = new PDJpeg(doc, new FileInputStream( image ) ); } else if (image.toLowerCase().endsWith(.tif) || image.toLowerCase().endsWith(.tiff)) { ximage = new PDCcitt(doc, new RandomAccessFile(new File(image),r)); } else { BufferedImage awtImage = ImageIO.read( new File( image ) ); FileInputStream inputStream = new FileInputStream(image); PDStream stream = new PDStream(doc, inputStream); ximage = new PDPixelMap(stream); //throw new IOException( Image type not supported: + image ); }*/ System.out.println(Testing); BufferedImage stampImage = null; try{ stampImage = ImageIO.read(new File(image)); }catch(Exception e){ e.printStackTrace(); } ximage = new PDJpeg(doc, stampImage ); //ximage = new PDPixelMap(doc, stampImage); COSStream stream = ximage.getCOSStream(); PDStream pdStream = new PDStream(stream); ximage = new PDPixelMap(pdStream); //BoxImage imageData = BoxImage.getInstance(image); //System.out.println(+imageData.getImageType()); PDPageContentStream contentStream = new PDPageContentStream(doc, page, true, true, true); AffineTransform transform = new AffineTransform(stampImage.getWidth(), 0, 0, stampImage.getHeight(), 20, 200); //contentStream.drawImage( ximage, 20, 20 ); contentStream.drawXObject(ximage, transform); contentStream.close(); doc.save( outputFile ); } 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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (PDFBOX-1306) Transparent PNG file display with black border
[ https://issues.apache.org/jira/browse/PDFBOX-1306?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Manoj Patel updated PDFBOX-1306: Attachment: NEW.png iText_NEW.pdf PDFBox_NEW.pdf I have used NEW.png file and it's gives gray border around image it's working fine with iText. I have attached PDFBox_New.pdf and iText_NEW.pdf files Transparent PNG file display with black border --- Key: PDFBOX-1306 URL: https://issues.apache.org/jira/browse/PDFBOX-1306 Project: PDFBox Issue Type: Bug Reporter: Manoj Patel Assignee: Andreas Lehmkühler Fix For: 1.7.0 Attachments: African_Elephant_Transparent.png, GeneratedFileIText.pdf, GeneratedFilePDFBox.pdf, NEW.png, PDFBox_NEW.pdf, iText_NEW.pdf Hi, I have added Transparent PNG file in PDF with PDFBox and it's display black border around image. I have added same PNG file with IText and it's display good in PDF. I have used below function to add PNG file. I am using latest PDFBox SVN code to add PNG file. public void createPDFFromImage( String inputFile, String image, String outputFile ) throws IOException, COSVisitorException { // the document PDDocument doc = null; try { doc = PDDocument.load( inputFile ); //we will add the image to the first page. PDPage page = (PDPage)doc.getDocumentCatalog().getAllPages().get( 0 ); PDXObjectImage ximage = null; /*if( image.toLowerCase().endsWith( .jpg ) ) { ximage = new PDJpeg(doc, new FileInputStream( image ) ); } else if (image.toLowerCase().endsWith(.tif) || image.toLowerCase().endsWith(.tiff)) { ximage = new PDCcitt(doc, new RandomAccessFile(new File(image),r)); } else { BufferedImage awtImage = ImageIO.read( new File( image ) ); FileInputStream inputStream = new FileInputStream(image); PDStream stream = new PDStream(doc, inputStream); ximage = new PDPixelMap(stream); //throw new IOException( Image type not supported: + image ); }*/ System.out.println(Testing); BufferedImage stampImage = null; try{ stampImage = ImageIO.read(new File(image)); }catch(Exception e){ e.printStackTrace(); } ximage = new PDJpeg(doc, stampImage ); //ximage = new PDPixelMap(doc, stampImage); COSStream stream = ximage.getCOSStream(); PDStream pdStream = new PDStream(stream); ximage = new PDPixelMap(pdStream); //BoxImage imageData = BoxImage.getInstance(image); //System.out.println(+imageData.getImageType()); PDPageContentStream contentStream = new PDPageContentStream(doc, page, true, true, true); AffineTransform transform = new AffineTransform(stampImage.getWidth(), 0, 0, stampImage.getHeight(), 20, 200); //contentStream.drawImage( ximage, 20, 20 ); contentStream.drawXObject(ximage, transform); contentStream.close(); doc.save( outputFile ); } 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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Issue Comment Edited] (PDFBOX-1306) Transparent PNG file display with black border
[ https://issues.apache.org/jira/browse/PDFBOX-1306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13274462#comment-13274462 ] Manoj Patel edited comment on PDFBOX-1306 at 5/14/12 9:24 AM: -- I have tried the same and it's working fine for African_Elephant_Transparent.png. Now have tried with NEW.png and it's gives gray border around fonts.I am using below mentioned code to scale png image in PDFBox. int width= (int)(stampImage.getWidth()*100/300); int height= (int)(stampImage.getHeight()*100/300); AffineTransform transform = new AffineTransform(width, 0, 0, height, 20, 200); I have attached NEW.png, iText_NEW.pdf and PDFBox_NEW.pdf files. You can compare result of both PDF files. was (Author: patelmanoj): I have tried the same and it's working fine for African_Elephant_Transparent.png. Now have tried with NEW.png and it's gives gray border around fonts. I have attached NEW.png, iText_NEW.pdf and PDFBox_NEW.pdf files. You can compare result of both PDF files. Transparent PNG file display with black border --- Key: PDFBOX-1306 URL: https://issues.apache.org/jira/browse/PDFBOX-1306 Project: PDFBox Issue Type: Bug Reporter: Manoj Patel Assignee: Andreas Lehmkühler Fix For: 1.7.0 Attachments: African_Elephant_Transparent.png, GeneratedFileIText.pdf, GeneratedFilePDFBox.pdf, NEW.png, PDFBox_NEW.pdf, iText_NEW.pdf Hi, I have added Transparent PNG file in PDF with PDFBox and it's display black border around image. I have added same PNG file with IText and it's display good in PDF. I have used below function to add PNG file. I am using latest PDFBox SVN code to add PNG file. public void createPDFFromImage( String inputFile, String image, String outputFile ) throws IOException, COSVisitorException { // the document PDDocument doc = null; try { doc = PDDocument.load( inputFile ); //we will add the image to the first page. PDPage page = (PDPage)doc.getDocumentCatalog().getAllPages().get( 0 ); PDXObjectImage ximage = null; /*if( image.toLowerCase().endsWith( .jpg ) ) { ximage = new PDJpeg(doc, new FileInputStream( image ) ); } else if (image.toLowerCase().endsWith(.tif) || image.toLowerCase().endsWith(.tiff)) { ximage = new PDCcitt(doc, new RandomAccessFile(new File(image),r)); } else { BufferedImage awtImage = ImageIO.read( new File( image ) ); FileInputStream inputStream = new FileInputStream(image); PDStream stream = new PDStream(doc, inputStream); ximage = new PDPixelMap(stream); //throw new IOException( Image type not supported: + image ); }*/ System.out.println(Testing); BufferedImage stampImage = null; try{ stampImage = ImageIO.read(new File(image)); }catch(Exception e){ e.printStackTrace(); } ximage = new PDJpeg(doc, stampImage ); //ximage = new PDPixelMap(doc, stampImage); COSStream stream = ximage.getCOSStream(); PDStream pdStream = new PDStream(stream); ximage = new PDPixelMap(pdStream); //BoxImage imageData = BoxImage.getInstance(image); //System.out.println(+imageData.getImageType()); PDPageContentStream contentStream = new PDPageContentStream(doc, page, true, true, true); AffineTransform transform = new AffineTransform(stampImage.getWidth(), 0, 0, stampImage.getHeight(), 20, 200); //contentStream.drawImage( ximage, 20, 20 ); contentStream.drawXObject(ximage, transform); contentStream.close(); doc.save( outputFile ); } 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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (PDFBOX-1296) Warnung: Changing font on from AMAKEA+TimesNewRoman to the default font
[ https://issues.apache.org/jira/browse/PDFBOX-1296?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13274571#comment-13274571 ] Tilman Hausherr commented on PDFBOX-1296: - After reading the PDF spec, http://wwwimages.adobe.com/www.adobe.com/content/dam/Adobe/en/devnet/pdf/pdfs/PDF32000_2008.pdf I found that + means that it is a subset of a font, see page 258, or 9.6.4. While waiting for a real solution (might be related to issues PDFBOX-490 and PDFBOX-412) here's an updated workaround code, which now also cuts off the +. /** * Font.canDisplayUpTo() is buggy: * http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6623219 * http://stackoverflow.com/questions/1754697/displaying-chinese-text-in-an-applet * * @param font * @param s * @return -1 when all is good * * This method returns an offset into the String s which is the first * character this Font cannot display without using the missing glyph code. * If the Font can display all characters, -1 is returned. */ int canDisplayUpTo(Font font, String s) { if (!font.canDisplay(' ') || !font.canDisplay('a') || !font.canDisplay('A')) { return 0; //TH font.canDisplay does not always tell the truth } int len = s.length(); int index = 0; while (index len) { int codePoint = s.codePointAt(index); if (!font.canDisplay(codePoint)) { return index; } index += Character.charCount(codePoint); } return -1; } /** * {@inheritDoc} */ @Override public void drawString(String string, Graphics g, float fontSize, AffineTransform at, float x, float y) throws IOException { Font _awtFont = getawtFont(); // mdavis - fix fontmanager.so/dll on sun.font.FileFont.getGlyphImage // for font with bad cmaps? // Type1 fonts are not affected as they don't have cmaps //if (!isType1Font() _awtFont.canDisplayUpTo(string) != -1) if (!isType1Font() canDisplayUpTo(_awtFont, string) != -1) { Font _awtFontOld = _awtFont; String name = null; String style; if (_awtFont.getName().indexOf('+') 0) { name = _awtFont.getName().substring(_awtFont.getName().indexOf('+') + 1); } else if (_awtFont.getName().startsWith(DejaVu) || _awtFont.getName().startsWith(Liberation)) { if (_awtFont.getName().startsWith(DejaVu Sans)) { name = Lucida Sans; } else if (_awtFont.getName().startsWith(Liberation Serif)) { name = Times New Roman; } else if (_awtFont.getName().startsWith(Liberation Sans)) { name = Arial; } else if (_awtFont.getName().startsWith(Liberation Mono)) { name = Courier New; } else { name = Lucida Sans; } } if (name == null) { _awtFont = Font.decode(null); } else { switch (_awtFont.getStyle()) { case Font.BOLD: style = BOLD; break; case Font.ITALIC: style = ITALIC; break; case Font.PLAIN: style = PLAIN; break; default: if (_awtFont.getStyle() == (Font.BOLD | Font.ITALIC)) { style = BOLDITALIC; } else { style = PLAIN; } } if (_awtFont.getName().endsWith(Bold)) { style = BOLD; } else if (_awtFont.getName().endsWith(Bold Italic)) { style = BOLDITALIC; } else if (_awtFont.getName().endsWith(Italic)) { style = ITALIC; } _awtFont = Font.decode(name + - + style + - + Integer.toString(_awtFont.getSize())); } log.warn(Changing font on + string + from + _awtFontOld + to + _awtFont + ); } Graphics2D g2d = (Graphics2D) g; g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); writeFont(g2d, at,
[jira] [Resolved] (PDFBOX-1306) Transparent PNG file display with black border
[ https://issues.apache.org/jira/browse/PDFBOX-1306?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Andreas Lehmkühler resolved PDFBOX-1306. Resolution: Fixed My first patch improved the SMask creation but it wasn't perfect. I optimized it once again in revision 1338247. But I'm afraid that's the maximum of quality we can get here. In the end it is not a good idea to use a lossy DCTFilter to compress the data. Instead one should use the lossless FlateDecode filter. I extended the PDPixelMap class similar to the PDJpeg class in revision 1338248. Just use a PDPixelMap instead of a PDJpeg to add an image with transparency. Thanks for coming back and your input. Transparent PNG file display with black border --- Key: PDFBOX-1306 URL: https://issues.apache.org/jira/browse/PDFBOX-1306 Project: PDFBox Issue Type: Bug Reporter: Manoj Patel Assignee: Andreas Lehmkühler Fix For: 1.7.0 Attachments: African_Elephant_Transparent.png, GeneratedFileIText.pdf, GeneratedFilePDFBox.pdf, NEW.png, PDFBox_NEW.pdf, iText_NEW.pdf Hi, I have added Transparent PNG file in PDF with PDFBox and it's display black border around image. I have added same PNG file with IText and it's display good in PDF. I have used below function to add PNG file. I am using latest PDFBox SVN code to add PNG file. public void createPDFFromImage( String inputFile, String image, String outputFile ) throws IOException, COSVisitorException { // the document PDDocument doc = null; try { doc = PDDocument.load( inputFile ); //we will add the image to the first page. PDPage page = (PDPage)doc.getDocumentCatalog().getAllPages().get( 0 ); PDXObjectImage ximage = null; /*if( image.toLowerCase().endsWith( .jpg ) ) { ximage = new PDJpeg(doc, new FileInputStream( image ) ); } else if (image.toLowerCase().endsWith(.tif) || image.toLowerCase().endsWith(.tiff)) { ximage = new PDCcitt(doc, new RandomAccessFile(new File(image),r)); } else { BufferedImage awtImage = ImageIO.read( new File( image ) ); FileInputStream inputStream = new FileInputStream(image); PDStream stream = new PDStream(doc, inputStream); ximage = new PDPixelMap(stream); //throw new IOException( Image type not supported: + image ); }*/ System.out.println(Testing); BufferedImage stampImage = null; try{ stampImage = ImageIO.read(new File(image)); }catch(Exception e){ e.printStackTrace(); } ximage = new PDJpeg(doc, stampImage ); //ximage = new PDPixelMap(doc, stampImage); COSStream stream = ximage.getCOSStream(); PDStream pdStream = new PDStream(stream); ximage = new PDPixelMap(pdStream); //BoxImage imageData = BoxImage.getInstance(image); //System.out.println(+imageData.getImageType()); PDPageContentStream contentStream = new PDPageContentStream(doc, page, true, true, true); AffineTransform transform = new AffineTransform(stampImage.getWidth(), 0, 0, stampImage.getHeight(), 20, 200); //contentStream.drawImage( ximage, 20, 20 ); contentStream.drawXObject(ximage, transform); contentStream.close(); doc.save( outputFile ); } 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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira