Good afternoon everyone, I have managed to make some progress. 

The problem seems to be in the generation of pdf. 

Because when you take any pdf downloaded from the internet, and you send it
by mail, all goes well. 


I made a test using purePDF. 
When you generate the pdf, shown more stable than alivePDF. 
I make sending and pdf opens correctly. 

Only when within the lines of the pdf add a variable, the pdf opens, but the
pdf mailed, not open. Returning to the issue where adobe reader tells me
that the file is encoded wrong. 

I leave the code


private funcion generatePdf():void
{
import org.purepdf.elements.Paragraph;  
import org.purepdf.pdf.PageSize;  
import org.purepdf.pdf.PdfDocument;  
import org.purepdf.pdf.PdfWriter;  
import org.purepdf.pdf.fonts.BaseFont;  
import org.purepdf.pdf.fonts.FontsResourceFactory;  
import org.purepdf.resources.BuiltinFonts; 
                                
FontsResourceFactory.getInstance().registerFont(BaseFont.HELVETICA, new
BuiltinFonts.HELVETICA());  
var bytes:ByteArray = new ByteArray();  
var writer:PdfWriter = PdfWriter.create(bytes, PageSize.A4);  
var document:PdfDocument = writer.pdfDocument;  
document.open();
var problematicLine:String = "Hello this line, dont work " + nameIn.text;
document.add(new Paragraph("HELLO THIS WORK OK")); 
document.add(new Paragraph(textoAsistencia)); 
document.close();  
                                
                                
/* Save */

var fileStream:FileStream = new FileStream();
var file:File = File.createTempDirectory();
file = File.applicationStorageDirectory.resolvePath(namePdf.Pdf);
fileStream.open(file, FileMode.WRITE);
                        
fileStream.writeBytes(bytes);
fileStream.close();
sendPdf();

}   /* end function generatePdf  */



private function sendPdf():void
                        {
                                var encoder:Base64Encoder;
                                var bytes:ByteArray = new ByteArray();    
                                
                                var stream:FileStream = new FileStream();
                                
                                file = 
File.applicationStorageDirectory.resolvePath(namePdf.Pdf);
                                
                                stream.open(file, FileMode.READ);    
                                
stream.readBytes(bytes,0,stream.bytesAvailable);    
                                stream.close();
                                
                                encoder = new Base64Encoder();
                                encoder.encodeBytes(bytes, 0, bytes.length);
                                
                                var myMailer:SMTPMailer = new SMTPMailer 
("smtp.yoursmtp.com", 25);
                                myMailer.authenticate(userSmtp, passSmtp);
                                
                                
                                
                                myMailer.sendAttachedMail("[email protected]", 
"[email protected]", "upssss", "*HELLO
ATT pdf*", bytes, namePdf.Pdf);
                                
                                
                        }


Any ideas? with purePDF I managed to open the pdf mailed. 
But if I put some variable text (nameIn.text) does not work. The pdf opens
in the tablet, but being mailed, adobe reader does not open




--
View this message in context: 
http://apache-flex-users.2333346.n4.nabble.com/Flex-mobile-save-pdf-and-send-by-mail-Android-IOS-alivePdf-SMTPMailer-tp6391p6396.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Reply via email to