Forum


Replies: 9   Views: 6064
Transform.php docx to pdf
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by willow  · 21-05-2014 - 12:52

 



Hola



Gracias por la respuesta.



Te indico:



[root@server advanced]# pwd



/var/www/html/PHPdocx/examples/advanced

[root@server advanced]# php Transform.php

2014-05-21T12:23:16+02:00 phpdocx_logger INFO  Create a temp file to use as initial ZIP file. DOCX is a ZIP file.

2014-05-21T12:23:16+02:00 phpdocx_logger INFO  Set language.

2014-05-21T12:23:16+02:00 phpdocx_logger INFO  Enable compatibility mode.

2014-05-21T12:23:16+02:00 phpdocx_logger INFO  Add text to word document.

2014-05-21T12:23:16+02:00 phpdocx_logger INFO  Set DOCX name to: example_text.

2014-05-21T12:23:16+02:00 phpdocx_logger INFO  DOCX is a new file, not a template.

2014-05-21T12:23:16+02:00 phpdocx_logger INFO  Remove existing template tags.

2014-05-21T12:23:16+02:00 phpdocx_logger INFO  Add word/document.xml content to DOCX file.

2014-05-21T12:23:16+02:00 phpdocx_logger INFO  Close ZIP file

2014-05-21T12:23:16+02:00 phpdocx_logger INFO  Copy DOCX file using a new name.

[root@server advanced]# ls

example_text.docx  FloatingTable.php  Report.php  Transform.php

[root@server advanced]#



 



No se crea el PDF...



[root@server 64]# pwd



/var/www/html/PHPdocx/lib/OdfConverter/64

[root@server 64]#  ./OdfConverter

./OdfConverter: error while loading shared libraries: libfontconfig.so.1: cannot open shared object file: No such file or directory





El problema estaba aquĆ­. Instaladas las dependencias y listo.



[root@server 64]# pwd

/var/www/html/PHPdocx/lib/OdfConverter/64



 



root@server 64]# ./OdfConverter

Incorrect or missing conversion parameters: Input is missing



Usage: OdfConverter.exe /I PathOrFilename [/O PathOrFilename] [/<OPTIONS>]



  Where options are:

     /I PathOrFilename  Name of the file to transform (or input folder in case of batch conversion)

     /O PathOrFilename  Name of the output file (or output folder)

     /F                 Overwrite existing file(s)

     /V                 Validate the result of the transformation against the schemas

     /P                 Show conversion progress on the command line

     /REPORT Filename   Name of the report file that should be generated (existing files will be replaced)

     /LEVEL Level       Level of reporting: 1=DEBUG, 2=INFO, 3=WARNING, 4=ERROR



  Batch options (use one of the /BATCH-<format> options at a time):

     /BATCH-ODT         Do a batch conversion over every ODT file in the input folder (Note: use /F to replace existing files)

     /BATCH-DOCX        Do a batch conversion over every DOCX file in the input folder (Note: use /F to replace existing files)

     /BATCH-ODP         Do a batch conversion over every ODP file in the input folder (Note: use /F to replace existing files)

     /BATCH-PPTX        Do a batch conversion over every PPTX file in the input folder (Note: use /F to replace existing files)

     /BATCH-ODS         Do a batch conversion over every ODS file in the input folder (Note: use /F to replace existing files)

     /BATCH-XLSX        Do a batch conversion over every XLSX file in the input folder (Note: use /F to replace existing files)

     /R                 Process subfolders recursively during batch conversion



  Conversion direction options (to disable automatic file type detection):

     /ODT2DOCX          Force conversion to DOCX regardless of input file extension

     /DOCX2ODT          Force conversion to ODT regardless of input file extension

     /ODS2XLSX          Force conversion to XLSX regardless of input file extension

     /XLSX2ODS          Force conversion to ODS regardless of input file extension

     /ODP2PPTX          Force conversion to PPTX regardless of input file extension

     /PPTX2ODP          Force conversion to ODP regardless of input file extension



  Developer options:

     /XSLT Path         Path to a folder containing XSLT files (must be the same as used in the lib)

     /NOPACKAGING       Don't package the result of the transformation into a ZIP archive (produce raw XML)

     /SKIP Name         Skip a post-processing (provide the post-processor's name)



[root@server advanced]# php Transform.php

2014-05-21T12:45:40+02:00 phpdocx_logger INFO  Create a temp file to use as initial ZIP file. DOCX is a ZIP file.

2014-05-21T12:45:40+02:00 phpdocx_logger INFO  Set language.

2014-05-21T12:45:40+02:00 phpdocx_logger INFO  Enable compatibility mode.

2014-05-21T12:45:40+02:00 phpdocx_logger INFO  Add text to word document.

2014-05-21T12:45:40+02:00 phpdocx_logger INFO  Set DOCX name to: example_text.

2014-05-21T12:45:40+02:00 phpdocx_logger INFO  DOCX is a new file, not a template.

2014-05-21T12:45:40+02:00 phpdocx_logger INFO  Remove existing template tags.

2014-05-21T12:45:40+02:00 phpdocx_logger INFO  Add word/document.xml content to DOCX file.

2014-05-21T12:45:40+02:00 phpdocx_logger INFO  Close ZIP file

2014-05-21T12:45:40+02:00 phpdocx_logger INFO  Copy DOCX file using a new name.

[root@server advanced]# ls -l

total 44

-rw-r--r-- 1 root root 24333 may 21 12:45 example_text.docx

-rw-r--r-- 1 root root  1985 may 21 12:45 example_text.pdf

-rwxrwxrwx 1 root root  3601 may  8 09:38 FloatingTable.php

-rwxrwxrwx 1 root root  5320 may  8 09:38 Report.php

-rwxrwxrwx 1 root root  1904 may 20 14:51 Transform.php

[root@server advanced]#



Gracias por todo.



Saludos.