I've found library in php called moovrelocator.
Description from it's site:
MOOV Relocator is a well documented small library written in PHP to relocate (or move) the MOOV-Atom of MP4-Files from the end to the beginning of a file.
And it works pretty well with php.
Unfortunally I haven't found such library in python. And I want to ask community. Is there any library with which I can replace php-moovrelocator?
Quicktime/MP4 Fast Start
Enable streaming and pseudo-streaming of Quicktime and MP4 files by
moving metadata and offset information to the front of the file.
Usage
$ qtfaststart.py infile [outfile]
Related
Here is the code I used to convert my docx files to PDF:
<?php
require_once 'vendor/autoload.php';
use PhpOffice\PhpWord\IOFactory as WordIOFactory;
use PhpOffice\PhpWord\Settings;
// Set PDF renderer.
// Make sure you have `tecnickcom/tcpdf` in your composer dependencies.
Settings::setPdfRendererName(Settings::PDF_RENDERER_TCPDF);
// Path to directory with tcpdf.php file.
// Rigth now `TCPDF` writer is depreacted. Consider to use `DomPDF` or `MPDF` instead.
Settings::setPdfRendererPath('vendor/tecnickcom/tcpdf');
$phpWord = WordIOFactory::load('test/graph.docx', 'Word2007');
$phpWord->save('graph.pdf', 'PDF');
This code worked, but the problem was when it converted the file to PDF. The colors of the graphics were all lost and I feel like even the format was lost.
Here is the PDF file I had:
This picture shows the PDF file I had.
Here is the result after converting the DOCX file to a PDF file:
This picture shows the result after converting the DOCX file to a PDF file.
As you can see. The PDF file has lost the colors of the graphics. Who then, I would like to know from you. Do you have an idea to at least take into account the colors of the graphics? I have done a lot of research but have not found anything concrete. Can you help me please?
Well, I am doing my best to explain my problem. I hope I will get some nice answers. :)
Thank you for helping me. :)
I believe the OfficeConverter library will definitely helps you in what you're going to achieve, which it is actually utilising the libreoffice way mentioned by KJ.
I downloaded your graph.docx file and tested, the result should be what you're looking for. I have a demo site for you to test out, feel free to try it out, it is my open source project.
Here the link to the site PhpOfficeTemplate.
Do remember to Enable the Office Converter options.
Then select your docx file in the Template.
Hope it helps !
Microsoft Word has many proprietary features that cannot readily be carried over from conversion from DocX to simpler Rich Formats. This can be seen in Microsoft's own applications too. Very simply open a DocX in the native Write.exe here we see complex styles are unsupported.
It is thus not surprising that the only App that can faithfully convert Word Documents to PDF is MS Word export to PDF (Similar when converting PDF "To" DocX), and many converter programs/scripts can invoke an installed MS Office by calling Microsoft "Interop" DDLs.
Adobe Online Converter uses copies of MS Word as can be seen when using their conversion apps:-
Similar with other brand leading converters here Aspose clearly use MS Word
File: graph (1).pdf
...
Application: Microsoft Office Word
PDF Producer: Aspose.Words for .NET 22.11.0
PDF Version: 1.7
File Size: 7.07 KB (7,237 Bytes)
Number of Pages: 1
Page Size: 21.0 x 29.7 cm (A4)
Bottom line for docX fidelity you need a running copy of MS word
Next best
You can sometimes get close (but not always) using Libre Office or a variant so that chart works well using Server conversion. However, note the significant increase in size (over 10x bigger) to embed different MS aspects.
File: graph (2).pdf
...
Application: Writer
PDF Producer: ConvertAPI
PDF Version: 1.7
File Size: 93.37 KB (95,607 Bytes)
Number of Pages: 1
Page Size: 21.0 x 29.7 cm (A4)
You can better that (only 5 times bigger) by using a batch with local current 7.4
libreoffice\program>soffice --convert-to pdf *.docx
"The program script" as shown above, will start soffiice in the library\program folder, to convert every local docx into a local pdf.
If you need to customise, i.e. where you start it as a CWD, or run one by one files elsewhere, then that will be specific to your operating system and workflow, mine is just run one single line (or a few) as a full blown suite of commands, = power via one line simplicity.
There are 100's of variants of php aids and many to run and install libre office so try searching say github.com/search?q=php+libreoffice, a good example is the one shown by #zeikman
$converter->convertTo('output-file.pdf'); //generates pdf file in same directory as test-file.docx
I wonder how I can add tags to a PDF document using PHP. The idea is that I can search for a document using the tag that I assigned it previously.
Your hint is exiftool to manipulate PDF tags. There is a PHP wrapper/driver for it. BIG NOTE that it is not recommended for production.
You have to install pdf to image converter on your server, here is the settings:
Please update the server with this package, so the conversion functionality works.
you can found the files i used on local server from
i used on windows using follwing instructions
Install gs909w32.exe (http://downloads.ghostscript.com/public/gs909w32.exe )
Install ImageMagick-6.8.9-4-Q16-x64-dll.exe (Link )
paste "php_imagick.dll" file in C:\wamp\bin\php\php5.4.3\ext\
include extensions= php_imagick.dll in php.ini file
It will convert your .pdf document to images (1 image/1 page), then you can tag....
i have downloaded some php files (it's a content management system) but i can't open them. it appears that they contain binary data. this is what i get when i open them using a text editor:
Zend20020623011793334417xù
ں2ف=كڈإ™m{Orvƒًè¢9 ف]UفU0زع^ہ€eo.’ذî™éفïىجhzcëن7,xAœگrBBو$89¯‘<"ٍs~±B¤كغتزZء¤ص€1cXû‡ûû×O¦أل¼\آ=o…ر¨ّzـ;^´>®é3ُéJہإً_±w[ƒٍµhيŒٍE6Ovئس~:.$َügLk,{+»9*گ~m.إ5طû¤ْW%&&aد؛fجMe´?›خة<ƒط<_$o¦َ—Q^4ûJ§{ç/صg}u¥kڈnFق0غM2#5شl\ظو›—.©3 ق?h+<Wٍ9LkئPïھة¤4ےbإ9…ھ â8”8'´‘گwٍشQf~[أيBى}VC‘ هNç،Œح]ڈق~[ƒ‰ف:ô¾6Wںنüو–¤£ôُe½ئـة÷g%ت»®-ىلƒپآڈUˆ%©يئ‘B~نKٍ©,ةgڑCLاcپء¼اثYiآ9†ںئأ,?5طفمjک'g»³²ص_Jں&÷èQM+ƒZS=c¾03¥–xwجMB~TN±‹`قƒ²
(there is much more, about 50 lines)
what is this? i have never worked with Zend, is it some kind of compression? how can i open and edit these files?
This file appears to be encoded by Zend guard. You probably cannot decode it.
Here is something you can read on http://www.zend.com/en/products/guard/
Encoded PHP file. Protecting their source code
How would i generate a file of all of the following types:
.js
.css
.html
I would also need to be able to read the file and overwrite it somehow.
Is this possible in anyway?
All of these files are just text files with different file extensions so if I could maybe make a text file and change the file extension?
As all of those are simply text files, all you need to do is create/open the file with the desired name and write text into them.
Check out some of the PHP file IO commands:
fopen()
fread()
fwrite()
fclose()
PHP is usually (often?) used as a templating language, where HTML "files" are generated "on-the-fly" and output directly to the browser.
I could be wrong, but it sounds like you are talking about generating files and saving them to disk to be served statically to the browser later. If that's the case, you're right - they are just text-files - so writing them as text-files with the relevant file extension should work.
This seems like it would be logistically complicated to manage as a site scales though. Also - if you're creating an web-interface to edit files on the server, while some CMS-es do this (Wordpress for example), it does come with a lot of security issues (allowing PHP unrestricted write access to your server is rarely a good move).
As we know the function getimagesize() works very good for images and swf files.
But it doesn't support shockwave file (.dcr).
SO, how can I get the width and the height of such file..
I am not Lingo/Director expert, but AFAIK you won't be able to do this from PHP.
.DCR file format is not open so you won't find file format specification for you to make your own parser and extract that info on your own.
However, there should be way to do this using director movie on client side.
Eg. You load external dcr file inside your own director movie (then you will be able to read width/height etc of loaded file). Your own director movie then updates some database with info on that specific loaded file so you can show width/height later on.
I've found this artice dating back to 2006 where this guy suggests the same thing:
http://director-online.com/forums/read.php?1,20621,20621,quote=1
Good luck mate! :)
If you have a windows server, you could install IrfanView (free) and use it from the command line (yes, it's free and has a command line) to convert the swf to dcr. (Surely there is a similar tool for Linux).
Convert images on the command line with IfranView
To call OS command line from php, use shell_exec().
Then you could read the swf image size with php normally.
Hope this helps