Loading ...
Sorry, an error occurred while loading the content.
 

Re: [XSL-FO] Re: Approach to scaling an entire document

Expand Messages
  • Peter Wu
    Christian, Thanks for your generous contribution of code and help on using it. Gratefully, peter ... === message truncated ===
    Message 1 of 7 , Dec 6, 2005
      Christian,

      Thanks for your generous contribution of code and help
      on using it.

      Gratefully,
      peter

      --- christianduschl <christianDuschl@...>
      wrote:

      > Sorry for this, didn't have the time to do this.
      > The method scales a formatting-objects node.
      > The Parameters are the node, xZoom = zoomvalue
      > vetical (100.0 means
      > no scaling),xZoom = zoomvalue horizontal (100.0
      > means no scaling),
      > chPos = true (change position of the node also).
      >
      > the funktion scales the node and all the subnodes oh
      > a fo- node.
      >
      > regards
      >
      >
      >
      > --- In XSL-FO@yahoogroups.com, Peter Wu
      > <peterlwu@y...> wrote:
      > >
      > > Hi Christian,
      > >
      > > I know that the meaning of this code must be
      > obvious
      > > to you and perhaps to the majority of people who
      > read
      > > this forum but it's not entirely clear to me.
      > Could
      > > you please explain for my benefit what it does and
      > how
      > > to use it?
      > >
      > > Thanks,
      > > peter wu
      > >
      > >
      > > --- christianduschl <christianDuschl@x...>
      > > wrote:
      > >
      > > > maybe this will help a little bit.
      > > >
      > > > final static public void convertNodeSize(Node
      > > > n,double xZoom,
      > > > double yZoom,boolean chPos) {
      > > > NamedNodeMap aList = n.getAttributes();
      > > >
      > > > if (aList != null) {
      > > > int l = aList.getLength();
      > > >
      > > > if (l>0) {
      > > > for (int i=0;i<l;i++) {
      > > > Node nA = aList.item(i);
      > > > String nV = nA.getNodeValue();
      > > > String nVN = nA.getNodeName();
      > > >
      > > > if (nV.endsWith("mm")==true ||
      > > > nV.endsWith("cm")
      > > > ==true ||nV.endsWith("in")==true
      > > > ||nV.endsWith("px")==true
      > > > ||nV.endsWith("pt")==true
      > ||nV.endsWith("pc")==true)
      > > > {
      > > > String numStr =
      > > > nV.substring(0,nV.length()-2);
      > > >
      > > > if (isNumber(numStr)==true) {
      > > > double d =
      > > > Double.parseDouble(numStr);
      > > > double z;
      > > >
      > > >
      > > >
      > > > if (chPos==true ||
      > > >
      > > > (nVN.compareToIgnoreCase("left")!=0 &&
      > > >
      > > > nVN.compareToIgnoreCase("right")!=0 &&
      > > >
      > > > nVN.compareToIgnoreCase("top")!=0 &&
      > > >
      > > > nVN.compareToIgnoreCase("bottom")!=0) ) {
      > > > if
      > > > (nVN.compareToIgnoreCase("border-width")!
      > > > =0 &&
      > > >
      > > > nVN.compareToIgnoreCase("font-size")!
      > > > =0 ){
      > > > if
      > > > (nVN.toLowerCase().indexOf("left")>=0
      > > > ||
      > > >
      > > > nVN.toLowerCase().indexOf("right")>=0
      > > > ||
      > > >
      > > > nVN.toLowerCase().indexOf("width")
      > > > >=0 ) {
      > > > z = xZoom;
      > > > }
      > > > else {
      > > > z = yZoom;
      > > > }
      > > >
      > > > if (z!=100.00) {
      > > > String einh =
      > > > nV.substring(nV.length()-
      > > > 2);
      > > > d = d * z /100.0;
      > > >
      > > >
      > > > String newVal;
      > > >
      > > > if
      > > > (einh.compareToIgnoreCase("px")==0)
      > > > {
      > > > newVal = "" +
      > > > Math.round(d)+"px";
      > > > }
      > > > else {
      > > > newVal = "" +
      > > > (Math.round
      > > > (d*100.0)/100.0)+einh;
      > > > }
      > > >
      > > > nA.setNodeValue
      > > > (newVal);
      > > > }
      > > > }
      > > > }
      > > > }
      > > > }
      > > > }
      > > > }
      > > > }
      > > >
      > > > NodeList nL = n.getChildNodes();
      > > > if (nL!=null) {
      > > > int l = nL.getLength();
      > > >
      > > > for (int i=0;i<l;i++) {
      > > > Node fN = nL.item(i);
      > > >
      > > > if (fN != null) {
      > > > String nN = fN.getNodeName();
      > > >
      > > > if (nN.startsWith("#")==false) {
      > > >
      > > > convertNodeSize(fN,xZoom,yZoom,true);
      > > > }
      > > > }
      > > > }
      > > > }
      > > > }
      > > >
      > > >
      > > >
      > > >
      > > >
      > > > --- In XSL-FO@yahoogroups.com, Peter Wu
      > > > <peterlwu@y...> wrote:
      > > > >
      > > > > ...I think that's the only way. That's how we
      > did
      > > > it
      > > > > after looking for another way but could not
      > find
      > > > one.
      > > > >
      > > > > --- Onassis Cayetano <ocayetano@y...> wrote:
      > > > >
      > > > > > Does anyone have an approach to scaling an
      > > > entire
      > > > > > document, meaning all the font sizes,
      > > > > > table column widths scaling to accomodate
      > more
      > > > > > content?
      > > > > >
      > > > > > For example my PDF reports normally contain
      > > > tables
      > > > > > of data that may have 10 columns in one
      > > > > > run. On another run of the report, the
      > table
      > > > may
      > > > > > have 20 columns. Switching the document
      > > > > > to landscape may not necessarily fit the
      > entire
      > > > > > table so I have to do some "scaling" of the
      > > > > > column widths and font sizes. Other than
      > doing
      > > > some
      > > > > > math to get the correct widths and
      > > > > > sizes, is there a more generic way to do
      > this?
      > > > I
      > > > > > guess I'm thinking of something like the
      > Print
      > > > > > options available on some
      > applications/printers
      > > > > > where you can say Print to a specific %
      > scale.
      > > >
      > > > > > Since this option may not always be
      > available,
      > > > I'm
      >
      === message truncated ===
    Your message has been successfully submitted and would be delivered to recipients shortly.