[scribus-dev] GSOC: PDF Embedding
pierremarc at oep-h.com
Sat Jul 4 06:53:25 CEST 2009
Vous (Andreas Vox) avez écrit :
> > Speaking of my next task, it is the PDF embedding with color
> > management thing. Could you give me some hints on how to get
> > started?
> > I read in pdflib_core that basically it copies every objects
> > from the embedding file into the current file. What should I
> > do first if I want to manage the colors of the embedding PDF?
> > I guess the code has to look into the stream content of the
> > embedding file to find the colors it used, isn't it? I'm
> > quite confused how would I do that though.
> Hi Thach!
> I think the first thing should be to find out what colorspaces are used in
> the PDF.
> In addition it might also worth to check for used/embedded fonts and
> I suggest a new sourcefile with code that uses Podofo to read the PDF and
> - colorspace and transparency settings (blendmode, softmask, alpha) in
> graphic states
> - use of G, g, RG, rg, K, and k operators
> - colorspaces and resolution of bitmap images
> This code can then used by the preflighter to warn the user about issues.
> In my view that should be enough to remove the "EXPERIMENTAL" flag from PDF
> embedding. We can also enforce rasterizing the PDF to fix the colorspace
> and compatibility issues.
> Later you/we can extend the code to fix colorpace issues or embed missing
> fonts. The PDF reading code may also evolve into a PDF import function
I can’t help. Colors report is something on top of my TODO list for
PoDoFoBrowser and I’d be very happy to share code and experience to achieve
PoDoFo does allow to manipulate the stream content in 2 ways, as a raw text or
through a tokenizer. You can see both in use in the -viewer branch of
PoDoFoBrowser (i’m sick of so much case changes!). The real interest for
the tokenizer is that you can rely on it to identify PDF types and get values
more conveniently. At least I know I’ll use it myself to get all color infos,
values included. Note that you’ll need to write exceptions safe code with
PoDoFo as it relies heavily on it to handle errors rather than return codes,
so try/catch is your friend. Note again that there has been some major rewrite
of core code recently and you should work with Trunk.
More information about the scribus-dev