[fw-general] Re: Crappy Thumbnails from generated pdf

2011-03-04 Thread student
Hey,

that sounds like an approach to follow. I'll see.
Thanks a lot for your information.

Regards

student

Am 04.03.2011 12:05, schrieb Simon Walter [via Zend Framework Community]:
> On 03/03/2011 12:24 AM, Stefan Riffert wrote:
>
> > Hello HTH,
> >
> > Unfortunately scribus only supports svg, eps and pdf.
> > I had some mails with the developers of scribus.
> > The option to invoke scibus in the commandline is planned. But no one
> > knows when...
> > I also asked if there is any option to convert the src files to FO or
> > something like this. Nothing.
> >
> > Using svg might be a solution.
> > The problem is, that my time is short and I never worked with svg like
> > this.
> > Do you know some libraries that provide functionality to add text and
> > images to svg files? Or where to start reading?
>
> It doesn't seem like an easy task to accomplish with limited time.
>
> SVG is an XML format. So basically a decent XML parser would serve the
> purpose. However, there are lots of CLI SVG tool kits that will probably
> save you much time. See:
>
> http://www.w3.org/Graphics/SVG/
> http://www.w3.org/Graphics/SVG/WG/wiki/Implementations
>
> Years ago that page had many more implementations. I assume Batik is the
> best, so they dropped the rest. SVG is very "scripting friendly".
>
> I'm not 100% sure what you are trying to do, but I had a look at the
> Scribus PDF form support. I guess you want to insert the user's values
> into the form and generate the PDF. So, if you have the Scribus document
> exported as an SVG file, you'd navigate the DOM to find the element you
> want to add the text to. You may need to use place holder text in the
> SVG file and then replace that text rather than insert it.
>
> You'll have to ask the SVG gurus about that. I think it's probably the
> cleanest and most maintainable way to achieve your goal.
>
> Props for using FOSS. d
>
> HTH
>
>
> 
> If you reply to this email, your message will be added to the 
> discussion below:
> http://zend-framework-community.634137.n4.nabble.com/Crappy-Thumbnails-from-generated-pdf-tp3329564p3335053.html
>  
>
> To unsubscribe from Crappy Thumbnails from generated pdf, click here 
> .
>  
>


--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/Crappy-Thumbnails-from-generated-pdf-tp3329564p3335144.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Re: [fw-general] Re: Crappy Thumbnails from generated pdf

2011-03-04 Thread Simon Walter

On 03/03/2011 12:24 AM, Stefan Riffert wrote:

Hello HTH,

Unfortunately scribus only supports svg, eps and pdf.
I had some mails with the developers of scribus.
The option to invoke scibus in the commandline is planned. But no one 
knows when...
I also asked if there is any option to convert the src files to FO or 
something like this. Nothing.


Using svg might be a solution.
The problem is, that my time is short and I never worked with svg like 
this.
Do you know some libraries that provide functionality to add text and 
images to svg files? Or where to start reading?


It doesn't seem like an easy task to accomplish with limited time.

SVG is an XML format. So basically a decent XML parser would serve the 
purpose. However, there are lots of CLI SVG tool kits that will probably 
save you much time. See:


http://www.w3.org/Graphics/SVG/
http://www.w3.org/Graphics/SVG/WG/wiki/Implementations

Years ago that page had many more implementations. I assume Batik is the 
best, so they dropped the rest. SVG is very "scripting friendly".


I'm not 100% sure what you are trying to do, but I had a look at the 
Scribus PDF form support. I guess you want to insert the user's values 
into the form and generate the PDF. So, if you have the Scribus document 
exported as an SVG file, you'd navigate the DOM to find the element you 
want to add the text to. You may need to use place holder text in the 
SVG file and then replace that text rather than insert it.


You'll have to ask the SVG gurus about that. I think it's probably the 
cleanest and most maintainable way to achieve your goal.


Props for using FOSS. d

HTH


Re: [fw-general] Re: Crappy Thumbnails from generated pdf

2011-03-02 Thread Stefan Riffert

Hello HTH,

Unfortunately scribus only supports svg, eps and pdf.
I had some mails with the developers of scribus.
The option to invoke scibus in the commandline is planned. But no one 
knows when...
I also asked if there is any option to convert the src files to FO or 
something like this. Nothing.


Using svg might be a solution.
The problem is, that my time is short and I never worked with svg like 
this.
Do you know some libraries that provide functionality to add text and 
images to svg files? Or where to start reading?


Regards student

Am 02.03.2011 08:05, schrieb Simon Walter:

On Tuesday, March 01, 2011 11:18:42 pm Jonathan Maron wrote:

Hello Student

The formats that LiveDocx supports are listed here:

http://www.phplivedocx.org/2009/01/12/supported-file-formats-in-phplivedocx
/

Unfortunately, it does not support Scribus.

Unfortunately it looks like it's usage promotes the use of proprietary
formats.

Does something similar exist for an open standard format like ODF?


I personally am not familiar with the inner working of the Scribus
format, hence, I cannot say whether it is possible to manipulate the
source files, either directly or via the CLI.

Can anyone else shed some light on this?

It looks like Scribus uses an XML format. It should be possible to manipulate
the DOM and insert your values. Rendering out a PDF of the Scribus document
would be the tricky part.

I see this bug/request which looks like it has not been implemented:
http://bugs.scribus.net/view.php?id=238

So perhaps it's a show stopper unless you patch Scribus yourself.

One idea:

If you are exporting the Scribus files as PDFs for use server side, why not
try exporting them as SVG instead. Then use those SVGs sever side to insert
the values and render out PDFs.

http://documentation.scribus.net/index.php/Vector_Export

--

HTH


Re: [fw-general] Re: Crappy Thumbnails from generated pdf

2011-03-01 Thread Simon Walter
On Tuesday, March 01, 2011 11:18:42 pm Jonathan Maron wrote:
> Hello Student
> 
> The formats that LiveDocx supports are listed here:
> 
> http://www.phplivedocx.org/2009/01/12/supported-file-formats-in-phplivedocx
> /
> 
> Unfortunately, it does not support Scribus.

Unfortunately it looks like it's usage promotes the use of proprietary 
formats.

Does something similar exist for an open standard format like ODF?

> I personally am not familiar with the inner working of the Scribus
> format, hence, I cannot say whether it is possible to manipulate the
> source files, either directly or via the CLI.
> 
> Can anyone else shed some light on this?

It looks like Scribus uses an XML format. It should be possible to manipulate 
the DOM and insert your values. Rendering out a PDF of the Scribus document 
would be the tricky part.

I see this bug/request which looks like it has not been implemented:
http://bugs.scribus.net/view.php?id=238

So perhaps it's a show stopper unless you patch Scribus yourself.

One idea:

If you are exporting the Scribus files as PDFs for use server side, why not 
try exporting them as SVG instead. Then use those SVGs sever side to insert 
the values and render out PDFs.

http://documentation.scribus.net/index.php/Vector_Export

--

HTH


[fw-general] Re: Crappy Thumbnails from generated pdf

2011-03-01 Thread student
Well thanks for your answer.
Facing the linebreaks wasnt that hard. Its already been done. Maybe I 
have a post on the GhostScripts forum.

Another problem is a mess with pictures converted to cmyk.
When I got an image (mainly jpg) it uses RGB colors in most cases. Due 
to the printers I have to convert them to cmyk using ImageMagick. The 
converted images look pretty good but a bit more bright. I think it is a 
typically loss of Qualtity during conversion. But when I insert it to a 
pdf it looks like an negative image from old cameras of the 90s...
The insertation is done as followes:
$img = Zend_Pdf_Image::imageWithPath($imgCmyk);
$page->drawImage($img, $left, $bottom, $right, $top);

This problem occured 10 min ago. That is why this question comes so late.

Regards and thanks

student

