2017-10-28 15 views
0

첫 페이지의 썸네일을 생성하고 싶습니다. 다음 페이지에서 생성하려고 시도했는데 좋은 해상도로 이미지를 인쇄 할 수 없으며 확대/축소시 이미지가 잘 보입니다. 처음 몇 개의 열에 대해 엄지 손톱을 인쇄 할 수있는 옵션이 있어도 괜찮을 것입니다. 제발 제안 해주세요.Aspose : 첫 페이지의 썸네일 생성

Workbook book = new Workbook(new ByteArrayInputStream(documentData)); 
    // Define ImageOrPrintOptions 
    ImageOrPrintOptions imgOptions = new ImageOrPrintOptions(); 
    // Set the vertical and horizontal resolution 
    imgOptions.setVerticalResolution(200); 
    imgOptions.setHorizontalResolution(200); 
    // Set the image's format 
    imgOptions.setImageFormat(ImageFormat.getJpeg()); 
    // One page per sheet is enabled 
    imgOptions.setOnePagePerSheet(true); 
    // Get the first worksheet 
    Worksheet sheet = book.getWorksheets().get(0); 
    // Render the sheet with respect to specified image/print options 
    SheetRender sr = new SheetRender(sheet, imgOptions); 
    // Render the image for the sheet 
    sr.toImage(0, "mythumb.jpg"); 
    // Creating Thumbnail 
    java.awt.Image img = ImageIO.read(new File("mythumb.jpg")).getScaledInstance(100, 100, BufferedImage.SCALE_SMOOTH); 
    BufferedImage img1 = new BufferedImage(100, 100, BufferedImage.TYPE_INT_RGB); 
    img1.createGraphics().drawImage(
    ImageIO.read(new File("mythumb.jpg")).getScaledInstance(100, 100, img.SCALE_SMOOTH), 0, 0, null); 
    return img1; 

답변

1

일부 벡터 이미지 파일 형식을 사용하는 경우 품질이 양호해야합니다. 예를 들어, Emf를 워크 시트의 출력 이미지 형식 유형으로 사용하려고 할 수 있습니다. 이미지에서 렌더링 할 특정 범위를 워크 시트에 렌더링하려면 워크 시트를 렌더링하기 전에 원하는 인쇄 가능 영역을 설정해야합니다. 코드 세그먼트 시작 부분에 추가 할 수있는 샘플 코드 행을 참조하십시오 : 예를 들어 샘플 코드 : 내가 Aspose에서 지원 개발자/전도자로 활동하고

........ 
// Access the first worksheet 
Worksheet worksheet = book.getWorksheets().get(0); 

// Set the print area with your desired range 
worksheet.getPageSetup().setPrintArea("E8:H15"); 

// Set all margins as 0 to get remove unnecessary white space 
worksheet.getPageSetup().setLeftMargin(0); 
worksheet.getPageSetup().setRightMargin(0); 
worksheet.getPageSetup().setTopMargin(0); 
worksheet.getPageSetup().setBottomMargin(0); 

.......... 

.