Hello Folks, I'm using imagemagick to convert from RGB to CMYK and it is inserted a new pdf document with iText checking the PDFX1A2001 conformance, this is my code:
IMOperation op = new IMOperation(); op.addImage(_pathIn); op.p_profile("*"); op.profile(DEFAULT_PATH_ICCRGBPROFILE); op.profile(DEFAULT_PATH_ICCCMYKPROFILE); op.strip(); op.addImage("-"); //Convert to BufferedImage ConvertCmd cmd = new ConvertCmd(); Stream2BufferedImage s2b = new Stream2BufferedImage(); cmd.setOutputConsumer(s2b); cmd.run(op); BufferedImage imageTransformed = s2b.getImage(); //To PDF Document document = new Document(); PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(_pathOut)); writer.setPDFXConformance(PdfWriter.PDFX1A2001); writer.setPdfVersion(PdfWriter.VERSION_1_3); document.open(); PdfContentByte content = writer.getDirectContent(); Image iTextImg = Image.getInstance(imageTransformed, null); iTextImg.setDpi(300,300); iTextImg.setSmask(false); iTextImg.setAbsolutePosition(0,0); content.addImage(iTextImg); document.close(); When the image goes to be inserted with content.addImage, the debugger throw a exception: ... Exception in thread "main" com.itextpdf.text.DocumentException: com.itextpdf.text.pdf.PdfXConformanceException: Colorspace RGB is not allowed. at com.itextpdf.text.pdf.PdfContentByte.addImage(PdfContentByte.java:1269) at com.itextpdf.text.pdf.PdfContentByte.addImage(PdfContentByte.java:1110) at com.itextpdf.text.pdf.PdfContentByte.addImage(PdfContentByte.java:1094) ... Caused by: com.itextpdf.text.pdf.PdfXConformanceException: Colorspace RGB is not allowed. I'm sure that the code to transform from RGB to CMYK is right, Somebody can I help me, please?. Thanks in advance -- View this message in context: http://itext-general.2136553.n4.nabble.com/Bug-in-PDFX1A2001-tp4369222p4369222.html Sent from the iText - General mailing list archive at Nabble.com. ------------------------------------------------------------------------------ Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d _______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions iText(R) is a registered trademark of 1T3XT BVBA. Many questions posted to this list can (and will) be answered with a reference to the iText book: http://www.itextpdf.com/book/ Please check the keywords list before you ask for examples: http://itextpdf.com/themes/keywords.php