chengse66 / alivepdf

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

PDF damaged and will not display #288

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. run script
2. click print button
3. bad things happen - Please help

What is the expected output? What do you see instead?
The report should appear in the browser
Instead I get an error "The file is damaged and could not be repaired"

What version of the product are you using? On what operating system?
Windows XP 2002 SP3
AlivePDF.swf dates 2/3/2010 size 129KB but I have tried other versions

Please provide any additional information below.

public function print_clickHandler(event:Event):void{

    var pdf:PDF = new PDF(Orientation.PORTRAIT, Unit.MM, Size.LETTER);
    var y_position:Number = 20;
    var x_position:Number = 20;
    var referenceX:Number = 20;
        var lastY_position:Number;

    // can only display the first 10 because of size bug
    for(var count:int = 0; count < 20; count++) {
        // 6 on a page
        pdf.setFontSize ( 10 );
        if (count==0 || count%6==0) {
        pdf.addPage();  
        y_position = 20;
        x_position = 20;
        pdf.addText("20 Locations Found", x_position, y_position);
        y_position = y_position + 12;

        }
        x_position = referenceX;

        pdf.addText("Physical Address", x_position, y_position);
        pdf.addText("Programs Served", x_position + 90, y_position);
        pdf.setFontSize ( 8 );

        y_position = y_position+4

        pdf.addText("1500 1st Street, Suite 500, Austin, TX  78717", x_position, y_position);
        y_position = y_position+4;

        pdf.addText("Phone " + "512-123-1234", x_position,y_position);
        y_position = y_position+4;
        pdf.addText("Fax " + "512-234-2345", x_position,y_position);
        y_position = y_position+4;
        pdf.addText("TDD " + "512-345-3456", x_position,y_position);
        y_position = y_position+4;
        pdf.addText("County " + "Travis", x_position,y_position);
        y_position = y_position+4;
        pdf.addText("Same as Physical Address", x_position,y_position);
        y_position = y_position+4;

        lastY_position = y_position;

        y_position = y_position - 24;
        x_position = x_position + 90;

        for(var count_programs:int = 0; count_programs < 4; count_programs++) {
        pdf.addText("Medicaid", x_position,y_position);

        y_position = y_position+4;
        }

        if (y_position < lastY_position) {
        y_position = lastY_position;
        }

        y_position = y_position + 4;

    }
//  if (count>10) {
//      var file:FileReference = new FileReference();
//      file.save(pdf.save(Method.LOCAL), "locations.pdf");
//  } else {
        pdf.save(Method.REMOTE, SERVLET_MAPPING_URL, Download.INLINE, "locations.pdf");

//  }
}

Original issue reported on code.google.com by akc...@gmail.com on 24 Nov 2010 at 3:19

Attachments: