Project

General

Profile

Feature #1768

export html document to pdf from documents tool

Added by Juan Carlos Raña Trabado over 9 years ago. Updated over 8 years ago.

Status:
Feature implemented
Priority:
Normal
Category:
-
Target version:
Start date:
27/07/2010
Due date:
% Done:

100%

Estimated time:
Complexity:
Normal
SCRUM pts - complexity:
?

Files

training_name_template_to_pdf.png (90.8 KB) training_name_template_to_pdf.png Ivan Tcholakov, 30/07/2010 06:54
sample_export.png (318 KB) sample_export.png Ivan Tcholakov, 30/07/2010 08:52

Related issues

Related to Chamilo LMS - Feature #318: Dokeos 1.8.6 Templates cleaning upFeature implemented03/12/2009

Actions

History

#1

Updated by Juan Carlos Raña Trabado over 9 years ago

  • Status changed from New to Assigned
  • % Done changed from 0 to 50

http://code.google.com/p/chamilo/source/detail?r=dec8c8b28278153e6c43410ac1bfb7271beeb07f&repo=classic

I upload the code but disabled for now, because there is a problem when pages are imported into them css styles

Ivan, when you have time you could lend a hand here?

#2

Updated by Ivan Tcholakov over 9 years ago

Tomorrow...

#3

Updated by Ivan Tcholakov over 9 years ago

12304:f1c9107e337f Feature #1768 - Restructuring code within the libraries for better serving the "Documents" tool.
http://code.google.com/p/chamilo/source/detail?r=f1c9107e337fd9afd9eb961130f3e3aa2baa57b8&repo=classic

#4

Updated by Ivan Tcholakov over 9 years ago

  • % Done changed from 50 to 60

12305:0169de98022a Feature #1768 - Some changes in PDF-export functionality in the "Documents" tool. The icon is hidden yet. There is a problem noticed in my place - the images within the created PDF are not shown - to be checked soon. Btw, attaching additional CSS file is not necessary, because in this tool the documents have full html syntax. They may contain inline and/or linked CSS directives which are parsed by mPDF. Also, because of the full html, I changed the way of header/footer implementation.
http://code.google.com/p/chamilo/source/detail?r=0169de98022a219f66ea702d18faabc798f259b2&repo=classic

#5

Updated by Ivan Tcholakov over 9 years ago

Two major problems are to be solved so far:
1. The images must be exported successfully;
2. Templates should be checked about html or css bugs that break the mPDF parser. Now from the templates empty pdf pages are exported.

#6

Updated by Juan Carlos Raña Trabado over 9 years ago

Thanks Ivan. I take a look at the various templates. I look for something wrong

#7

Updated by Ivan Tcholakov over 9 years ago

I will check the library mPDF for patching it, if it is necessary.

#8

Updated by Juan Carlos Raña Trabado over 9 years ago

  • Status changed from Assigned to Bug resolved
  • Target version set to 1.8.7.1
  • % Done changed from 60 to 80
#9

Updated by Juan Carlos Raña Trabado over 9 years ago

  • Status changed from Bug resolved to Needs testing
#10

Updated by Ivan Tcholakov over 9 years ago

I am going yo make a commit about the first problem (the images)...

#11

Updated by Ivan Tcholakov over 9 years ago

12318:388c5853f3f9 Feature #1768 - Documents tool, full-html export to pdf: Solving the first problem about the missing images.
http://code.google.com/p/chamilo/source/detail?r=388c5853f3f952958c2c2b21a9b40a7730fd7ce9&repo=classic

Pictures with relative addresses should be seen in the result PDF too.

#12

Updated by Ivan Tcholakov over 9 years ago

But the pictures from the templates that have semi-absolute addresses don't work. A correction is needed, I will try to prepare it.

#13

Updated by Ivan Tcholakov over 9 years ago

I reinstalled the system and the problem with the images disappeared. Ok.

If have a file with a title "Title" then the exported pdf receives filename as Title.html.pdf . Is it possible this html in the middle to disappear?

For 1.8.8 I suggest the following fragment of code to be removed, it is a workaround, very dirty:

//clean styles and javascript document
$clean_search = array(
'
<script[^>]*?>.*?</script>si',
'
<style[^>]*?>.*?</style>@siU'
);
$document_html = preg_replace($clean_search, '', $document_html);

//absolute path for frames.css //TODO: necessary?
$absolute_css_path=api_get_path(WEB_CODE_PATH).'css/'.api_get_setting('stylesheets').'/frames.css';
$document_html=str_replace('href="./css/frames.css"',$absolute_css_path,$document_html);

//replace relative path by absolute path for resources
$document_html= str_replace('src="/chamilo/main/default_course_document/', 'temp_template_path', $document_html);// before save src templates not apply
$document_html= str_replace('../','',$document_html);
$src_http_www= 'src="'.api_get_path(WEB_COURSE_PATH).$_course['path'].'/document/';
$document_html= str_replace('src="',$src_http_www,$document_html);
$document_html= str_replace('temp_template_path', 'src="/chamilo/main/default_course_document/', $document_html);// restore src templates@

I will try to remove this code after the future upgrade to mPDF 5 (beta is released).

#14

Updated by Ivan Tcholakov over 9 years ago

I am attaching yet another test sample which is Ok. I think, the task is 100% ready.

#16

Updated by Juan Carlos Raña Trabado over 9 years ago

  • % Done changed from 80 to 100
#17

Updated by Marko Kastelic over 9 years ago

hm, 'edit' column with new pdf icon (document tool) should be enlarged (from current 100px to at least 120px width)

#22

Updated by Yannick Warnier over 8 years ago

  • Status changed from Needs testing to Feature implemented

Also available in: Atom PDF