2015-04-15 14 views
0

。如何在运行时打印到pdf并打印舞台上存在的所有内容?当我尝试在运行时打印FLASH SWF(ActionScript 2.0)时,在运行时打印区域始终在右下角切断,因此在运行时将pdf作为运行时打印为

我使用了PrintJob过程,但它似乎不起作用。我已经设置了打印区域1900 x 1400,但它仍然被修剪。

printbutton.onRelease = function() 
    { 
    var pj = new PrintJob(); 
    var success = pj.start(); 
    if (success) 
     {//Centered Variables 
     pj.addPage(0,{xMin:0, xMax:1900, yMin:0, yMax:1400}); 
     pj.send(); 
     } 
     delete pj; 
    }; 

回答

0

检查页面方向。你可以使用下面的例子:

printbutton.onRelease = function(){ 
// create PrintJob object 
var pj:PrintJob = new PrintJob(); 

// display print dialog box 
if (pj.start()) { 
    // boolean to track whether addPage succeeded, change this to a counter 
    // if more than one call to addPage is possible 
    var pageAdded:Boolean = false; 

    // check the user's printer orientation setting 
    // and add appropriate print area to print job 
    if (pj.orientation == "portrait") { 
    pageAdded = pj.addPage(0,{xMin:0, xMax:1400, yMin:0, yMax:1900}); 
    } 
    else { 
    // pj.orientation is "landscape" 
    pageAdded = pj.addPage(0,{xMin:0, xMax:1900, yMin:0, yMax:1400}); 
    } 

    // send pages from the spooler to the printer 
    if (pageAdded) { 
    pj.send(); 
    } 
} 
// clean up 
delete pj; 
};