我有 HTMLLoader 可以正确加载 pdf 文件,但我的问题是 HTMLloader 没有出现 pdf 的完整宽度(尽管我更改了 HTMLLoader 宽度,但 pdf 的 Vscroll 没有出现)。
private var pdf:HTMLLoader = new HTMLLoader();
private function init():void {
if(HTMLLoader.pdfCapability == HTMLPDFCapability.STATUS_OK)
{
var request:URLRequest = new URLRequest("file:///D:/New%20folder/%D8%A7%D9%84%D9%83%D8%AA%D8%A7%D8%A8%20%D8%A7%D9%84%D8%AA%D9%81%D8%A7%D8%B9%D9%84%D9%8A/home.pdf");
pdf.width = appCanvas.width-40;
pdf.height = appCanvas.height-60;
pdf.load(request);
pdf.addEventListener(LocationChangeEvent.LOCATION_CHANGE, function(evt:LocationChangeEvent):void
{
if(evt.location.toLocaleLowerCase().substring(evt.location.length-4) == "html" )
{
var str:String = escapeMultiByte(evt.location.slice(8));
str=unescape(evt.location);
var nativeProcessStartupInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo();
var mp:File = new File("C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe");
nativeProcessStartupInfo.executable = mp;
var args:Vector.<String> = new Vector.<String>();
args.push(evt.location);
nativeProcessStartupInfo.arguments = args;
var process:NativeProcess = new NativeProcess();
process.start(nativeProcessStartupInfo);
pdf.historyBack();
}
});
myWin.addChild(pdf); // Add the HTMLLoader to my HTML component
} else {
Alert.show("PDF cannot be displayed. Error code:" + HTMLLoader.pdfCapability);
}
}