Subscribe

Pdf is rotated

  1. 2011-11-02 10:11:50 PDT
    Pdf file is rendered rotated. This happens in example app to. But in acroread it looks correct. Is the problem with version 1.6? PDF file: http://daris.kbv.de/daris/doccontent.dll?LibraryName=EXTDARIS^DMSSLAVE&SystemType=2&LogonId=55a113a7a5a20854715ef06e439d1e7e&DocId=003764052&Page=1
  2. 2011-11-03 01:45:04 PDT
    Your link is broken. Anyway, a PDF page has a rotation property, this is most probably the case here. The example does not take into account for this. A more complete rendering sequence would look like: transformPage.setToIdentity(); Rectangle2D normalizedPagerect = getPage().getCropBox() .toNormalizedRectangle(); PDFGeometryTools.adjustTransform(transformPage, PDFGeometryTools.normalizeRotate(getPage().getRotate()), normalizedPagerect); // double[] extent = new double[2]; extent[0] = normalizedPagerect.getWidth(); extent[1] = normalizedPagerect.getHeight(); transformPage.deltaTransform(extent, 0, extent, 0, 1); double pageWidth = Math.abs(extent[0]); double pageHeight = Math.abs(extent[1]); // int imgWidth = Math.abs((int) (pageWidth * scale)); int imgHeight = Math.abs((int) (pageHeight * scale)); double scaleX = scale; double scaleY = -scale; BufferedImage image = new BufferedImage(imgWidth, imgHeight, BufferedImage.TYPE_INT_RGB); Graphics2D g2 = (Graphics2D) image.getGraphics(); IGraphicsContext g = new CwtAwtGraphicsContext(g2); // init user space transform.setToIdentity(); // apply conversion from screen to pdf page transform.scale(scaleX, scaleY); transform.translate(0, -pageHeight); // apply pdf internal page transformation transform.concatenate(transformPage); try { g.transform(transform); renderPage(g); writePage(image); } finally { g.dispose(); } (not tested)
  3. 2011-11-03 07:13:54 PDT
    Thank you, it's the case. P.S. For the sake of completeness, link is http://www.kbv.de/service/6253.html (Muster 10)
Jump To:
< Previous | 1 | Next >

Add a Reply

This forum does not allow anonymous participation.

Log in to add a reply. Not registered? Create an account to participate and receive email updates when replies are posted to this topic.