gdtiti / alivepdf

Automatically exported from code.google.com/p/alivepdf
0 stars 0 forks source link

setFont function stop pdf creation #244

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I'm using a simple function to generate a PDF with alivepdf in a web-app, 
but when I use setFont function in the code, the function doesn't generate 
any pdf.

For example:
import org.alivepdf.saving.*;  
import org.alivepdf.layout.*;       
import org.alivepdf.pdf.*;
import org.alivepdf.fonts.*;  
import org.alivepdf.images.*;
private var ArchivoPDF:PDF;
...

public function pdfCreation():void{
    var filePDF=new PDF(Orientation.LANDSCAPE,Unit.POINT,Size.LETTER);
    filePDF.addPage();
    filePDF.setFont(FontFamily.ARIAL ,Style.BOLD,18);
    filePDF.addText("Any Text Here",330,30);
    ArchivoPDF.save(Method.REMOTE,"./controler/create.php", 
Download.INLINE,"mypdf.pdf");
}

This code doesn't work, but when I comment the line 
"filePDF.setFont(FontFamily.ARIAL ,Style.BOLD,18);" with an //, the code 
works fine.

What could be happening?
Thank for help

Original issue reported on code.google.com by crandrad...@gmail.com on 12 May 2010 at 11:30

GoogleCodeExporter commented 8 years ago
Hi,

it's the first time I use this lib but I encountered the same problem.
I think the core code has changed and therefore it does not work this way 
anymore.
I am using AlivePDF 0.1.5 RC.zip.
Anyway, this works for me:

////
var myCoreFont:IFont = new  CoreFont ( FontFamily.HELVETICA_BOLD  );
myPDF.setFont( myCoreFont, 20 );
///

The new EmbeddedFont feature also works very well, but requires some more work 
than
using the supplied fonts. Happy to post my solution in case you need it!

Hope that helps,
K

Original comment by karsten....@gmail.com on 25 May 2010 at 4:17

GoogleCodeExporter commented 8 years ago
Hi guys,

I'm trying to make the EmbeddedFont to work, but no result so far. Would you 
please post some examples - including the ttf and afm files you are using?

Another thing - have you tried using UnicodePDF + EmbeddedFont?

Thanks!

Original comment by dianavla...@gmail.com on 10 Jun 2010 at 9:06