Forum


Replies: 12   Views: 4415
Generated docx and pdf vastly differ
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 acunnington  · 12-05-2014 - 16:17

Hi,

I'm generating both of my documents. The DOCX from a template, and PDF from the newly created DOCX.



For some reason unbeknownst to me, the PDF doesn't carry across the formatting that the word document had. Any ideas? It's lacking images, font sizes (the sub/superscript on 2nd), converting black underlines to gray font etc etc.



http://i.imgur.com/H6toiDw.png



This is my PDF code;




    $document = new TransformDoc();
    $document->setStrFile($filename .'.docx');
    $document->generatePDF($filename . '.pdf');


Thanks,

Harry


Posted by jorgelj  · 13-05-2014 - 11:26

Hello,



You need to use the conversion plugin instead of the TransformDoc class.



Please check this pages:



http://www.phpdocx.com/documentation/pdf-conversion-plugin-installation-guide



http://www.phpdocx.com/help/conversion-plugin-docx-to-pdf



Regards.


Posted by acunnington  · 13-05-2014 - 12:24

Hi, thanks for the reply.

I'm now greeted with this error in my error_log.




** (OdfConverterTestStatic.exe:9408): CRITICAL **: _wapi_shm_file_open: shared file [/var/www/.wapi/shared_data-util.ap.local-Linux-x86_64-328-12-0] open error: No such file or directory

** (OdfConverterTestStatic.exe:9408): CRITICAL **: _wapi_shm_attach: shared file [/var/www/.wapi/shared_data-util.ap.local-Linux-x86_64-328-12-0] ope n error

** ERROR **: file shared.c: line 349 (shm_semaphores_init): assertion failed: (tmp_shared != NULL)
aborting...

** (process:9408): WARNING (recursed) **: Thread (nil) may have been prematurely finalized
Stacktrace:

** (process:9408): WARNING (recursed) **: Thread (nil) may have been prematurely finalized

Native stacktrace:

/mnt/utils/DocumentGenerator/lib/phpdocx/classes/../lib/OdfConverter/64/OdfConverter() [0x44ca20]
/lib64/libpthread.so.0() [0x31a620f710]
/lib64/libc.so.6(gsignal+0x35) [0x31a5a32925]
/lib64/libc.so.6(abort+0x175) [0x31a5a34105]
/lib64/libglib-2.0.so.0(g_logv+0x53a) [0x31a6e4337a]
/lib64/libglib-2.0.so.0(g_log+0x83) [0x31a6e43413]
/lib64/libglib-2.0.so.0(g_assert_warning+0x76) [0x31a6e43496]
/mnt/utils/DocumentGenerator/lib/phpdocx/classes/../lib/OdfConverter/64/OdfConverter() [0x52784c]
/mnt/utils/DocumentGenerator/lib/phpdocx/classes/../lib/OdfConverter/64/OdfConverter() [0x521ef3]
/mnt/utils/DocumentGenerator/lib/phpdocx/classes/../lib/OdfConverter/64/OdfConverter(mono_once+0x85) [0x516575]
/mnt/utils/DocumentGenerator/lib/phpdocx/classes/../lib/OdfConverter/64/OdfConverter(_wapi_handle_new+0x33) [0x521e73]
/mnt/utils/DocumentGenerator/lib/phpdocx/classes/../lib/OdfConverter/64/OdfConverter() [0x51d885]
/mnt/utils/DocumentGenerator/lib/phpdocx/classes/../lib/OdfConverter/64/OdfConverter(CreateSemaphore+0x19e) [0x51dc2e]
/mnt/utils/DocumentGenerator/lib/phpdocx/classes/../lib/OdfConverter/64/OdfConverter() [0x4f42cc]
/mnt/utils/DocumentGenerator/lib/phpdocx/classes/../lib/OdfConverter/64/OdfConverter(mono_runtime_init+0x25) [0x4ad5a5]
/mnt/utils/DocumentGenerator/lib/phpdocx/classes/../lib/OdfConverter/64/OdfConverter() [0x540ea1]
/mnt/utils/DocumentGenerator/lib/phpdocx/classes/../lib/OdfConverter/64/OdfConverter(mono_main+0x396) [0x4333d6]
/mnt/utils/DocumentGenerator/lib/phpdocx/classes/../lib/OdfConverter/64/OdfConverter(main+0x17d) [0x432ae3]
/lib64/libc.so.6(__libc_start_main+0xfd) [0x31a5a1ed1d]
/mnt/utils/DocumentGenerator/lib/phpdocx/classes/../lib/OdfConverter/64/OdfConverter(fmod+0x81) [0x4326e9]

Debug info from gdb:

=================================================================
Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================


Any known issues for this? I can't have a look at this for a few hours unfortunately.



Thanks,

Harry


Posted by jorgelj  · 13-05-2014 - 12:42

Hello,



You need to create this folder:



/var/www/.wapi



And set rwx access to the user that runs the program and Apache.



Regards.


Posted by acunnington  · 13-05-2014 - 14:08

I'm not using the /var/www folder, I'm using;




/mnt/utils/


So I created that directory, and did this command.




[root@util ~]# chown -R apache:apache /mnt/utils/.wapi/


It's still giving the same error message. Any advice?



 


Posted by acunnington  · 13-05-2014 - 14:09

I can't find an edit button, but here is the output of the error log when I run the script;



http://pastebin.com/dYDeQmcD


Posted by acunnington  · 13-05-2014 - 14:12

I did the chown for /var/www.



http://pastebin.com/TbM9q2S2



 


Posted by acunnington  · 13-05-2014 - 15:23

Figured it out. I was specifiying the output directory absolutely, although that was trying to go from the document root.



My next problem is it's not using the correct font even though I just installed it.


Posted by jorgelj  · 14-05-2014 - 09:47

Hello,



Can you use the font in other programs?



You could do a custom installation downloading OpenOffice from openoffice.org or from you distro repository.



Regards.


Posted by acunnington  · 14-05-2014 - 10:07

Hi,



I was just able to use the font in gedit, successfully.



When you say a custom installation, what exactly do you mean?



Thanks,

Harry


Posted by jorgelj  · 14-05-2014 - 15:24

Hello,



I mean to download OpenOffice from openoffice.org and install it.



Regards.


Posted by acunnington  · 15-05-2014 - 13:55

It's all sorted now. I tried lots of things, rebooted and it worked!



 



Thanks for the help.