Great that it works now!

Could you please send me your code for ICC support or provide a patch for 
PoDoFo so that other users can also profit from this addition?

best regards,
        Dom

Am Sunday 16 September 2007 schrieb Jonathan Sibony:
> I changed it a bit and it works! (image was messed up for CMYK profiles
> at first but it seems to work now)
>
>
>
> Thanks again for your kind support!
>
> Joanthan
>
>
>
> ________________________________
>
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Dominik
> Seichter
> Sent: Sunday, September 16, 2007 11:24 AM
> To: [email protected]
> Subject: Re: [Podofo-users] ICC Profile support
>
>
>
> Hi,
>
> The string you are passing to PdfVecObjects::CreateObject( ) is the name
> used for the /Type value of the object which is not required here.
>
> I think you code should look more like this:
>
> void PdfImage::SetICCProfile (PdfVecObjects* parent, const PdfName&
>
> rAlternate, char* profileData, long profileSize, long lColorComponents )
>
> {
>
>         PdfObject* iccObject = parent->CreateObject();
>
> iccObject->GetDictionary().AddKey( PdfName("Alternate"), rAlternate );
>
> // The number of color compontens is required. It must be 1,3 or 4 and
>
> // match the color compontens inside the ICC data
>
>     iccObject->GetDictionary().AddKey( PdfName("N"), lColorComponents );
>
>      PdfStream* iccStream = iccObject->GetStream();
>
>         iccStream->Set( profileData, profileSize);
>
> // Now add the colorspace to our image
>
> PdfArray array;
>
> array.push_back( PdfName("ICCBased") );
>
> array.push_back( iccObject->Reference() );
>
> this->GetObject().GetDictionary().AddKey( PdfName("ColorSpace"), array
> );
>
> }
>
> The code is totally untested and was just written down from my mind.
> Important is that you add the correct number of colorcomponents ("N") to
> the ICC object and of course you have to tell the PdfImage some how
> which colorspace should be used. Therefore you have to add the
> ColorSpace key to the image dictionary.
>
> To get the correct number of colorcomponents it might be neccesarry to
> actually parse the ICC data but I am not sure about this as I did not
> yet work with ICC data.
>
> best regards,
>
> Dom
>
> Am Sunday 16 September 2007 schrieb Jonathan Sibony:
> > Thanks for the explanation; I pretty much followed your suggestion
>
> (very
>
> > simple).
> >
> >
> >
> > SetICCProfile is something like this:
> >
> >
> >
> > void PdfImage::SetICCProfile (PdfVecObjects* parent, const PdfName&
> >
> > alternate, char* profileData, long profileSize(
> >
> > {
> >
> > PdfObject* iccObject =
> >
> > parent->CreateObject((alternate.GetName()).c_str());
> >
> > PdfStream* iccStream = iccObject->GetStream();
> >
> > iccStream->Set( profileData, profileSize);
> >
> > {
> >
> >
> >
> > Where alternate being passed is "ICCBased":
> >
> > pImage.SetICCProfile(parent, PdfName("ICCBased"), profileData,
> >
> > profileSize);
> >
> >
> >
> > I see that the object is being added however it doesn't seem to take
> >
> > effect (should a profile be attached to an image file, photoshop for
> >
> > example would immediately ask whether to use the profile or discard
>
> it,
>
> > or even when just inquiring the profile it should return the profile
> >
> > instead of the default)
> >
> >
> >
> > Any clue?
> >
> >
> >
> > Thanks
> >
> > jonathan
> >
> >
> >
> >
> >
> > -----Original Message-----
> >
> > From: [EMAIL PROTECTED]
> >
> > [mailto:[EMAIL PROTECTED] On Behalf Of Craig
> >
> > Ringer
> >
> > Sent: Wednesday, September 12, 2007 3:02 PM
> >
> > To: Jonathan Sibony
> >
> > Cc: [email protected]
> >
> > Subject: Re: [Podofo-users] ICC Profile support
> >
> >
> >
> > ...
> >
> > Each PDF document has a single PdfVecObjects instance. You'll need to
> >
> > take this as an argument to your `SetICCProfile(...)' or whatever
> >
> > method, since the PdfImage doesn't keep track of its owning document.
>
> To
>
> > the caller, the interface would thus be something like:
> >
> >
> >
> > SetICCProfile(PdfVecObjects* parent,
> >
> > const PdfName& alternate,
> >
> > const char * psProfileBytes,
> >
> > long int psProfileLength);
> >
> >
> >
> > Much of this is probably less than ideal in terms of interface and
>
> API.
>
> > Just explaining it has helped me get some ideas about how it could
> >
> > perhaps be made easier to understand through documentation and a few
> >
> > changes.
> >
> >
> >
> > --
> >
> > Craig Ringer



-- 
**********************************************************************
Dominik Seichter - [EMAIL PROTECTED]
KRename  - http://www.krename.net  - Powerful batch renamer for KDE
KBarcode - http://www.kbarcode.net - Barcode and label printing
PoDoFo - http://podofo.sf.net - PDF generation and parsing library
SchafKopf - http://schafkopf.berlios.de - Schafkopf, a card game,  for KDE
Alan - http://alan.sf.net - A Turing Machine in Java
**********************************************************************

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Podofo-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/podofo-users

Reply via email to