[cairo] cairo with loading PDF and related questions
Fan Zhang
fz at chinasoft.dk
Fri Jan 23 00:07:47 PST 2009
Hello all,
I'm new to cairo, and was introduced to cairo because we thought it
might be the solution for vector graphic library in our php project.
So here's a little detail of the setup:
1. using cairo 1.6.4 fc9. (we are running fedora core 9)
2. lampp installed with pear, that's how to get to install cairo_wrapper.
3. running php 5 and the project is developed in php 5.
And here's the scope and objective of the project
1. Able to generate text images (single or multiple lines), giving the
text string, font size, font color, etc. (completed)
2. Able to display text images in PNG format in the browser. (completed
with cairo_surface_show_png in cairo_wrapper)
3. Able to generate PDF file contain the vector graphics of the text
image. (completed with cairo_text_path)
4. Able to load PDF file generated by Adobe Illustrator (assuming one
vector graphic only), change the fill color of the content to solid or
gradient color. (no solution yet)
5. Generate both PNG and PDF file after the modification of the PDF file
in 4, display the PNG file similar to "show png". (no solution yet)
6. Able to generate a layered PDF file from different source (png, pdf,
eps etc). (no solution yet)
7. Future support for loading AI file and construct a canvas editor
similar to AI, with path editor and abstract drawings.
Our project is developed half way to the point where we don't know if
the functions could be supported by cairo, or we have to find another
solution.
For goal no.4, the original idea is to have vector shapes saved as pdf
file and loaded into cairo, right now cairo wrapper does not support
reading form pdf (cairo_pdf_surface_create_from_pdf, or something like
that). We are going to develop in the way to allow user drawing the
shape instead of loading it. But the question is: can cairo support
loading from pdf? Since it could generate a vector format (with path)
pdf, is loading it back in and change the color too difficult?
For goal no.5, how to generate PNG from PDF surface? Maybe "how to load
PDF as PNG"? Because I think to convert between PNG and PDF is not the
case of cairo.
For goal no.6, The final PDF generated will be from texts and shapes
previously output from cairo, I understand cairo is not a PDF generator,
but is it possible to have layered context in cairo?
All this comes to text->path->png->pdf->more text->transform text->load
shape->change color->transform shape->generate PNG for proof->generate
PDF for printing and editing.
We've tried GD, Imagicks, and now cairo. We don't know whether any one
of these libraries can help or several of them, even to write our own
libraries?
Please help, we don't want to end up switch it to a .net project as this
will cost too much. We can only stay with php.
Fan
More information about the cairo
mailing list