com.lowagie.text.Rectangle.rotate()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(8.5k)|赞(0)|评价(0)|浏览(123)

本文整理了Java中com.lowagie.text.Rectangle.rotate方法的一些代码示例,展示了Rectangle.rotate的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Rectangle.rotate方法的具体详情如下:
包路径:com.lowagie.text.Rectangle
类名称:Rectangle
方法名:rotate

Rectangle.rotate介绍

[英]Rotates the rectangle. Swaps the values of llx and lly and of urx and ury.
[中]旋转矩形。交换llx和lly以及urx和ury的价值。

代码示例

代码示例来源:origin: javamelody/javamelody

private Rectangle getPageSize(boolean landscape) {
  Rectangle pageSize;
  if (Locale.US.getCountry().equals(I18N.getCurrentLocale().getCountry())) {
    // Letter size paper is used in the US instead of the ISO standard A4
    pageSize = PageSize.LETTER;
  } else {
    pageSize = PageSize.A4;
  }
  if (landscape) {
    pageSize = pageSize.rotate();
  }
  return pageSize;
}

代码示例来源:origin: org.seasar.tuigwaa/tuigwaa-cms

public static Rectangle getRectangle(String style){
  
  Rectangle rec = PageSize.A4; // default page size
  if(style.endsWith("B5")){
    rec = PageSize.B5;
  }            
  return (style.startsWith("h-"))? rec.rotate() : rec;		
}

代码示例来源:origin: net.bull.javamelody/javamelody-core

private Rectangle getPageSize(boolean landscape) {
  Rectangle pageSize;
  if (Locale.US.getCountry().equals(I18N.getCurrentLocale().getCountry())) {
    // Letter size paper is used in the US instead of the ISO standard A4
    pageSize = PageSize.LETTER;
  } else {
    pageSize = PageSize.A4;
  }
  if (landscape) {
    pageSize = pageSize.rotate();
  }
  return pageSize;
}

代码示例来源:origin: qcadoo/mes

private void generateMaterialRequirementCoverageReport(final Entity materialRequirementCoverage, final Locale locale)
    throws IOException, DocumentException {
  String localePrefix = "orderSupplies.materialRequirementCoverage.report.fileName";
  Entity materialRequirementCoverageWithFileName = fileService.updateReportFileName(materialRequirementCoverage,
      MaterialRequirementCoverageFields.GENERATED_DATE, localePrefix);
  try {
    materialRequirementCoverageReportPdfService.generateDocument(materialRequirementCoverageWithFileName, locale,
        PageSize.A4.rotate());
  } catch (IOException e) {
    throw new IllegalStateException("Problem with saving materialRequirementCoverage report");
  } catch (DocumentException e) {
    throw new IllegalStateException("Problem with generating materialRequirementCoverage report");
  }
}

代码示例来源:origin: qcadoo/mes

private void generateMaterialRequirementCoverageReport(final Entity materialRequirementCoverage, final Locale locale)
    throws IOException, DocumentException {
  String localePrefix = "materialRequirementCoverageForOrder.coverageForOrder.report.fileName";
  Entity materialRequirementCoverageWithFileName = fileService.updateReportFileName(materialRequirementCoverage,
      CoverageForOrderFields.GENERATED_DATE, localePrefix);
  try {
    materialRequirementCoverageForOrderReportPdfService.generateDocument(materialRequirementCoverageWithFileName, locale,
        PageSize.A4.rotate());
  } catch (IOException e) {
    throw new IllegalStateException("Problem with saving materialRequirementCoverageForOrder report");
  } catch (DocumentException e) {
    throw new IllegalStateException("Problem with generating materialRequirementCoverageForOrder report");
  }
}

代码示例来源:origin: fr.opensagres.xdocreport/fr.opensagres.xdocreport.itext.extension-gae

public void setOrientation( PageOrientation orientation )
  {
    if ( !this.orientation.equals( orientation ) )
    {
      super.getPageSize().rotate();
    }
    this.orientation = orientation;
  }
}

代码示例来源:origin: qcadoo/mes

@Override
protected Document newDocument() {
  Document doc = super.newDocument();
  doc.setPageSize(PageSize.A4.rotate());
  return doc;
}

代码示例来源:origin: fr.opensagres.xdocreport/fr.opensagres.xdocreport.itext.extension

public void setOrientation( PageOrientation orientation )
  {
    if ( !this.orientation.equals( orientation ) )
    {
      super.getPageSize().rotate();
    }
    this.orientation = orientation;
  }
}

代码示例来源:origin: qcadoo/mes

@Override
protected Document newDocument() {
  Document doc = super.newDocument();
  doc.setPageSize(PageSize.A4.rotate());
  return doc;
}

代码示例来源:origin: com.github.librepdf/openpdf

/**
 * Gets the rotated page from a page dictionary.
 * 
 * @param page
 *          the page dictionary
 * @return the rotated page
 */
public Rectangle getPageSizeWithRotation(PdfDictionary page) {
 Rectangle rect = getPageSize(page);
 int rotation = getPageRotation(page);
 while (rotation > 0) {
  rect = rect.rotate();
  rotation -= 90;
 }
 return rect;
}

代码示例来源:origin: fr.opensagres.xdocreport.itext-gae/itext-gae

/**
 * Gets the rotated page from a page dictionary.
 * @param page the page dictionary
 * @return the rotated page
 */
public Rectangle getPageSizeWithRotation(PdfDictionary page) {
  Rectangle rect = getPageSize(page);
  int rotation = getPageRotation(page);
  while (rotation > 0) {
    rect = rect.rotate();
    rotation -= 90;
  }
  return rect;
}

代码示例来源:origin: es.gob.afirma/afirma-crypto-pdf-itext

/**
 * Gets the rotated page from a page dictionary.
 * @param page the page dictionary
 * @return the rotated page
 */
public Rectangle getPageSizeWithRotation(PdfDictionary page) {
  Rectangle rect = getPageSize(page);
  int rotation = getPageRotation(page);
  while (rotation > 0) {
    rect = rect.rotate();
    rotation -= 90;
  }
  return rect;
}

代码示例来源:origin: org.kuali.kfs/kfs-core

protected Document openPdfWriter(String destinationDirectory, String fileprefix, Date runDate, String title) {
  try {
    Document document = new Document(PageSize.A4.rotate());
    PageHelper helper = new PageHelper();
    helper.runDate = runDate;
    helper.headerFont = headerFont;
    helper.title = title;
    String filename = destinationDirectory + "/" + fileprefix + "_";
    SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd_HHmmss");
    filename = filename + sdf.format(runDate);
    filename = filename + ".pdf";
    PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(filename));
    writer.setPageEvent(helper);
    document.open();
    return document;
  }
  catch (Exception e) {
    LOG.error("openPdfWriter() Exception caught trying to create new PDF document", e);
    if (e instanceof RuntimeException) {
      throw (RuntimeException) e;
    }
    else {
      throw new RuntimeException(e);
    }
  }
}

代码示例来源:origin: qcadoo/mes

@Transactional
private void generateWorkPlanDocuments(final ComponentState state, final Entity workPlan) throws IOException,
    DocumentException {
  Entity workPlanWithFilename = fileService.updateReportFileName(workPlan, WorkPlanFields.DATE,
      "workPlans.workPlan.report.fileName");
  workPlanPdfService.generateDocument(workPlanWithFilename, state.getLocale());
  if (workPlan.getStringField(WorkPlanFields.TYPE).compareTo(WorkPlanType.BY_DIVISION.getStringValue()) == 0) {
    String fileNameForDivision = "workPlans.workPlan.report.fileNameForDivision";
    Entity workPlanForDivision = fileService.updateReportFileName(workPlanWithFilename, WorkPlanFields.DATE,
        fileNameForDivision);
    workPlanForDivisionPdfService.generateDocument(workPlanForDivision, state.getLocale(), fileNameForDivision,
        PageSize.A4.rotate());
  }
}

代码示例来源:origin: org.kuali.kfs/kfs-core

Font textFont = FontFactory.getFont(FontFactory.COURIER, 8, Font.NORMAL);
Document document = new Document(PageSize.A4.rotate());

代码示例来源:origin: org.geomajas.plugin/geomajas-plugin-printing

public void setSize(String size, boolean landscape) {
  Rectangle rect = null;
  if (landscape) {
    rect = PageSize.getRectangle(size).rotate();
  } else {
    rect = PageSize.getRectangle(size);
  }
  setBounds(rect);
  getConstraint().setWidth(rect.getWidth());
  getConstraint().setHeight(rect.getHeight());
}

代码示例来源:origin: org.primefaces.extensions/primefaces-extensions

final Document document = new Document();
if (orientation.equalsIgnoreCase("Landscape")) {
  document.setPageSize(PageSize.A4.rotate());

代码示例来源:origin: displaytag/displaytag

/**
 * @see org.displaytag.export.BinaryExportView#doExport(OutputStream)
 */
public void doExport(OutputStream out) throws JspException
{
  try
  {
    Document document = new Document(PageSize.A4.rotate(), 60, 60, 40, 40);
    this.initItextWriter(document, out);
    document.open();
    Table table = new Table(this.model.getNumberOfColumns());
    ItextTableWriter writer = new ItextTableWriter(table, document);
    writer.writeTable(this.model, "-1");
    document.add(table);
    document.close();
  }
  catch (Exception e)
  {
    throw new ItextGenerationException(e);
  }
}

代码示例来源:origin: displaytag/displaytag

/**
 * @see org.displaytag.export.BinaryExportView#doExport(OutputStream)
 */
public void doExport(OutputStream out) throws JspException
{
  try
  {
    // Initialize the table with the appropriate number of columns
    initTable();
    // Initialize the Document and register it with PdfWriter listener and the OutputStream
    Document document = new Document(PageSize.A4.rotate(), 60, 60, 40, 40);
    document.addCreationDate();
    HeaderFooter footer = new HeaderFooter(new Phrase(TagConstants.EMPTY_STRING, smallFont), true);
    footer.setBorder(Rectangle.NO_BORDER);
    footer.setAlignment(Element.ALIGN_CENTER);
    PdfWriter.getInstance(document, out);
    // Fill the virtual PDF table with the necessary data
    generatePDFTable();
    document.open();
    document.setFooter(footer);
    document.add(this.tablePDF);
    document.close();
  }
  catch (Exception e)
  {
    throw new PdfGenerationException(e);
  }
}

代码示例来源:origin: org.jclarion/clarion-runtime

Rectangle landscape = portrait.rotate();
SharedOutputStream sos = new SharedOutputStream();

相关文章

微信公众号

最新文章

更多