如何在Flex中使用Alivepdf将大图像添加到PDF(多页)?

时间:2017-03-20 17:05:11

标签: actionscript-3 flex

我想将一个大图像添加到PDF(多页)中。为此,我使用图像快照的图像。我想将完整的字节数组拆分成块并使用addimage我想在多个页面中将其添加到PDF中。

ImageSnapshot imageSnapshot = ImageSnapshot.captureImage(imgCanvas,0, new JPEGEncoder(),true);
var byteArr:ByteArray=new ByteArray();
byteArr.writeBytes(imageSnapshot.data,0,imageSnapshot.data.length); 
var myPDFEncoder:PDF = new PDF ( Orientation.PORTRAIT, Unit.MM,Size.A4);
myPDFEncoder.setDisplayMode(Display.FULL_PAGE);
myPDFEncoder.addPage();
myPDFEncoder.addImageStream(byteArr, 0, 0,targetImage.width,targetImage.height, 1, ResizeMode.FIT_TO_PAGE);
var bytes:ByteArray = myPDFEncoder.save(Method.LOCAL);
var fx:FileReference = new FileReference();
fx.save(bytes,"sample.pdf");

0 个答案:

没有答案
相关问题