FLEX 구성 요소의 PDF 버전을 만들려고 할 때 PDF가 비어있는 이유는 무엇입니까?

StackOverflow https://stackoverflow.com/questions/6060629

  •  15-11-2019
  •  | 
  •  

문제

i 내부 콘텐츠가있는 vbox, vbox가 있습니다.텍스트 구성 요소 주로.

VBox는 PDF에 저장할 수있는 보고서를 누른 상태입니다."nofollow"> AlivePDF

notepad ++에서 PDF를 열면 확실히 콘텐츠가 있음을 알 수 있으며 파일이 올바르게 구성된 것으로 보입니다.

이것은 PDF를 생성하기 위해 사용하는 방법입니다.

private function doPrint(whatToPrint:UIComponent):void
{
    var printPDF:PDF = new PDF( Orientation.LANDSCAPE, Unit.MM, Size.A4 );
    printPDF.setDisplayMode( Display.FULL_PAGE, Layout.SINGLE_PAGE );
    printPDF.addPage();
    printPDF.addImage( whatToPrint, 0, 0, 0, 0, 'PNG', 100, 1, ResizeMode.FIT_TO_PAGE );

    // The string here looks to have produced a valid PDF but it doesn't render correctly
    var content:String = printPDF.save(Method.LOCAL);

    // Custom save file data in here, removed for clarity of issue
}
.

도움이 되었습니까?

해결책

Try this:

private function doPrint(whatToPrint:UIComponent):void
{
    var printPDF:PDF = new PDF( Orientation.LANDSCAPE, Unit.MM, Size.A4 );
    printPDF.setDisplayMode( Display.FULL_PAGE, Layout.SINGLE_PAGE );
    whatToPrint.validateNow();
    printPDF.addPage();
    printPDF.addImage( whatToPrint, 0, 0, 0, 0, 'PNG', 100, 1, ResizeMode.FIT_TO_PAGE );

    // The string here looks to have produced a valid PDF but it doesn't render correctly
    var content:String = printPDF.save(Method.LOCAL);

    // Custom save file data in here, removed for clarity of issue
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top