Comunidad de diseño web y desarrollo en internet online

canvas a PDF ---- PROBLEMAS

Citar            
MensajeEscrito el 30 Oct 2010 07:33 am
Hola a todos, espero que todos estén súper bien :lol:

Les cuento, estoy asiendo pasar un CANVAS a PDF, el problema que me sale cortado. :cry:

Les explico mejor a través de imágenes para que se entienda mejor.. ^^


Canvas que quiero pasar a PDF <<<>>>>
[img]http://l4c.me/fotos/shinodax/sistema-1[/img]


Resultado <<<<>>>>
[img]http://l4c.me/fotos/shinodax/sistema2[/img]

AHORA LE ENVIO EL CODIGO COMPLETO

Código Flex :

<?xml version="1.0" encoding="utf-8"?>
<mx:TitleWindow xmlns:mh="mh.components.*" xmlns:mx="http://www.adobe.com/2006/mxml" removedEffect="{Out}" close="PopUpManager.removePopUp(this)"  width="100%" height="532" showCloseButton="true" creationCompleteEffect="{Efec}" color="#000000" fontSize="11" title="ARBOL GENEALOGICO" layout="absolute">
                <mx:Style source="estiloentrada.css"/>      
   <mx:Script>
      <![CDATA[
         import mx.controls.Menu;
         import mx.events.MenuEvent;
         import mx.events.ValidationResultEvent;
         import mx.validators.Validator;
         import mx.controls.Alert;
         import mx.rpc.events.ResultEvent;
          import mx.managers.PopUpManager;

         import org.alivepdf.pdf.PDF;
         import org.alivepdf.layout.Orientation;
         import org.alivepdf.layout.Size;
         import org.alivepdf.layout.Unit;
         import org.alivepdf.display.Display;
         import org.alivepdf.saving.Method;
         import org.alivepdf.fonts.FontFamily;
         import org.alivepdf.fonts.Style;
         import org.alivepdf.colors.RGBColor;
                 import org.alivepdf.layout.*;   
         
         private var myPDF:PDF;
         
         var menu:Menu;
      
      
         
   /*      public function guardar(): void{
            RO.guardarFamilia(p1.text, p2.text, p3.text, m1.text, m2.text, m3.text, alo1.text, alo2.text, alo3.text, ala1.text, ala2.text, ala3.text, ee1.text, ee2.text, ee3.text, ee4.text, ee5.text, ee6.text, rutsoli.text );
            
         } */
         
         
         
         public function resultado(event:ResultEvent):void{
               var s:String=String(event.result);
               if(s=="ok"){
                  Alert.show("Los datos han sido modificados correctamente");
                  this.visible=false;
               }
               
         } 
         
         function generatePDF ( e:MouseEvent )
         {
            // we create the PDF
            myPDF = new PDF(  Orientation.LANDSCAPE, Unit.MM, Size.LETTER );
            // we set the zoom to 100%
            myPDF.setDisplayMode ( Display.FULL_WIDTH, Layout.SINGLE_PAGE ); 
            
      
            myPDF.addPage();
            myPDF.addImage(pdfArbol);
            
         
            
            /***** MODIFICACIONES DON KENSHIN ***********/
            // se crea una variable ByteArray para almacenar el archivo PDF que devuelve el metodo
            // save() de la libreria AlivePDF, en forma de arreglo de bytes.
            var bytes : ByteArray = myPDF.save(Method.LOCAL);
            // se crea una variable FileReference para poder acceder a disco mediante un cuadro de 
            // dialogo del sistema operativo.
            var fileRefer : FileReference = new FileReference();
            // se abre el dialogo de "guardar como" del sistema operativo.
            fileRefer.save(bytes,"garabatoRIA212.pdf");
            /********************************************/
            
            /////fileRefer.browse();
         }

      ]]>
   </mx:Script>
   
<mx:Iris id="Efec" duration="500" showTarget="true"/>
<mx:Iris id="Out" duration="500" showTarget="false"/>

<mx:Canvas id="pdfArbol" width="1082" height="470" x="4" y="4">
      <mx:backgroundImage>@Embed(source='../imagenes/arbolGene.PNG')</mx:backgroundImage>
      <mx:Text id="m1" x="560" y="212" fontWeight="bold" width="502" color="#0018FF" fontSize="10"/>
      <mx:Text  id="ee1" x="280" y="347" fontWeight="bold" width="242" color="#0018FF" fontSize="10"/>
      <mx:Text id="ee4" x="21" y="347" fontWeight="bold" width="242" color="#0018FF" fontSize="10"/>
      <mx:Text id="ala1" x="820" y="348" fontWeight="bold" width="242" color="#0018FF" fontSize="10"/>
      <mx:Text id="alo1" x="560" y="348" width="242" fontWeight="bold" color="#0018FF" fontSize="10"/>
      <mx:Text visible="true" id="rutsoli" width="152" fontWeight="bold" fontSize="15" height="28" textAlign="center" x="454" y="4"/>
      <mx:Text id="p1" fontWeight="bold" x="21" y="212" width="501" color="#0018FF" fontSize="10"/>
      <mx:Text id="as1" x="166" y="240" fontWeight="bold" width="242" color="#0018FF" fontSize="11"/>
      <mx:Text id="as2" x="57" y="268" fontWeight="bold" width="242" color="#0018FF" fontSize="11"/>
      <mx:Text id="pais" x="269" y="139" fontWeight="bold" width="242" color="#0018FF" fontSize="11"/>
      <mx:Text id="as3" x="710" y="240" fontWeight="bold" width="242" color="#0018FF" fontSize="11"/>
      <mx:Text id="as4" x="593" y="268" fontWeight="bold" width="242" color="#0018FF" fontSize="11"/>
      <mx:Text id="as5" x="57" y="401" fontWeight="bold" width="97" color="#0018FF" fontSize="11"/>
      <mx:Text id="as6" x="166" y="375" fontWeight="bold" width="97" color="#0018FF" fontSize="11"/>
      <mx:Text id="as7" x="435" y="375" fontWeight="bold" width="97" color="#0018FF" fontSize="11"/>
      <mx:Text id="as8" x="322" y="401" fontWeight="bold" width="97" color="#0018FF" fontSize="11"/>
      <mx:Text id="as9" x="705" y="375" fontWeight="bold" width="97" color="#0018FF" fontSize="11"/>
      <mx:Text id="as10" x="593" y="401" fontWeight="bold" width="97" color="#0018FF" fontSize="11"/>
      <mx:Text id="as11" x="969" y="375" fontWeight="bold" width="97" color="#0018FF" fontSize="11"/>
      <mx:Text id="as12" x="855" y="401" fontWeight="bold" width="97" color="#0018FF" fontSize="11"/>
      <mx:Text id="solicitanteDatos" fontWeight="bold" x="235" y="87" width="501" color="#0018FF" fontSize="10"/>
      <mx:Text id="ciudad" x="385" y="111" fontWeight="bold" width="242" color="#0018FF" fontSize="11"/>
      <mx:Button click="generatePDF(event)" label="Generate PDF" id="generate_btn" x="10" y="7"/>
</mx:Canvas>


    
   <mx:RemoteObject id="RO" destination="dest" result="resultado(event)">
   
   </mx:RemoteObject>
   <mx:String id="rut" />
   
   
   
</mx:TitleWindow>


espero sus respuesta de Ayuda

muchas gracias a todos :wink:

Por shinodax

41 de clabLevel



 

firefox
Citar            
MensajeEscrito el 30 Oct 2010 08:04 am
Perdón quise decir espero sus respuesta a mi ayuda :D

Por shinodax

41 de clabLevel



 

firefox
Citar            
MensajeEscrito el 31 Oct 2010 09:02 am
Porfa alguien que me ayude ??

gracias

Por shinodax

41 de clabLevel



 

firefox
Citar            
MensajeEscrito el 02 Nov 2010 05:32 am
Me respondo solo xD, lo único tenía que agregar es unos parámetros

de myPDF.addImage(pdfArbol);
a esto myPDF.addImage(pdfArbol, x, y, ancho, largo);

solo eso no mas :D , espero que le ayude a otra persona que lo necesite, de todas maneras gracias a las personas que le dieron una lectura a mi problema. ^^

Por shinodax

41 de clabLevel



 

firefox

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.