in

Pinpointing objects on a 2nd page

Last post 05-12-2008 2:04 PM by sodakotahusker. 8 replies.
Page 1 of 1 (9 items)
Sort Posts: Previous Next
  • 05-06-2008 6:52 PM

    Pinpointing objects on a 2nd page

    I have a project where I need to place things in specific places on the page.  I had two pages.  I was creating one page and then clearing and starting over for the 2nd page.  Unfortunately I need to print this in duplex mode.  I have to have them be part of the same document.  So I used the NewPage method to add page 2 and plopped the data on.  Since my coordinates overlapped - I wrote over the first page with the second.  So I changed the Y coordinates for the 2nd page  They now show as printing at point that show put them where I want them.  But what I get is all of that data for the 2nd page ending up at the top of the page.  

       Is there a way to specify that the y coordinate applies to a certain page?   I expected newpage to create a new page for me and render using the regular coordinates instead of printing on page 1.    Or can I save the two pages as separate documents and then load them in again as one document  (I used to do this with VSVIEW if I remember right). 


     

  • 05-07-2008 12:42 PM In reply to

    Re: Pinpointing objects on a 2nd page

     I have attached small example, it uses RenderDirect(...) method to render object at specified position.

  • 05-07-2008 5:30 PM In reply to

    Re: Pinpointing objects on a 2nd page

     Does this work with tables. I seem to get nothing when I use renderDirect with a table.

  • 05-08-2008 6:45 AM In reply to

    Re: Pinpointing objects on a 2nd page

    Now example contains RenderTable object. 

  • 05-08-2008 1:09 PM In reply to

    Re: Pinpointing objects on a 2nd page

     Thank you very much for the sample.  That was basically what I was doing.  I specified the number of columns in the instantiation of the table object.  I set the gridlines and then I got empty cells.  So the table was rendering but the data was not being assigned to the cells.  I made some changes the cell pointers and the data started to appear.  So your sample and now my sample work.

     

    However in  processing the real document, nothing is being rendered.  Here is the situation.  I am using  doc.body.children.add( xxx)   to add a table - then measure its height

    then I use the remove method to get rid of it and then use the renderdirect to put it back.  Nothing is showing up in the output.  In fact almost all of the text inserts are failing to show up.  One section that does show up is using the children.add method still.  

    It is possible the renderdirect and body.children add  methodology clash - causing the renderdirect to not work?   I tried adding a call to that method in my sample and the renderdirect calls are working fine - but the body.children.add is showing nothing - just the opposite of what I see in the main project.    

     

     

  • 05-09-2008 7:25 AM In reply to

    Re: Pinpointing objects on a 2nd page

    Now sample contains RenderDirect() and CalcSize() methods 

  • 05-09-2008 11:27 AM In reply to

    Re: Pinpointing objects on a 2nd page

     That is exactly what I'm doing.  It ain't working.  There must be some other issue here.  One thing - I'm using 11 by 17 inch paper in landscape mode.  I'm using pixels as my default unit. 

     

    Here is my code that displays nothing:  Let's start here and see what is wrong with this.  This might have a bearing on the big problem.

     

    _doc.Clear();
                _doc.AllowNonReflowableDocs  = true;
                _doc.DefaultUnit = UnitTypeEnum.Pixel;
                _doc.StartDoc();

                RenderText rtest2 = new RenderText();
                rtest2.Style.Borders.All = LineDef.DefaultBold;
                rtest2.Text = "Body Add method ";
                rtest2.X = new Unit(156, UnitTypeEnum.Mm);
                rtest2.Y = new Unit(35, UnitTypeEnum.Mm);
                _doc.Body.Children.Add(rtest2);

                _doc.EndDoc();

     

     

     

    BTW:  What is difference between Doc.End and Doc.Generate? I was using just doc.clear and doc.generate before I saw your samples - with startdoc and enddoc.

     

     


  • 05-12-2008 9:51 AM In reply to

    Re: Pinpointing objects on a 2nd page

    Methods StartDoc() / EndDoc() can be used only when document is created with RenderXXX() methods, this method of document creation was added for backward compatibility with previous versions of C1Preview, it does not allow to create reflowable documents. Example of using:
    doc.StartDoc();
    doc.RenderDirect(...)
    doc.RenderBlock(...)
    doc.EndDoc();

    Method Generate() was added in C1Preview2 and we recommend use it in new versions. Example of using:

    RenderText rt = new ...
    doc.Body.Children.Add(rt);
    RenderText rt = new ...
    doc.Body.Children.Add(rt);
    doc.Generate();

    So you should correct your code, if you use StartDoc() / EndDoc() code should be:
                doc.Clear();
                doc.AllowNonReflowableDocs = true;
                doc.DefaultUnit = UnitTypeEnum.Pixel;
                doc.StartDoc();

                RenderText rtest2 = new RenderText();
                rtest2.Style.Borders.All = LineDef.DefaultBold;
                rtest2.Text = "Body Add method ";
                doc.RenderDirect(new Unit(156, UnitTypeEnum.Mm), new Unit(35, UnitTypeEnum.Mm), rtest2);

                doc.EndDoc();

    If you use Generate():
                doc.Clear();
                doc.AllowNonReflowableDocs = true;
                doc.DefaultUnit = UnitTypeEnum.Pixel;

                RenderText rtest2 = new RenderText();
                rtest2.Style.Borders.All = LineDef.DefaultBold;
                rtest2.Text = "Body Add method ";
                rtest2.X = new Unit(156, UnitTypeEnum.Mm);
                rtest2.Y = new Unit(35, UnitTypeEnum.Mm);
                doc.Body.Children.Add(rtest2);
                doc.Generate();


  • 05-12-2008 2:04 PM In reply to

    Re: Pinpointing objects on a 2nd page

    Whoooo Hoooooo!  That was the issue.  The body.children.add works fine because I'm removing those elements anyway so I don't care if they don't print - and the renderdirect is putting things where they belong.   Thanks a ton.  This project has been a nightmare!!! I see light at the end of the tunnel.   You have been of great help and I thank you once again.  

     

Page 1 of 1 (9 items)
Contact ComponentOne: 1.800.858.2739 ©1987-2007 ComponentOne LLC All Rights Reserved.