Forums / General / How to generate PDF files

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

eZ debug

Timing: Jan 18 2025 19:28:49
Script start
Timing: Jan 18 2025 19:28:49
Module start 'content'
Timing: Jan 18 2025 19:28:49
Module end 'content'
Timing: Jan 18 2025 19:28:50
Script end

Main resources:

Total runtime0.2336 sec
Peak memory usage2,048.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0076 588.8203180.8438
Module start 'content' 0.00760.0060 769.6641105.9609
Module end 'content' 0.01360.2199 875.6250535.0234
Script end 0.2335  1,410.6484 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00813.4655200.0004
Check MTime0.00572.4431200.0003
Mysql Total
Database connection0.00130.543310.0013
Mysqli_queries0.176775.62791410.0013
Looping result0.00160.69521390.0000
Template Total0.219594.010.2195
Template load0.00100.409710.0010
Template processing0.218693.566610.2186
Override
Cache load0.00060.263210.0006
Sytem overhead
Fetch class attribute can translate value0.00190.806910.0019
XML
Image XML parsing0.00030.119910.0003
General
dbfile0.00230.9788200.0001
String conversion0.00000.003030.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs