Do you own a Debenu Quick PDF Library 12/11/10/9/8/7? Upgrade to Debenu Quick PDF Library 13!

Foxit Quick PDF Library

Frequently Asked Question:

Return to FAQ Index

Image rotation can it be an angle like 60?

Question

Is there a way to retrieve the image rotation angle from an existing image in PDF file? Image rotation can it be an angle like 60?

Answer

Of course Quick PDF supports imagerotation with every angle you want. Here a example:

var
  QP: TQuickPDF;
  ImgId: integer;
  w, h: double;
begin // PDF's erzeugen
  QP := TQuickPDF.Create;
  if QP.UnlockKey('your key here') = 1
  then begin
    QP.SetMeasurementUnits(1);          // Millimeter
    QP.SetPageDimensions(210,297);      // A4-Format
    ImgId := QP.AddImageFromFile('anypicture.jpg',0);
    QP.SelectImage(ImgId);
    w := QP.ImageWidth;
    h := QP.ImageHeight;
    QP.DrawRotatedImage(105,148.5, w, h, 0);
    QP.DrawRotatedImage(105,148.5, w, h, 30);
    QP.DrawRotatedImage(105,148.5, w, h, 60);
    Qp.SaveToFile('rotate.pdf');
  end;
  QP.Free;

For me it seems to be so, that you want to retrieve a imageproperty from an existing PDF. That means: can I get from this pdf the information about the angle, which was used for drawing.

The angle is found in the pdf in the transformationinstructions for the image. In the example above it is:

q
1 0 0 1  297.6378 420.9449 cm
141.7323 0 0 141.7323 0 0 cm
/QuickPDFIm2ed5baf4 Do
Q
q
0.866 0.5 -0.5 0.866  297.6378 420.9449 cm
141.7323 0 0 141.7323 0 0 cm
/QuickPDFIm2ed5baf4 Do
Q
q
0.5 0.866 -0.866 0.5  297.6378 420.9449 cm
141.7323 0 0 141.7323 0 0 cm
/QuickPDFIm2ed5baf4 Do
Q

In the second unit q-Q there is a 0.5. So there is a way, but QuickPDF has no function to figure out this value.

For more information have a look in adobes PDF-Reference in section 4.2.3


© 2015 Debenu & Foxit. All rights reserved. AboutBuyContactBlogNewsletterSupportFAQProduct UpdatesForum