|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
Transparency GroupsPaulo,
I've come across a case where we import a page from an existing PDF document and the color of an image does not match the original after the import. Basically, all we're doing is PdfImportedPage page = writer.GetImportedPage(reader, pageNumber); writer.DirectContent.AddTemplate(page, scaleX, 0, 0, scaleY, translateX, translateY); where the writer is a PdfWriter. If I use PdfCopy, the color will match. Upon examining the generated PDFs, I found that the images are indeed identical, but the Page object is missing a Group dictionary when I use PdfWriter. There is no Group dictionary in the XObject Form either. In the original file, the Group in the Page dictionary is like this: /Group<</CS/DeviceRGB/S/Transparency/Type/Group>> This is preserved when I use PdfCopy and, as far as I can tell, is the only thing that can explain the color difference. Is this perhaps a bug? The Group dictionary is a 1.4 feature according to Adobe so I would think it should be supported when generating 1.4 or 1.5 files. Is there a way for me to set something in the PdfWriter to insure this gets included? Thanks - Gylfi ------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ itextsharp-questions mailing list itextsharp-questions@... https://lists.sourceforge.net/lists/listinfo/itextsharp-questions |
|
|
Re: Transparency GroupsAfter searching the lists I found a post pointing to a detailed discussion
on this topic on Gmane. The following workaround will fix the problem if I call this after creating the page, but it seems to me that the GetImportedPage() method on PdfWriter should handle this automatically by creating a Transparency Group XObject. Thoughts? protected void SetTransparency(PdfContentByte content) { PdfDictionary dictionary = new PdfDictionary(); dictionary.Put(PdfName.TYPE, PdfName.GROUP); dictionary.Put(PdfName.S, PdfName.TRANSPARENCY); dictionary.Put(PdfName.CS, PdfName.DEVICERGB); content.PdfWriter.Group = dictionary; content.SetDefaultColorspace(PdfName.CS, PdfName.DEVICERGB); } Thanks - Gylfi -----Original Message----- From: Gylfi Ingvason [mailto:Gylfi.Ingvason@...] Sent: Wednesday, September 16, 2009 11:54 AM To: itextsharp-questions@... Subject: [itextsharp-questions] Transparency Groups Paulo, I've come across a case where we import a page from an existing PDF document and the color of an image does not match the original after the import. Basically, all we're doing is PdfImportedPage page = writer.GetImportedPage(reader, pageNumber); writer.DirectContent.AddTemplate(page, scaleX, 0, 0, scaleY, translateX, translateY); where the writer is a PdfWriter. If I use PdfCopy, the color will match. Upon examining the generated PDFs, I found that the images are indeed identical, but the Page object is missing a Group dictionary when I use PdfWriter. There is no Group dictionary in the XObject Form either. In the original file, the Group in the Page dictionary is like this: /Group<</CS/DeviceRGB/S/Transparency/Type/Group>> This is preserved when I use PdfCopy and, as far as I can tell, is the only thing that can explain the color difference. Is this perhaps a bug? The Group dictionary is a 1.4 feature according to Adobe so I would think it should be supported when generating 1.4 or 1.5 files. Is there a way for me to set something in the PdfWriter to insure this gets included? Thanks - Gylfi ---------------------------------------------------------------------------- -- Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ itextsharp-questions mailing list itextsharp-questions@... https://lists.sourceforge.net/lists/listinfo/itextsharp-questions ------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ itextsharp-questions mailing list itextsharp-questions@... https://lists.sourceforge.net/lists/listinfo/itextsharp-questions |
|
|
Re: Transparency GroupsPaulo,
Could you please answer the following: The PdfWriter.GetImportedPage() does not preserve the Transparency Group dictionary when importing the page into an XObject Form. Is this a bug or a feature? Thanks - Gylfi -----Original Message----- From: Gylfi Ingvason [mailto:Gylfi.Ingvason@...] Sent: Wednesday, September 16, 2009 1:24 PM To: itextsharp-questions@... Subject: Re: [itextsharp-questions] Transparency Groups After searching the lists I found a post pointing to a detailed discussion on this topic on Gmane. The following workaround will fix the problem if I call this after creating the page, but it seems to me that the GetImportedPage() method on PdfWriter should handle this automatically by creating a Transparency Group XObject. Thoughts? protected void SetTransparency(PdfContentByte content) { PdfDictionary dictionary = new PdfDictionary(); dictionary.Put(PdfName.TYPE, PdfName.GROUP); dictionary.Put(PdfName.S, PdfName.TRANSPARENCY); dictionary.Put(PdfName.CS, PdfName.DEVICERGB); content.PdfWriter.Group = dictionary; content.SetDefaultColorspace(PdfName.CS, PdfName.DEVICERGB); } Thanks - Gylfi -----Original Message----- From: Gylfi Ingvason [mailto:Gylfi.Ingvason@...] Sent: Wednesday, September 16, 2009 11:54 AM To: itextsharp-questions@... Subject: [itextsharp-questions] Transparency Groups Paulo, I've come across a case where we import a page from an existing PDF document and the color of an image does not match the original after the import. Basically, all we're doing is PdfImportedPage page = writer.GetImportedPage(reader, pageNumber); writer.DirectContent.AddTemplate(page, scaleX, 0, 0, scaleY, translateX, translateY); where the writer is a PdfWriter. If I use PdfCopy, the color will match. Upon examining the generated PDFs, I found that the images are indeed identical, but the Page object is missing a Group dictionary when I use PdfWriter. There is no Group dictionary in the XObject Form either. In the original file, the Group in the Page dictionary is like this: /Group<</CS/DeviceRGB/S/Transparency/Type/Group>> This is preserved when I use PdfCopy and, as far as I can tell, is the only thing that can explain the color difference. Is this perhaps a bug? The Group dictionary is a 1.4 feature according to Adobe so I would think it should be supported when generating 1.4 or 1.5 files. Is there a way for me to set something in the PdfWriter to insure this gets included? Thanks - Gylfi ---------------------------------------------------------------------------- -- Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ itextsharp-questions mailing list itextsharp-questions@... https://lists.sourceforge.net/lists/listinfo/itextsharp-questions ---------------------------------------------------------------------------- -- Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ itextsharp-questions mailing list itextsharp-questions@... https://lists.sourceforge.net/lists/listinfo/itextsharp-questions ------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ itextsharp-questions mailing list itextsharp-questions@... https://lists.sourceforge.net/lists/listinfo/itextsharp-questions |
| Free embeddable forum powered by Nabble | Forum Help |