Citation

Linux – Find string in files

find . | xargs grep ‘string’ -sl

The -s is for summary and won’t display warning messages such as grep: ./directory-name: Is a directory

The -l is for list, so we get just the filename and not all instances of the match displayed in the results.

I find this useful for just quickly seeing which files contain a search time. I would normally limit the files searched with a command such as :
find . -iname ‘*php’ | xargs grep ‘string’ -sl

Another common search for me, is to just look at the recently updated files:
find . -iname ‘*php’ -mtime -1 | xargs grep ‘string’ -sl

would find only files edited today, whilst the following finds the files older than today:
find . -iname ‘*php’ -mtime +1 | xargs grep ‘string’ -sl

Some commands for cordova project

npm install -g cordova

cordova create workshop com.shen.workshop Workshop

cd workshop

npm install ant

wget http://dl.google.com/android/adt/22.6.2/adt-bundle-windows-x86_64-20140321.zip

set ANT_HOME=c:\ant
set JAVA_HOME=C:\Program Files\Java\jdk1.7.0_45
set PATH=%PATH%;%ANT_HOME%\bin

cordova platforms add android

///////////cordova cli/////////////////
cordova help
cordova -v
cordova create project_folder
cordova create project_foler app_id app_name
cordova create myapp com.cordovaprogramming.hello Hello

cordova platform add android ios
cordova platforms
cordova platform list

cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs.git
cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git
cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-console.git
cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-vibration.git
cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-battery-status.git
cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion.git
cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-deviceorientation.git
cordova plugin add org.apache.cordova.device-orientation
cordova plugin add org.apache.cordova.network-information
cordova plugin add org.apache.cordova.geolocation
cordova plugin add org.apache.cordova.camera
cordova plugin add org.apache.cordova.media-capture
cordova plugin add org.apache.cordova.globalization
cordova plugin add org.apache.cordova.contacts
cordova plugin add org.apache.cordova.media
cordova plugin add org.apache.cordova.inappbrowser
cordova plugin add org.apache.cordova.splashscreen

cordova plugin add camera
cordova plugin add c:\dev\plugins\my_plugin_name
cordova plugin add org.apache.cordova.console
cordova plugin rm plugin_name
cordova plugin remove org.apache.cordova.core.file

cordova prepare android
cordova compile android
cordova build android
cordova emulate android
cordova run android

cordova serve android
cordova serve android 8080

//Debugging
npm install –g weinre

weinre

http://localhost:8080/

D3 gallery

 

Visual Index

