Page 3 of 5 FirstFirst 12345 LastLast
Results 21 to 30 of 43

Thread: How to read xml file using PHP

  1. #21
    Join Date
    Jun 2016
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi,
    sent
    Charles

  2. #22
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    OK, as you know I got the file. I've been looking at it and into the pptx specifications. Not looking great. Your example file shows a level of sophistication in the use of both images (not necessarily using one image per slide, also using non-web-standard image formats) and drawing (yes pptx files can also have drawings rendered via commands to put a line or shape one place or another upon or near an existing image). Your file uses all these techniques and perhaps more, making reading them out to PDF more difficult than I had at first imagined. That doesn't mean it cannot be done. But let me put it this way, (paraphrasing information I came across researching the standard) - The pptx standard is the result of at least thousands of hours of work over 10 or more years involving hundreds or more programmers. So to easily convert it fully to PDF in the manner we've been using would be quite a task. I found some folks who claim to have found decent workarounds. These involve using one or another document API. The two that so far look most promising are PUNO (Open Office API), and the Google Docs API. Both should be able to convert from many formats (including pptx) to many others (including PDF). However they require connecting live on the web to the given API during the conversion process and may also require one or more other modules to PHP (like ZEND, for example), all of which is likely doable unless you are prevented from adding needed modules, and/or must do this exclusively on an intranet that has no access to the web.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #23
    Join Date
    Jun 2016
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi John,
    thank you.
    ok. I have tried this way because the others possibilities were not accessible
    1) as you said "unless you are prevented from adding needed modules, and/or must do this exclusively on an Intranet that has no access to the web. " its exactly that
    2)I shouldn't use the class COM from PHP because it involves Microsoft Office or Open Office (for security reasons)
    3)pptx into images was my first attempt and the struggle was real
    4)now I was trying my last chance doing this: pptx -> unzip -> xml -> pdf (may be -> png)
    5)I think i'll give up so far as every software that does this conversion is not free and very expensive for a server purpose.
    Anyway ... thank you for your help

    Charles
    Last edited by mignoncharly; 06-08-2016 at 11:33 AM.

  4. #24
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    What I would be inclined to do in that case is either:

    1.) Just have them download and view the pptx file locally.

    or:

    2.) Convert them all to PDF using MO or OO (free if you don't have MO). You can probably setup a batch file to do all of them at once if there are - say more than ten. Then simply make the PDF files available, or even give the users the choice of format for download. Of course, in the case of PDF, they can always choose to simply view it in the browser (like all PDF viewed that way, it gets downloaded to the browser's cache anyway though).
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. #25
    Join Date
    Jun 2016
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi John,

    1.) Actually the files will be uploaded in a directory on the server and fetched (by a script / code) from there for the conversion. And the goal is to broadcast them in the form of pdf or images or video on public displays.

    2.) Convert them all to PDF using MO or OO. => No I shouldn't as explained in my last reply.

    Charles
    Last edited by mignoncharly; 06-09-2016 at 06:57 AM.

  6. #26
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    #2 Why not just do it? I mean don't have a web and/or intranet available routine for that, just do it manually or via a batch file that only you control/have access to. No security violation there.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  7. #27
    Join Date
    Jun 2016
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    This has already been done using asp .net but now I wanted to do it programmatically using php so no need for manual intervention

  8. #28
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Where did you find out about the asp.net approach? And does it use MO or another program, or is it a straight conversion like we were attempting in PHP? I would imagine that .net might have the data structures directly available to it and/or be extremely well suited to running MO from a shell.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  9. #29
    Join Date
    Jun 2016
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi,
    " ... .net might have the data structures directly available to it and/or be extremely well suited to running MO from a shell." exactly but with a batch file. the work has been done by another teammate. now we wanted to use only php.

    John I have found a software for the conversion now my problem is: could you propose me some method / tricks to use the .exe using php ? i was thinking about these steps:
    1) a function that pushes the pptx files in new array and
    2) a loop throught the array to fetch the 1.pptx and convert it
    what do you think?
    Thks in advance
    Charles

  10. #30
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    The glob function can do that (1, make the array), and foreach can loop (2) through it:

    PHP Code:
    foreach (glob("*.pptx") as $filename) {
        if(
    $filename === "1.pptx"){convert($filename);} 

    But if you are only doing that to choose the 1.pptx file, you can simply go after it directly:

    PHP Code:
    convert("1.pptx"); 
    BTW, what software did you find?
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Similar Threads

  1. read xml file
    By lay in forum PHP
    Replies: 4
    Last Post: 03-12-2009, 12:13 PM
  2. how to read pdf file using php?
    By khoulong in forum PHP
    Replies: 1
    Last Post: 03-12-2009, 03:33 AM
  3. read pdf file
    By lay in forum PHP
    Replies: 3
    Last Post: 03-12-2009, 02:39 AM
  4. how to read xml file from safari?
    By onoprise in forum JavaScript
    Replies: 1
    Last Post: 12-16-2008, 10:55 PM
  5. asp read file
    By midhul in forum ASP
    Replies: 1
    Last Post: 02-23-2008, 06:37 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •