prince xml

20 views
Skip to first unread message

Jean-Baptiste Bonnet

unread,
Aug 1, 2013, 5:39:35 PM8/1/13
to zena...@googlegroups.com
Hi Gaspard,

Would you have a code sample to use pdf generation in zena? I think my
configuration is fine but I can't get pdf to be generated...

I have installed prince xml on my server. I also upgraded to zena 1.2.5.
Prince is working in command line on the server.
I checked that the bricks.yml file (in the zena application config
directory) has:

production:
# Port used only to provide assets during custom rendering (pdf).
# We need this to avoid deadlocks with round-robin based serving.
asset_port: 7999
...
pdf:
switch: ON
engine: prince

Thanks!

Gaspard Bucher

unread,
Aug 2, 2013, 10:14:52 AM8/2/13
to zena
Hi Jean-Baptiste,

The "asset_port" setting was needed for stupid schedulers that blindly assign web requests not knowing if the previous request is done or not. With Passenger, you should not use an asset_port (just remove the line from bricks.yml).

You probably figured this out but to be sure: to render a pdf, you create a template with "pdf" format. You can test with "Node--pdf" (any class, no mode, pdf format). You can then test the rendering with:

your.host/oo/node1.pdf

To see if it renders.

You can also add the ?debug query string to see if the rendered html looks OK (try validating it with w3c because prince xml is very tricky on xhtml errors). This step should work even if there are some problems with the prince executable.

your.host/oo/node1.pdf?debug

Finally, all princexml errors should be reported back in the production logs.

Cheers from Öland !

Gaspard

PS: these guys from Sweden are crazy. On this island with 4G, their internet is 5x better (20 Mb/s) as what I have at home in Switzerland.





--
--
_______________________________________________
zena mailing list
ze...@zenadmin.org
http://zenadmin.org/en/community
--- You received this message because you are subscribed to the Google Groups "zena" group.
To unsubscribe from this group and stop receiving emails from it, send an email to zena-talk+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.





--

                                                               Gaspard

Jean-Baptiste Bonnet

unread,
Aug 2, 2013, 3:59:53 PM8/2/13
to zena...@googlegroups.com
Thanks a lot for you reply during your holidays!
I hadn't figured out how things would work actually...
With your information I finally got some very simple pdf to show on my zena site!

Now my problem is that my server could not find the "prince" command while executing the rendering. As a quick patch I modified the "prince.rb" file:

      module Prince
        def command(opts)
          cmd = ['/home/user/lib/bin/prince']
          {

But I guess there's a better way to do this! I have added the following line in my .bash_profile:
export PATH=~/lib/bin/:$PATH
but I think this is only useful when I am connected on my server with "bash"

Anyhow I can go on for now and start generate pdf
Thanks!
To unsubscribe from this group and stop receiving emails from it, send an email to zena-talk+...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.





--

                                                               Gaspard
--
--
_______________________________________________
zena mailing list
ze...@zenadmin.org
http://zenadmin.org/en/community
---
You received this message because you are subscribed to the Google Groups "zena" group.
To unsubscribe from this group and stop receiving emails from it, send an email to zena-talk+...@googlegroups.com.

Gaspard Bucher

unread,
Aug 3, 2013, 4:36:57 AM8/3/13
to zena
I will add a "cmd" option in bricks.yml next to "engine" for the pdf renderer.

Jean-Baptiste Bonnet

unread,
Aug 3, 2013, 10:18:01 AM8/3/13
to zena...@googlegroups.com
Hello Gaspard,

I discovered that images are not displayed in the pdf if they are not "public". Instead is a box with the "alt" text. I am logged as an admin so I can see all objects and I should be able to convert any of them to pdf as well.
Maybe a problem with the http authentication of Prince xml?

I will send you the log files in a separate mail, if this can help.

I also made some tests with another pdf engine, "wkhtmltopdf" and I got to the same results as with prince, with a lot of tweaking though! If I get to something functional I'll tell the list.

Cheers!

Gaspard Bucher

unread,
Aug 3, 2013, 12:29:45 PM8/3/13
to zena
Voici le bidule.
teti.zip
Reply all
Reply to author
Forward
0 new messages