Box Plots
Bubble Chart
Bullet Charts
Calendar View
Non-contiguous Cartogram
Chord Diagram
Dendrogram
Force-Directed Graph
Circle Packing
Population Pyramid
Stacked Bars
Streamgraph
Sunburst
Node-Link Tree
Treemap
Voronoi Diagram
Hierarchical Edge Bundling
Voronoi Diagram
Symbol Map
Parallel Coordinates
Scatterplot Matrix
Zoomable Pack Layout
Hierarchical Bars
Epicyclical Gears
Collision Detection
Collapsible Force Layout
Force-Directed States
Azimuthal Projections
Choropleth
Collapsible Tree Layout
Zoomable Treemap
Zoomable Partition Layout
Zoomable Area Chart
Drag and Drop Collapsible Tree Layout
Rotating Cluster Layout
Sankey Diagram
Fisheye Distortion
Hive Plot
Co-occurrence Matrix
Motion Chart
Chord Diagram
Animated Béziers
Zoomable Sunburst
Collatz Graph
Parallel Sets
Word Cloud
Obama’s Budget Proposal
Facebook IPO
Political Influence
Federal Budget
US Trade Deficit
Sequences sunburst
Koalas to the Max
Particles
Indented Tree
Rounded Rect
Tadpoles
Showreel
Euro Debt
Labeled Force Layout
Circle-Square Illusion
Voronoi Picking
Zoomable Map
Raindrops
Color
Parallel Coordinates
Hacker News Popularity
Life Expectancy
Slopegraphs
NCAA Predictions
Cubism.js
Crossfilter.js
Wind History
Cubic Hamiltonian Graphs
Force-Directed Voronoi
Trulia Trends
Trulia Trends
Open Budget
Bederson Publications
Force Layout Editor
Open Knowledge Festival
Hierarchical Classification Tree
Gene Expression
spacetime
d3 Analog Clock Dashboard
Concept network browser
Circular heat chart
Convert any page into bubbles
Directed Graph Editor
Weeknd3
Explosions
CodeFlowers
Animated wind chart
What makes us happy?
Simple SOM Animation
A mower demo
Map and context with brushing
Binary tree with transitions
d3+ColorBrewer
D3 JezzBall
Tetris
Gantt Chart
Day/Hour Heatmap
Sunburst and parse.com
Worldwide remittance flows
Language Network
Wimbledon 2012
Force directed tag/site explorer
Bus transit data
Airline data from Fusion Tables
Geographical hexbins
xkcd-style Comic Narrative Charts
GitHub Visualizer
WorldBank Contract Awards
Site or blog concept browser
Global power structure
Choropleth on canvas
Google calendar like visualization
Interactive Sales Data Pie Chart
Wikistalker – Wikipedia Visualization
D3 Cesium – Health and Wealth of Nations
Starpaths
BT Hotspots mapped
CoreNLP Sentence Parse Tree
Publications in journals over time
Another state budget visualization with open api
Interactive Bible contradictions & bar charts [source]
Force Edge Bundling For Graphs
[Source & Docs]
Gauge
Bullet Charts
Arc Axis
Bar chart with tooltips
Tokyo Wind Map
Dependency Wheel
60 years of french first names
Hip Replacement by State
Compare time series with irregular interval
Table with Embedded Line Chart
Dual-scale Bar Chart
Animated Pie and Line Chart
Multivariate Data Exploration with Scatterplots
Live Power Outages In Maine
Relative Size Of The Planets
AWS EC2 Price Comparison Chart
Hurricane Forecast Path Evolution
Sandy’s Storm Surge
Monthly NCDC Climate Summary
Epidemic Game
UK Temperature Graphs
Data Heatmap with Sorting Functions
Node-Link Tree Showing Branches of Government
3D Force Layout
Rotating Arcs
Lifespan
The Movie Network
Bowls with Liquid
BiPartite Visualization
BeerViz
3D Donut
Graceful Tree Conjecture
Gradient Pie
Top Scorers in 2013/14 Champions League – Breakdown analysis
Sankey: How a Georgia bill becomes law
A game based on d3
Viroscope – virus taxonomy viewer
Twitter & Reddit topics during week one of MH-370′s disappearance
Eurovision song contest voting oddities
SizeViewer
OrgoShmorgo
Fund Visualization

Basic Charts

Area Chart
Line Chart
Bivariate Area Chart
Multi-Series Line Chart
Stacked Area Chart
Bar Chart
Stacked Bar Chart
Normalized Stacked Bar Chart
Grouped Bar Chart
Scatterplot
Donut Chart
Pie Chart
Donut Multiples
Bar Chart with Negative Values
Animated Donut Chart with Labels
Stacked Bar Charts on time scale
Bar Chart Multiples
d3pie – pie chart generator and lib

Techniques, Interaction & Animation

General Update Pattern
Sortable Bar Chart
van Wijk Smooth Zooming
Progress Events
Margin Convention
Focus+Context via Brushing
Difference Chart
Pie Chart Update
Hexagonal Binning
Contour Plot
Build Your Own Graph
Modifying a Force Layout
Spline Interpolation
Dispatching Events
Better force layout selection
v45 web theme using SVG
Interactive force layout

Beginning WebGL for HTML5

