How to generate PDF files

Author Message

Wei Dai

Tuesday 05 August 2008 11:52:35 pm

Hi,
I need generate PDF files from eZ Publish system. But, except the technical manual has a lengthy reference section on template PDF function, I can't find any other resource to tell me how to actually build a PDF template; how to link the url which point to the PDF file on the site..etc.

I also have tried use the PDF export in the admin interface:
Setup->PDF export.

Do a New PDF Export, set it as export structure:tree, and export type: generate on the fly and I set the classes objects which I want to be exported.

After hit ok. I click the link of the tile, with a link "/ezwebin_site_admin/pdf/edit/3/generate". I got a blank page. I checked the apache error log file, it says: [Wed Aug 06 14:50:09 2008] [error] [client 127.0.0.1] Client denied by server configuration: d:/ez3/ezwebin_site_admin.

I just want to generate PDF file for certain content object. Wish anyone can help me on this.
Thanks.

Certified eZ Publish 4 developer looking for develop information & collaboration.

Pierre T.

Tuesday 05 August 2008 11:58:19 pm

Did you try the following code :

<div class="attribute-pdf">
<p>
<a href={concat('/content/pdf/',$node.node_id)|ezurl}>
{'application/pdf'|mimetype_icon( small, "Download PDF"|i18n( "design/base" ) )} 
{"Download PDF version of this page"|i18n( "design/base" )}</a>
</p>
</div>

To generate a pdf on the fly ?

Wei Dai

Monday 11 August 2008 3:05:02 am

Thanks for the replying.

Now I can generate the PDF file for a node. But, by default, it just take the source code of the page and make it a PDF file. There are many html comment in the source code, e.g.

<!-- START: including template:...-->
....
<!-- STOP: including template: ...-->


And, of course, the actual content is not in the format I want to be displayed. I knew there is a way for define the template for the PDF. But, it seems there is few resources on this topic. I found this: http://ez.no/ezpublish/documentation/incoming/pdf_export_tutorial. It seems not completed, since it under the "incoming" of the documentation.

I want to know, what is the mechanism in the eZ Publish for creating PDF template.

And, I also want to know how to generate PDF file from a sequence of nodes of a sub tree.

Thank you very much.

Certified eZ Publish 4 developer looking for develop information & collaboration.

Pascal Specht

Tuesday 12 August 2008 3:07:51 am

Hi Wei,

do the

<!-- START: including template:...-->


like tags stay when you turn debugging of for your site-access?

As far as I know, the PDF mechanism is pretty similar to the HTML mechanism, look for example here: design/standard/templates/content/pdf/embed.tpl.

Getting a good layout out of there ended up to be too complicated in most cases for me: I just went to produce the PDF with external tools, like the FPDF library (unfortunately not UTF-8 capable, but yet easy to use)

</Pascal>

Wei Dai

Monday 18 August 2008 8:22:00 pm

Hi,
Thanks. Yes, after turn off the debug, the tags are gone.

Other things I don't know is that how to show the related and embed objects in the PDF? I have a full node view which use the code above to generate the PDF, but there is a related object in the node, which shows just a link.

I think it was load the default template in /design/standard/templates/content/pdf/full.tpl. I checked this file, and does this because it calls the content_pdf_gui with the view set to "text_linked"?
Can eZ Publish shows PDF format of a form?

Another question is, can I generate a PDF file based on a serial nodes with each node as a page in the PDF?

Thank you very much.

Certified eZ Publish 4 developer looking for develop information & collaboration.

Wei Dai

Tuesday 09 September 2008 4:09:14 am

Hi, Pascal Specht, I am using the PDF exporting. Speak of the utf-8 support. Do you know if eZ Publish can support Chinese font in PDF? If it can, how to do that?

Certified eZ Publish 4 developer looking for develop information & collaboration.

Pascal Specht

Tuesday 09 September 2008 6:28:51 am

Hi Wei,

sorry, but I use the (third party) FPDF extension, which is, sad enough, not even UTF-8 compatible... But since I use it to export graphical stuff, it didn't matter for me.

Sorry I'm not of much help on this topic,

Pascal

Ivo Lukac

Tuesday 09 September 2008 8:22:02 am

I would also like to know when will ezpdf support UTF-8?

http://www.linkedin.com/in/ivolukac
http://www.netgen.hr/eng/blog
http://twitter.com/ilukac

D K

Friday 23 January 2009 12:28:41 am

Hi,

I am new to ez publish and using version 4. I want to format the pdf generation template. I have followed following article.
http://ez.no/ezpublish/documentation/incoming/pdf_export_tutorial

But I couldn't get the result.

Following is the link I have created.

<a href="{concat('/content/pdf/',$node.object.main_node.node_id)|ezurl}" >Export to PDF</a>

Following is the code I have updated in the override.ini.append.php in the settings.
[full_pdf]
Source=node/view/pdf.tpl
MatchFile=node/view/full/pdf.tpl
Subdir=templates
Match[class_identifier]=9

But there is no class as ID = 9. So How do I need to create that class?

Please help...

http://www.eyepax.com

D K

Monday 26 January 2009 3:56:28 am

Hi,

I have sorted out this issue. Once you remove "Match[class_identifier]=9", it works fine.

Now I have following problems:

-> embed images to the pdf
-> bold some text
-> remove some formatting of the content

Please help on this regards.

Thanks

http://www.eyepax.com

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 15:53:29
Script start
Timing: Jan 18 2025 15:53:29
Module start 'layout'
Timing: Jan 18 2025 15:53:29
Module start 'content'
Timing: Jan 18 2025 15:53:30
Module end 'content'
Timing: Jan 18 2025 15:53:30
Script end

Main resources:

Total runtime0.8320 sec
Peak memory usage4,096.0000 KB
Database Queries84

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0049 587.9063152.6250
Module start 'layout' 0.00490.0023 740.531339.4453
Module start 'content' 0.00720.8231 779.9766737.9844
Module end 'content' 0.83030.0016 1,517.960920.1641
Script end 0.8320  1,538.1250 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00300.3629160.0002
Check MTime0.00120.1488160.0001
Mysql Total
Database connection0.00060.068410.0006
Mysqli_queries0.742989.2855840.0088
Looping result0.00090.1118820.0000
Template Total0.802396.420.4012
Template load0.00180.216120.0009
Template processing0.800596.216720.4003
Template load and register function0.00010.017610.0001
states
state_id_array0.00100.125510.0010
state_identifier_array0.00160.193020.0008
Override
Cache load0.00170.2005770.0000
Sytem overhead
Fetch class attribute can translate value0.00070.082850.0001
Fetch class attribute name0.00120.1461120.0001
XML
Image XML parsing0.00570.682250.0011
class_abstraction
Instantiating content class attribute0.00000.0033130.0000
General
dbfile0.00710.8570230.0003
String conversion0.00000.000740.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
10content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
10content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
19content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
3content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 47
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs