Quantcast

Dynamic Page size (urgent)..

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Dynamic Page size (urgent)..

Rajput, Sunil (Cognizant)

Hi,

 

I m not able to check the exact size of the PDF file.

 

I have written the following code.

 

       Rectangle pageSize = new Rectangle(790,610);

       Document         document = new Document(new Rectangle(790,610));

       document.open();

           

      StringBuffer sBuff1 = new StringBuffer("<HTML><body>");

      sBuff1.append("<table cellspacing=0 cellpadding=0 border=0 width=100% ><tr><td><font size=2><b>Separate Accounts Performance </td> </tr>");

      sBuff1.append("<tr><td >MetLife Flexible Premium Group Variable Life Insurance Policy Separate Accounts</td></tr>");

      sBuff1.append("<tr><td>Performance as of Month Ending</b></font></td></tr>");

      sBuff1.append("<tr><td><font size=1>Metropolitan Life Private Placement Flexible Premium Variable Life Insurance Policy is a priva         “);

      sBuff1.append(“variable Insurance Products Fund.</font></td></tr>");

      sBuff1.append("</table></body></html>");

 

      document.add(new Paragraph(sBuff1.toString());

           

      document.close();

 

now I want to know that , how many line can be inserted in the same page.           

 

Is there any function that tells me that u have used this much page size and u r at some x location.

 

Is there any function that tells me that ur page height is 610(my page height , see above document()…. ) and u r at height 400 after inserting the above lines ????

 

I have data that only contains text…. , I m using the PdfPTable for writing the Data in Tabular format.

 

 

 

 

 

 

This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information.
If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.
Any unauthorised review, use, disclosure, dissemination, forwarding, printing or copying of this email or any action taken in reliance on this e-mail is strictly
prohibited and may be unlawful.

Visit us at http://www.cognizant.com
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Dynamic Page size (urgent)..

blowagie
Rajput, Sunil (Cognizant) wrote:

> Hi,
>
>  
>
> I m not able to check the exact size of the PDF file.

>        Rectangle pageSize = new Rectangle(790,610);
>        Document         document = new Document(new Rectangle(790,*610*));

Why define a Rectangle pageSize and then not use this object?

>        document.open();

>       StringBuffer sBuff1 = new StringBuffer("<HTML><body>");
...
>       document.add(new Paragraph(sBuff1.toString());

This is some very odd code.
Is it your intention to show HTML in your PDF file?
If so, please ignore my remark.

>       document.close();

> now I want to know that , how many line can be inserted in the same
> page.          

That would depend on the leading (space between the line) you have
defined (explicitely or implicitely).

> Is there any function that tells me that u have used this much page size
> and u r at some x location.

You are adding a Paragraph, so you could use a PageEvent and ask for the
end position in the onEndParagraph event. There are other possibilities,
but PageEvents are a good place to start:
http://itextdocs.lowagie.com/tutorial/directcontent/pageevents/

> I have data that only contains text…. , I m using the PdfPTable for
> writing the Data in Tabular format.

This sentence is in contrast with the example above. There's too much
information missing in your question to give you a useful answer.

Please read the tutorial first. It will save you a lot of time.
http://itextdocs.lowagie.com/tutorial/objects/tables/pdfptable

br,
Bruno



-------------------------------------------------------
This SF.Net email is sponsored by the 'Do More With Dual!' webinar happening
July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual
core and dual graphics technology at this free one hour event hosted by HP,
AMD, and NVIDIA.  To register visit http://www.hp.com/go/dualwebinar
_______________________________________________
iText-questions mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Dynamic Page size (urgent)..

blowagie
In reply to this post by Rajput, Sunil (Cognizant)
Rajput, Sunil (Cognizant) wrote:

> Hi,
>
>  
>
> I m not able to check the exact size of the PDF file.

>        Rectangle pageSize = new Rectangle(790,610);
>        Document         document = new Document(new Rectangle(790,*610*));

Why define a Rectangle pageSize and then not use this object?

>        document.open();

>       StringBuffer sBuff1 = new StringBuffer("<HTML><body>");
...
>       document.add(new Paragraph(sBuff1.toString());

This is some very odd code.
Is it your intention to show HTML in your PDF file?
If so, please ignore my remark.

>       document.close();

> now I want to know that , how many line can be inserted in the same
> page.          

That would depend on the leading (space between the line) you have
defined (explicitely or implicitely).

> Is there any function that tells me that u have used this much page size
> and u r at some x location.

You are adding a Paragraph, so you could use a PageEvent and ask for the
end position in the onEndParagraph event. There are other possibilities,
but PageEvents are a good place to start:
http://itextdocs.lowagie.com/tutorial/directcontent/pageevents/

> I have data that only contains text…. , I m using the PdfPTable for
> writing the Data in Tabular format.

This sentence is in contrast with the example above. There's too much
information missing in your question to give you a useful answer.

Please read the tutorial first. It will save you a lot of time.
http://itextdocs.lowagie.com/tutorial/objects/tables/pdfptable

br,
Bruno


-------------------------------------------------------
This SF.Net email is sponsored by the 'Do More With Dual!' webinar happening
July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual
core and dual graphics technology at this free one hour event hosted by HP,
AMD, and NVIDIA.  To register visit http://www.hp.com/go/dualwebinar
_______________________________________________
iText-questions mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Re: Dynamic Page size (urgent)..

blowagie
In reply to this post by Rajput, Sunil (Cognizant)
sunil rajput wrote:

> Simply , i want to keep the track of the page, at what location i m.
>  
> means , if i write one line then i should know that now i m at 'x'
> location and my page end position is at some 'y' location.
>  
> i don't won't to use onPageEnd or onParagraphEnd Event which

This is wrong:

> will be called automatically after every page end.

Events are triggered when they happen.
onPageEnd is called after every page end.
All the other events (except onDocumentClose) are called
BEFORE onPageEnd.
But maybe you're talking the wrong approach to iText.
Maybe you need ColumnText or absolute positioning.
Even if your problem is urgent, you will save time by
reading the tutorial and trying some examples first.
br,
Bruno

PS: please keep on the mailinglist, don't send mail to
personal addresses only.


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
iText-questions mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Re: Dynamic Page size (urgent)..

blowagie
In reply to this post by Rajput, Sunil (Cognizant)
sunil rajput wrote:

> do u have any example of absolute positioning that u have mentioned.
>  

There are examples all over the tutorial:
http://itextdocs.lowagie.com/tutorial/objects/columns/
http://itextdocs.lowagie.com/tutorial/directcontent/
br,
Bruno


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
iText-questions mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Loading...