php - How to convert 10MB PDF to SVG quickly with appropriate size for web -
good day, have read questions , answers "pdf svg", "pdf png, png svg" , had no success in accomplishing task.
i have pdf 10mb (blueprints archicad) , after using pdf2svg convert svg, svg 70mb. conversion takes 14sec, web page load takes 150sec because of size of svg.
my question - how can convert pdf in php svg appropriate size web without quality loss , without gzipping it?
this code converts pdf svg 70mb:
$filename = 'in.pdf'; $targetname = 'out.svg'; exec("pdf2svg ".escapeshellarg($filename)." ".escapeshellarg($targetname));
this 1 converts pdf 500kb svg huge quality loss, path loss, text loss, etc.
exec("convert -density 200 ".escapeshellarg($filename)." middle.png"); exec("inkscape middle.png --export-plain-svg=".escapeshellarg($targetname));
ive tried imagemagick, autotrace, potrace, inkscape, pdf2svg. tried answer "convert pdf svg". other questions (on so) weren't close need.
i've read every link on google , every topic accomplish task, start with small size pdf doesn't solve problem.
why want absolutly in svg? if reduce pdf ghostscript, images stay are, change resolution.
i've convert pdf in smallers size ghostscript. it's easiest , faster convert ( imagick).
i think can find in http://www.ghostscript.com/doc/current/use.htm parts of answer.
i use reduce pdf in "ebook" quality:
exec('gs -sdevice=pdfwrite -dcompatibilitylevel=1.4 -dpdfsettings=/ebook -dnopause -dbatch -soutputfile='.$outfile.' '.$file.' ',$output, $return_var);
Comments
Post a Comment