Am 01.03.2011 15:19, schrieb Jonathan Maron [via Zend Framework Community]:
> Hello Student
>
> The formats that LiveDocx supports are listed here:
>
> http://www.phplivedocx.org/2009/01/12/supported-file-formats-in-phplivedocx/
>
> Unfortunately, it does not support Scribus.
>
> Writing text into a PDF file is always tricky, as your programming
> logic has to calculate where to break lines etc. This can get very
> time consuming.
>
> I do not know whether you are able to get your customers to produce
> templates in one of the word processing file formats that LiveDocx
> supports, but if you can, your task of populating the templates would
> be much easier.
>
> I personally am not familiar with the inner working of the Scribus
> format, hence, I cannot say whether it is possible to manipulate the
> source files, either directly or via the CLI.
>
> Can anyone else shed some light on this?
>
> Best regards
>
> Jonathan Maron
>
> On Tue, Mar 1, 2011 at 2:33 PM, student <[hidden email] 
> > wrote:
>
> > Hello Jonathan,
> >
> > I had a look at this.
> > The templates we fill with customer data are produced using scribus
> > (http://www.scribus.net/).
> > In particular I would prefer to manipulate the Scribus Source fiels. 
> But
> > unfortunately Scribus isnt able to be invoked via commandline on 
> server.
> > So the only way is to write the data as text into an existing pdf for
> > the moment.
> > Or am I wrong?
> >
> > Regards student
> >
> > Am 01.03.2011 13:15, schrieb Jonathan Maron [via Zend Framework 
> Community]:
> >> Hello Student
> >>
> >> Looking at the sample code that you provide, it looks like you are
> >> doing some basic mail merge.
> >>
> >> You can certainly use Zend_Pdf for this.
> >>
> >> However, there is another component, Zend_Service_LiveDocx_MailMerge,
> >> which offers a really easy way to populate templates, created in a
> >> word processing WYSIWYG package (for example, MS Word) directly in
> >> PHP, using the Zend Framework.
> >>
> >> The idea is simple:
> >>
> >> 1) You make a template in MS Word (for example).
> >> 2) In this template, you add so called "merge fields".
> >> 3) Using only a few lines of code, you populate the merge fields in
> >> the template.
> >> 4) You then save the document to PDF (or any other supported format).
> >>
> >> Using this approach would be particularly advantageous to you, as you
> >> can also save the document to image files (PNG, GIF, JPG etc.) --
> >> perfect for the thumbnails that you need. You can specify the size of
> >> the resulting images files via the API.
> >>
> >> The documentation is here:
> >>
> >> http://framework.zend.com/manual/en/zend.service.livedocx.html
> >>
> >> Additionally, I run a blog dedicated to the component at:
> >>
> >> http://www.phplivedocx.org
> >>
> >> Which contains a number of sample applications.
> >>
> >> Getting started guide:
> >>
> >> 
> http://www.phplivedocx.org/articles/getting-started-with-phplivedocx-zf/
> >>
> >> Very simple sample applications:
> >>
> >> http://www.phplivedocx.org/articles/brief-introduction-to-phplivedocx/
> >>
> >> List of supported formats:
> >>
> >> 
> http://www.phplivedocx.org/2009/01/12/supported-file-formats-in-phplivedocx/
> >>
> >> You may also be interested in a session that I held at PHP
> >> Unconference Europe a couple of weeks ago:
> >>
> >> 
> http://www.phplivedocx.org/2011/02/19/slides-from-php-unconference-europe-2011/
> >>
> >> If you have any questions, please do not hesitate to ask me.
> >>
> >> Best regards
> >>
> >> Jonathan Maron
> >>
> >>
> >>
> >> On Tue, Mar 1, 2011 at 11:18 AM, student <[hidden email]
> >> > wrote:
> >>
> >> > Hello,
> >> >
> >> > I am looking forward to find some help regarding the creation of
> >> thumbnails
> >> > from a modified pdf.
> >> >
> >> > I use Zend_PDF to add some text and images to an existing pdf.
> >> > The way I use Zend is this:
> >> > $pdf = Zend_PDF::load(realpath($path));
> >> > $page = $pdf->pages[$page];
> >> > $font = getFont(); //here I load the Calibri.ttf or Eurostile.ttf 
> e.g.
> >> > $page->setFont($font, $fontSize);
> >> > $page->drawText($tmp, $posx, $posY, "UTF-8");
> >> > $pdf->save($savePath);
> >> >
> >> > After thi

Re: [fw-general] Re: Crappy Thumbnails from generated pdf

2011-03-01 Thread Jonathan Maron
Hello Student

The formats that LiveDocx supports are listed here:

http://www.phplivedocx.org/2009/01/12/supported-file-formats-in-phplivedocx/

Unfortunately, it does not support Scribus.

Writing text into a PDF file is always tricky, as your programming
logic has to calculate where to break lines etc. This can get very
time consuming.

I do not know whether you are able to get your customers to produce
templates in one of the word processing file formats that LiveDocx
supports, but if you can, your task of populating the templates would
be much easier.

I personally am not familiar with the inner working of the Scribus
format, hence, I cannot say whether it is possible to manipulate the
source files, either directly or via the CLI.

Can anyone else shed some light on this?

Best regards

Jonathan Maron

On Tue, Mar 1, 2011 at 2:33 PM, student  wrote:
> Hello Jonathan,
>
> I had a look at this.
> The templates we fill with customer data are produced using scribus
> (http://www.scribus.net/).
> In particular I would prefer to manipulate the Scribus Source fiels. But
> unfortunately Scribus isnt able to be invoked via commandline on server.
> So the only way is to write the data as text into an existing pdf for
> the moment.
> Or am I wrong?
>
> Regards student
>
> Am 01.03.2011 13:15, schrieb Jonathan Maron [via Zend Framework Community]:
>> Hello Student
>>
>> Looking at the sample code that you provide, it looks like you are
>> doing some basic mail merge.
>>
>> You can certainly use Zend_Pdf for this.
>>
>> However, there is another component, Zend_Service_LiveDocx_MailMerge,
>> which offers a really easy way to populate templates, created in a
>> word processing WYSIWYG package (for example, MS Word) directly in
>> PHP, using the Zend Framework.
>>
>> The idea is simple:
>>
>> 1) You make a template in MS Word (for example).
>> 2) In this template, you add so called "merge fields".
>> 3) Using only a few lines of code, you populate the merge fields in
>> the template.
>> 4) You then save the document to PDF (or any other supported format).
>>
>> Using this approach would be particularly advantageous to you, as you
>> can also save the document to image files (PNG, GIF, JPG etc.) --
>> perfect for the thumbnails that you need. You can specify the size of
>> the resulting images files via the API.
>>
>> The documentation is here:
>>
>> http://framework.zend.com/manual/en/zend.service.livedocx.html
>>
>> Additionally, I run a blog dedicated to the component at:
>>
>> http://www.phplivedocx.org
>>
>> Which contains a number of sample applications.
>>
>> Getting started guide:
>>
>> http://www.phplivedocx.org/articles/getting-started-with-phplivedocx-zf/
>>
>> Very simple sample applications:
>>
>> http://www.phplivedocx.org/articles/brief-introduction-to-phplivedocx/
>>
>> List of supported formats:
>>
>> http://www.phplivedocx.org/2009/01/12/supported-file-formats-in-phplivedocx/
>>
>> You may also be interested in a session that I held at PHP
>> Unconference Europe a couple of weeks ago:
>>
>> http://www.phplivedocx.org/2011/02/19/slides-from-php-unconference-europe-2011/
>>
>> If you have any questions, please do not hesitate to ask me.
>>
>> Best regards
>>
>> Jonathan Maron
>>
>>
>>
>> On Tue, Mar 1, 2011 at 11:18 AM, student <[hidden email]
>> > wrote:
>>
>> > Hello,
>> >
>> > I am looking forward to find some help regarding the creation of
>> thumbnails
>> > from a modified pdf.
>> >
>> > I use Zend_PDF to add some text and images to an existing pdf.
>> > The way I use Zend is this:
>> > $pdf = Zend_PDF::load(realpath($path));
>> > $page = $pdf->pages[$page];
>> > $font = getFont(); //here I load the Calibri.ttf or Eurostile.ttf e.g.
>> > $page->setFont($font, $fontSize);
>> > $page->drawText($tmp, $posx, $posY, "UTF-8");
>> > $pdf->save($savePath);
>> >
>> > After this I use GhostScript to generate thumbnails using the
>> following:
>> >
>> > gs -dBatch -dNOPAUSE -dSAFER -sDEVICE=png16m -r300 -dTextAlphaBits=4
>> > -dGraphicsAlphaBits=4 -dFirstPage=1 -dLastPage=1
>> > -sOutputFile=out/pdf_page1_thumbnail.png pdfs/pdf.pdf -c quit
>> >
>> > The problem is, that in most cases the inserted text is in a
>> different font
>> > size or the letters are overlaying each other. The modified pdf
>> documents
>> > are good.
>> >
>> > Here is a link that shows some generated thumbnails:
>> > https://printportal.la-well.de/thumbs.php
>> >
>> > I dont know if I am in the right place here. Please let me know, if
>> you have
>> > any hints or solutions to it.
>> >
>> > Regards
>> >
>> > student
>> >
>> >
>> >
>> >
>> > --
>> > View this message in context:
>> http://zend-framework-community.634137.n4.nabble.com/Crappy-Thumbnails-from-generated-pdf-tp3329564p3329564.html
>> 
>> > Sent from the Zend Framework mailing list archive at Nabble.com.
>> >
>>
>>
>> 

[fw-general] Re: Crappy Thumbnails from generated pdf

2011-03-01 Thread student
Hello Jonathan,