Demonstrations

  • There are many demos of WebGL, including these:
  • • http://www.chromeexperiments.com/webgl
  • • https://code.google.com/p/webglsamples/
  • • http://aleksandarrodic.com/p/jellyfish/
  • • Google Body (now http://www.zygotebody.com), parts of Google Maps,
  • and Google Earth
  • • http://www.ro.me/tech/
  • • http://alteredqualia.com/

Although IE currently has no built in support, plugins are available; for example, JebGL (available at

  • http://code.google.com/p/jebgl/), Chrome Frame (available at http://www.google.com/chromeframe), and
  • IEWebGL (http://iewebgl.com/). JebGL converts WebGL to a Java applet for deficient browsers; Chrome Frame
  • allows WebGL usage on IE, but requires that the user have it installed on the client side. Similarly, IEWebGL is
  • an IE plugin.

Testing for WebGL Support

  • To check for browser support of WebGL. there are several websites such as http://get.webgl.org/, which
  • displays a spinning cube on success; and http://doesmybrowsersupportwebgl.com/, which gives a large “Yay”
  • or “Nay” and specific details if the webgl context is supported. We can also programmatically check for WebGL
  • support using modernizr (http://www.modernizr.com).

• KickJS Shader Editor

  • http://www.kickjs.org/example/shader_editor/shader_editor.html
  • • WebGL Playground
  • http://webglplayground.net/
  • • SpiderGL MeShader
  • http://spidergl.org/meshade/
  • • WebglSamples
  • https://code.google.com/p/webglsamples/
  • Two nice online applications to play around with blend settings are available at http://mrdoob.com/lab/javascript/webgl/blending/blendfunc.html and http://alteredqualia.com/three/examples/webgl_materials_blending_custom.html
  • The application at the first link is written by the creator of the Three.js framework and the second one
  • is written by the most active contributor to the library. In addition,
  • http://www.khronos.org/registry/gles/specs/2.0/es_full_spec_2.0.25.pdf#nameddest=section-4.1.6
  • explicitly states the result of each blending factor setting.

Fresnel Shader

  • A Fresnel shader calculates the reflective and refractive components of light using the GLSL functions reflect and
  • refract. It uses a texture cube map for the environment. Although covering the complete implementation details
  • of a Fresnel shader is beyond the scope of this book, good examples of Fresnel shaders in action are as follows:
  • • Bubbles: http://alteredqualia.com/three/examples/materials_shaders_fresnel.html
  • • Skull: http://www.everyday3d.com/j3d/demo/004_Glass.html
  • http://learningthreejs.com/

There are several places to download free or variably priced meshes such as the following:

  • http://sketchup.google.com/3dwarehouse/
  • http://www.blender-models.com/
  • http://artist-3d.com/
  • http://thefree3dmodels.com/
  • http://www.oyonale.com/modeles.php
  • http://www.3dvia.com/
  • http://www.3dcadbrowser.com/
  • http://www.3d02.com/
  • http://www.turbosquid.com/

Textures

  • There are a lot of places online to browse and download free high-quality textures, including these:
  • • http://texturez.com/
  • • http://www.textureking.com
  • • http://www.texturelovers.com
  • http://cgtextures.com/
  • • http://freestocktextures.com/
  • • http://psd.tutsplus.com/category/freebies/texture/

Demos

  • Cutting-edge Chrome WebGL experiments
  • http://www.chromeexperiments.com/webgl
  • Khronos demo repository
  • http://www.khronos.org/webgl/wiki/Demo_Repository
  • Nice water demo
  • http://madebyevan.com/webgl-water/
  • HTML

Three.JS

  • Project page
  • https://mrdoob.github.com/three.js/
  • Documentation
  • http://mrdoob.github.com/three.js/docs/latest/
  • Wiki
  • https://github.com/mrdoob/three.js/wiki
  • Learning Resources: Paul Lewis
  • http://aerotwist.com/tutorials/
  • Learning Resources: Jerome Etienne
  • http://learningthreejs.com/
  • Nice Diagrams of Overall Objects
  • http://ushiroad.com/3j/
  • http://www.12devsofxmas.co.uk/2012/01/webgl-and-three-js/

Lighting

  • Direct Illumination models
  • http://www.lighthouse3d.com/tutorials/glsl-tutorial/directional-lights-ii/
  • http://www.ozone3d.net/tutorials/glsl_lighting_phong_p3.php
  • Phong Reflection Model
  • http://en.wikipedia.org/wiki/Phong_reflection_model
  • Figure 3-13 is a variation of http://en.wikipedia.org/wiki/File:Phong_components_version_4.png
  • which is Licensed under the GNU Free Documentation License
  • Global Illumination Models
  • http://http.developer.nvidia.com/GPUGems2/gpugems2_chapter38.html
  • Ambient Occlusion
  • http://http.download.nvidia.com/developer/GPU_Gems_2/GPU_Gems2_ch14.pdf
  • http://en.wikipedia.org/wiki/Screen_Space_Ambient_Occlusion
  • http://www.gamerendering.com/category/lighting/ssao-lighting/
  • Reflection and Refraction
  • http://http.developer.nvidia.com/GPUGems3/gpugems3_ch17.html
  • http://http.developer.nvidia.com/GPUGems2/gpugems2_chapter19.html
  • Shadow Mapping
  • http://fabiensanglard.net/shadowmapping/index.php

Matrix and Vector Libraries

  • gl-matrix.js
  • https://github.com/toji/gl-matrix
  • sylvester
  • http://sylvester.jcoglan.com/
  • webgl-mjs
  • http://code.google.com/p/webgl-mjs/
  • Benchmarks
  • http://stepheneb.github.com/webgl-matrix-benchmarks/matrix_benchmark.html

Mesh File Formats

  • Wavefront (obj) format
  • http://en.wikipedia.org/wiki/Wavefront_OBJ
  • Collada format
  • http://en.wikipedia.org/wiki/COLLADA
  • Three.js internal JSON format
  • https://github.com/mrdoob/three.js/wiki/JSON-Model-format-3.0

Performance and Best Practices

  • Mozilla Developer Network Best Practices
  • https://developer.mozilla.org/en/WebGL/WebGL_best_practices
  • Gregg Tavares Google I/O 2011
  • http://www.youtube.com/watch?v=rfQ8rKGTVlg
  • http://games.greggman.com/game/webgl-techniques-and-performance/
  • http://static.googleusercontent.com/external_content/untrusted_dlcp/www.google.com/en//
  • events/io/2011/static/notesfiles/WebGLTechniquesandPerformancenotes.pdf
  • Profiling with about: tracing
  • http://www.html5rocks.com/en/tutorials/games/abouttracing/

Physics

  • Learning
  • http://www.physicsclassroom.com
  • WebGL Demos
  • http://www.ibiblio.org/e-notes/webgl/gpu/contents.htm
  • Javascript Libraries:
  • Box 2D Ports
  • http://code.google.com/p/box2dweb/
  • https://github.com/kripken/box2d.js
  • Bullet Port
  • https://github.com/kripken/ammo.js/
  • Cannon
  • https://github.com/schteppe/cannon.js
  • physi.js
  • http://chandlerprall.github.com/Physijs/
  • Tutorials
  • http://creativejs.com/2011/09/box2d-javascript-tutorial-series-by-seth-ladd/
  • http://learningthreejs.com/blog/2012/06/05/3d-physics-with-three-js-and-physijs/
  • http://www.html5gamedevs.com/2012/01/18/webgl-bullet-js-experiences-history-programmingslides/

25 (Free) 3D Modeling Applications You Should Not Miss By Kay Tan

3d modeling tools

Technically, 3 Dimensions refers to objects that are constructed on three plans (X, Y and Z). The process of creating 3D graphics can be divided into three basic phases: 3D modeling, 3D animation and 3D rendering.

Three dimensional (3D) computer graphics are widely used and they are almost too common to see anywhere, let it be movies, products designs, advertisements, etc. Although they are commonly seen, that doesn’t mean they are easily created. In order to interactively control a 3D object, it must be created in a 3D authoring tool which usually cost a lot to a non-professional user.

A 3D model is usually originated on the computer by engineer using some kind of 3d modeling tools. Creating 3D models is not easy and the software alone can cost a fortune Therefore, we thought it might be interesting to check out the availability of open source 3D modeling tools out there. Crawling from sites to sites, reading through end users comments and feedback, we bring you 25 Free 3D Modelling Applications You Should Not Miss. Full list after jump.

  1. Blender

    A free and open source 3D modeling and animation application which can be used for modeling, UV unwrapping, texturing, rigging, water simulations, skinning, animating, rendering, particle and other simulations, non-linear editing, compositing, and creating interactive 3D applications.

    Blender

  2. K-3D

    K-3D is free-as-in-freedom 3D modeling and animation software. It features a plugin-oriented procedural engine for all of its content, making K-3D a very versatile and powerful package.
    K-3D excels at polygonal modeling, and includes basic tools for NURBS, patches, curves and animation.

    k-3d

  3. Art Of Illusion

    Art of Illusion is a free, open source 3D modelling and rendering studio. Some of the highlights include subdivision surface based modelling tools, skeleton based animation, and a graphical language for designing procedural textures and materials.

    artofillusions

  4. SOFTIMAGE|XSI Mod Tool

    A free 3D modeling and animation software for aspiring game developers and modders. The Mod Tool is a free version of XSI for non commercial game creation. It is made for everyone needing a powerful 3D application to make and mod games. The Mod Tool plugs into all the major game engines and development frameworks for next-generation games, casual games, mods for existing titles and even Flash-based 3D games.

    SOFTIMAG

  5. Zmodeler

    ZModeler (or Zanoza Modeler) is a 3D modeling application developed by Oleg Melashenko. It is aimed at modelers who model for computer games. ZModeler is capable of complex modeling, even though it does not support important modeling functions such as extruding, or beveling.

    Zmodeler

  6. TopMod3d

    TopMod3d is a free, open source, portable, platform independent topological mesh modeling system that allows users to create high genus 2-manifold meshes. It can also create solid models that can be prototyped using various rapid prototyping technology.

    topmod3D

  7. Google SketchUp 6

    Google SketchUp

    Google SketchUp is software that you can use to create, share and present 3D models. Whether you want to design a new deck for your house, build models for Google Earth, or teach geometry to your fifth-graders, you can use SketchUp to see your ideas in 3D. And when you’re done, you can export an image, make a movie or print out a view of what you made.

  8. AutoQ3D Community – 3D Editor

    AutoQ3D Community is an easy, light and fast 3D model editor tool that uses the full power of your PC´s graphics hardware, allowing you to rapidly prototype your 3D designs. Its interface is intuitive and easy to use and provided at no charge. It is released under the terms of the GNU General Public License so it will be free to use, modify  and distribute within any educational, professional or commercial purposes.

    AutoQ3D

  9. Anim8or

    Anim8or is a 3D modeling and character animation program which allows users to create and modify 3D models with built-in primitives such as spheres, cylinders, platonic solids, etc.; mesh-edit and subdivision; splines, extrusion, lathing, modifiers, bevel and warps,

    Blender

  10. Seamless3d

    Seamless3d is free open source 3d modelling software which designed for the artist who is realistic about the time it takes to learn any tool that’s going to offer creative freedom.

    seamless3d

  11. BRL-CAD

    BRL-CAD is a powerful cross-platform constructive solid geometry solid modeling system that includes an interactive geometry editor, ray-tracing for rendering & geometric analyses, network distributed framebuffer support, image & signal-processing tools.

    BRL-CAD

  12. 3DPlus

    With 3DPlus you can create outstanding 3D designs in just a few minutes – with no need for any complicated VRML or other programming. 3DPlus is the amazing 3D design software that enables you to create stunning 3D graphics for your home, school or business – no experience required!

    3DPlus

  13. 3D Canvas

    3D Canvas is a real-time 3D modeling and animation tool that incorporates an intuitive drag-and-drop approach to 3D modeling. Complex models can be constructed from simple 3D primitives, or created using 3D Canvas’ Object Building Tools. Modeling tools are provided to deform, sculpt, and paint 3D objects.

    3dcanvas

  14. EDrawings

    eDrawings is a freeware utility which will give the user the power to view, create and share 3D models and 2D drawings. eDrawings offers unique capabilities like point-and-click animations that make it easy for anyone with a PC to interpret and understand 2D and 3D design data.

    edrawings

  15. Blink 3D

    Blink 3D is an authoring tool for creating 3D environments. The 3D environments are immersive, just like today’s modern games and can be viewed using the a Blink 3D Viewer on the Web or locally.

    blink3d builder

  16. Minos

    MINOS extends the capabilities of your existing 2D-or 3D-wireframe-based systems, so you can take advantage of all the benefits solid modeling offers right away. MINOS makes it easy to design 3D parts and assemblies. The design methodology is based on defining simple geometric elements including lines, curves, and circles, and then linking them together to form contours.

    minos

  17. FreeCAD

    freeCAD is a basic 3D CAD with advanced Motion Simulation capabilities. It is suitable for anyone interested in learning 3D CAD and Motion Simulation for free before using more sophisticated packages. Its motion simulation capabilities are comparable to the best and can provide accurate answers to engineers and scientists in diverse fields.

    freecad

  18. Bishop3D

    Bishop3D is an interactive modeler and animation tool for the popular freeware raytracer POV-Ray™, a world-class renderer for creating three-dimensional photo-realistic images. Bishop3D allows you to model the scenes interactively and it will automatically generate the correspondent POV-Ray SDL script. It offers native keyframe animation support, POV-Ray SDL import and a powerful texture editor.

    Bishop3D

  19. K3DSurf

    K3DSurf is a program to visualize and manipulate Mathematical models in three, four, five and six dimensions. K3DSurf supports Parametric equations and Isosurfaces. K3DSurf can be used by every one interested in 3D Mathematical drawing functions and don’t require any special competences by users.

  20. DesignWorkshop Lite

    DesignWorkshop is a three-dimensional modeling program for architectural design and related endeavors. Its unique interface makes it more profoundly « Mac-like » than any prior modeling software. This interface allows it to support actual design in three dimensions, as opposed to just recording design ideas already worked out with other media.

    DesignWorkshop Lite

  21. GDesign 2.0

    GDesign 2.0 is a 2D/3D free generative art application for Windows. With GDesign you can interactively build, test, and edit complex models. You can create, edit, build and preview huge 2D and 3D objects with extended LSystems and Cellular Automata tools.

    GDesign

  22. Sweet Home 3D

    Sweet Home 3D is a free interior design application that helps you place your furniture
    on a house 2D plan, with a 3D preview. Sweet Home 3D helps people to design their interior quickly. The user may: draw the walls of his rooms upon the image of an existing plan, change the color or the texture of the walls, import additional 3D models created by himself or downloaded from different Web sites, change the size, view the changes in the plan simultaneously in the 3D view, either from an aerial view point, or from a virtual visitor view point, print the home plan and the 3D view.

    Blender

  23. TrueSpace

    trueSpace7.6 is a fully-featured 3D authoring package that will let you model, texture, light, animate and render 3D content. As well as traditional images and movies, you can also make 3D content for online shared spaces, and for Virtual Earth.

    trueSpace

  24. Alibre Design Xpress

    Alibre Design Xpress is a rich and capable 3D solid modeler for creating mechanical parts, assemblies and 2D drawings – and is free. Alibre Design Xpress equips the person needing basic 3D design capabilities. Alibre Design Xpress has a rich set of integrated tutorials that you can use to learn the product quickly.

    Alibre Design Xpress

  25. 3DVIA Shape

    3DVia Shape is a free online 3D modeling application that eases you to create, publish and share ideas in 3D. There are 3DVIA archive of prototypes and modeling software you can choose to create three-dimensional. Each model can be viewed at any angle, spun around and zoomed-in on.

    3DVia Shape

On delete cascade with doctrine2

1. class QuantifiedSelfItem


...

/**
* @var User\Bundle\Entity\Person
* @ORM\ManyToOne(targetEntity="\User\Bundle\Entity\Person")
* @ORM\JoinColumn(name="idPerson", referencedColumnName="id",nullable=true, onDelete="CASCADE")
* */
private $idPerson;

...

2. class Person

Extension twig pour encoder les images en base 64

1. src/QuantifiedSelf/Bundle/Twig/Extension/AssetExtension.php


namespace QuantifiedSelf\Bundle\Twig\Extension;

use Symfony\Component\HttpFoundation\File\File;
use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Bundle\TwigBundle\Loader\FilesystemLoader;

class AssetExtension extends \Twig_Extension {
public function getFunctions()
{
return array('image64' => new \Twig_Function_Method($this, 'image64'),
);
}

public function image64($path)
{
$file = new File($path, false);

if (!$file->isFile() || 0 !== strpos($file->getMimeType(), 'image/')) {return;}

$binary = file_get_contents($path);

return sprintf('data:image/%s;base64,%s', $file->guessExtension(), base64_encode($binary));
}

public function getName()
{
return 'twigImageBase64';
}
}

2. app/config/config.xml


...

parameters:
quantifiedself.twig.extension.class: QuantifiedSelf\Bundle\Twig\Extension\AssetExtension

services:
twig.extension.twigImageBase64:
class: %quantifiedself.twig.extension.class%
tags:
- { name: twig.extension }

...

3. index.html.twig


...

<img width="100%" height="100%" src="{{ image64('bundles/quantifiedself/images/'~qs.logo) }}">

...

Exporter en PDF avec Symfony2 – devandclick.fr

Pour commencer télécharger le bundle : http://devandclick.fr/telechargement/bundles/html2pdf.zip

Première etape :

Décompresser le  Bundle puis déplacer le dans le dossier /vendor

Modifier le fichier app/autoload.php

<?php
use Doctrine\Common\Annotations\AnnotationRegistry;
use Composer\Autoload\ClassLoader;
/**
 * @var ClassLoader $loader
 */
$loader = require __DIR__.'/../vendor/autoload.php';
AnnotationRegistry::registerLoader(array($loader, 'loadClass'));
//permettra à l’autoload d’importer la librarie HTML2PDF
$loader->add('Html2Pdf_', __DIR__.'/../vendor/html2pdf/lib'); //ligne à ajouter
$loader->register();
return $loader;
Comment utiliser html2pdf dans le controller ?
<?php
namespace testPdf\testPdfBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
class DefaultController extends Controller
{
    public function indexAction($name)
    {
        //on stocke la vue à convertir en PDF, en n'oubliant pas les paramètres twig si la vue comporte des données dynamiques
        $html = $this->renderView('testPdfBundle:Default:index.html.twig', array('name' => $name));
        
        //on instancie la classe Html2Pdf_Html2Pdf en lui passant en paramètre
        //le sens de la page "portrait" => p ou "paysage" => l
        //le format A4,A5...
        //la langue du document fr,en,it...
        $html2pdf = new \Html2Pdf_Html2Pdf('P','A4','fr');
        //SetDisplayMode définit la manière dont le document PDF va être affiché par l’utilisateur
        //fullpage : affiche la page entière sur l'écran
        //fullwidth : utilise la largeur maximum de la fenêtre
        //real : utilise la taille réelle
        $html2pdf->pdf->SetDisplayMode('real');
        //writeHTML va tout simplement prendre la vue stocker dans la variable $html pour la convertir en format PDF
        $html2pdf->writeHTML($html);
        //Output envoit le document PDF au navigateur internet avec un nom spécifique qui aura un rapport avec le contenu à convertir (exemple : Facture, Règlement…)
        $html2pdf->Output('Facture.pdf');
        
    
        return new Response();
    }
}