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