I had a look at this.
The templates we fill with customer data are produced using scribus 
(http://www.scribus.net/).
In particular I would prefer to manipulate the Scribus Source fiels. But 
unfortunately Scribus isnt able to be invoked via commandline on server.
So the only way is to write the data as text into an existing pdf for 
the moment.
Or am I wrong?

Regards student

Am 01.03.2011 13:15, schrieb Jonathan Maron [via Zend Framework Community]:
> Hello Student
>
> Looking at the sample code that you provide, it looks like you are
> doing some basic mail merge.
>
> You can certainly use Zend_Pdf for this.
>
> However, there is another component, Zend_Service_LiveDocx_MailMerge,
> which offers a really easy way to populate templates, created in a
> word processing WYSIWYG package (for example, MS Word) directly in
> PHP, using the Zend Framework.
>
> The idea is simple:
>
> 1) You make a template in MS Word (for example).
> 2) In this template, you add so called "merge fields".
> 3) Using only a few lines of code, you populate the merge fields in
> the template.
> 4) You then save the document to PDF (or any other supported format).
>
> Using this approach would be particularly advantageous to you, as you
> can also save the document to image files (PNG, GIF, JPG etc.) --
> perfect for the thumbnails that you need. You can specify the size of
> the resulting images files via the API.
>
> The documentation is here:
>
> http://framework.zend.com/manual/en/zend.service.livedocx.html
>
> Additionally, I run a blog dedicated to the component at:
>
> http://www.phplivedocx.org
>
> Which contains a number of sample applications.
>
> Getting started guide:
>
> http://www.phplivedocx.org/articles/getting-started-with-phplivedocx-zf/
>
> Very simple sample applications:
>
> http://www.phplivedocx.org/articles/brief-introduction-to-phplivedocx/
>
> List of supported formats:
>
> http://www.phplivedocx.org/2009/01/12/supported-file-formats-in-phplivedocx/
>
> You may also be interested in a session that I held at PHP
> Unconference Europe a couple of weeks ago:
>
> http://www.phplivedocx.org/2011/02/19/slides-from-php-unconference-europe-2011/
>
> If you have any questions, please do not hesitate to ask me.
>
> Best regards
>
> Jonathan Maron
>
>
>
> On Tue, Mar 1, 2011 at 11:18 AM, student <[hidden email] 
> > wrote:
>
> > Hello,
> >
> > I am looking forward to find some help regarding the creation of 
> thumbnails
> > from a modified pdf.
> >
> > I use Zend_PDF to add some text and images to an existing pdf.
> > The way I use Zend is this:
> > $pdf = Zend_PDF::load(realpath($path));
> > $page = $pdf->pages[$page];
> > $font = getFont(); //here I load the Calibri.ttf or Eurostile.ttf e.g.
> > $page->setFont($font, $fontSize);
> > $page->drawText($tmp, $posx, $posY, "UTF-8");
> > $pdf->save($savePath);
> >
> > After this I use GhostScript to generate thumbnails using the 
> following:
> >
> > gs -dBatch -dNOPAUSE -dSAFER -sDEVICE=png16m -r300 -dTextAlphaBits=4
> > -dGraphicsAlphaBits=4 -dFirstPage=1 -dLastPage=1
> > -sOutputFile=out/pdf_page1_thumbnail.png pdfs/pdf.pdf -c quit
> >
> > The problem is, that in most cases the inserted text is in a 
> different font
> > size or the letters are overlaying each other. The modified pdf 
> documents
> > are good.
> >
> > Here is a link that shows some generated thumbnails:
> > https://printportal.la-well.de/thumbs.php
> >
> > I dont know if I am in the right place here. Please let me know, if 
> you have
> > any hints or solutions to it.
> >
> > Regards
> >
> > student
> >
> >
> >
> >
> > --
> > View this message in context: 
> http://zend-framework-community.634137.n4.nabble.com/Crappy-Thumbnails-from-generated-pdf-tp3329564p3329564.html
>  
> 
> > Sent from the Zend Framework mailing list archive at Nabble.com.
> >
>
>
> 
> If you reply to this email, your message will be added to the 
> discussion below:
> http://zend-framework-community.634137.n4.nabble.com/Crappy-Thumbnails-from-generated-pdf-tp3329564p3329701.html
>  
>
> To unsubscribe from Crappy Thumbnails from generated pdf, click here 
> .
>  
>


-- 
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/Crappy-Thumbnails-from-generated-pdf-tp3329564p3329824.html
Sent from the Zend Framework mailing list archive at Nabble.com.