On Thu, Sep 15, 2005 at 02:57:59PM +0200, Heiko Oberdiek wrote:
Hello,
On Thu, Sep 15, 2005 at 04:31:18AM -0700, Thanh Han The wrote:
Another issue is that I am implementing a primitive requrested by Cho, to grab the BBox of an included pdf.
What's the purpose? The knowledge of width and height is important (graphicx, pdfpages, ...). By putting \pdfximage into a box these values are easily available (see pdftex.def). I would be interested, in which case the exact offset must be known.
to be honest I don't know either -- because I don't use dvipdfm(x). Just trying to satisfy a request by Cho.
Next issues: * I assume the box (media, crop, ...) is choosen by the previous \pdfximage?
yes exactly
* What is "1" until "4"? * It is the first until fourth component of the box retangle, given in the pdf file?
they are the values as returned by xpdf -- page->{x1, y1, x2, y2}. I don't know whether xpdf does normalize them, but I hope so.
* The pdf spec says that the box typically has the form: [ ll_x ll_y ur_x ur_y ] (PDF spec for 1.6, section "3.8.4 Rectangle") But there is a note that says that any two diagonally opposite corners are acceptable and that applications that process PDF should be prepared to normalize such rectangles. The question is now, does pdfTeX normalize the rectangle? This has the advantage that the numbers "1" until "4" also have the symbolic meaning "ll_x" until "ur_y".
Regards, Thanh
One afterthought. I'd strongly opt for \pdfimagebox instead of \pdfpagebox. It suits already used naming convention (\pdfimagegamma, \pdfimagehicolor etc.)... And if someday one will want to implement \pdfpageboxwidth3=200mm \pdfpageboxheight3=280mm to set TrimBox of the page being typeset, \pdfpagebox prefix would be the most suitable %) Regards -- Pawe/l Jackowski P.Jackowski@gust.org.pl
On Thu, Sep 15, 2005 at 09:01:07AM -0700, Thanh Han The wrote:
On Thu, Sep 15, 2005 at 02:57:59PM +0200, Heiko Oberdiek wrote:
On Thu, Sep 15, 2005 at 04:31:18AM -0700, Thanh Han The wrote:
* What is "1" until "4"? * It is the first until fourth component of the box retangle, given in the pdf file?
they are the values as returned by xpdf -- page->{x1, y1, x2, y2}. I don't know whether xpdf does normalize them, but I hope so.
I have found function PageAttrs::readBox() in file Page.cc.
Here the rectangle values are not normalized, they are read
and assigned in order. To make the life for documentation
writers easier, normalization can easily be done:
x1_new := min(x1, x2);
x2_new := max(x1, x2);
y1_new := min(y1, y2);
y2_new := max(y1, y2);
or in pseudo code:
input: x1, x2, x3, x4
output: x1, x2, x3, x4 (normalized)
local variable: h;
if (x1 > x2) {
h := x2;
x2 := x1;
x1 := h;
}
if (y1 > y2) {
h := y2;
y2 := y1;
y1 := h;
}
Yours sincerely
Heiko
participants (3)
-
Heiko Oberdiek
-
Pawel Jackowski
-
Thanh Han The