Discussion:
[iText-questions] Change margins for existing PDF document
Raj S
2008-03-03 12:14:05 UTC
Permalink
Hi Friends,

I am new to iTEXT.
In my application, the requirement is: I need to take an existing document, add some more content and change the margins, if necessary.
(This is becoz, the PDF should be printed on a page. And, if the document is not printed correctly, the user will be given a facility to change the margins a bit, so that it can be printed correctly)

There is facilty in iTEXT to set the margins using document.setMargins() method.
But, how can we change the margins for an existing PDF document? Or is there a way to create a new document, set margins for it and add the content from existing document?
Please help me with some idea or code.

Thanks for any response.

Raj.







____________________________________________________________________________________
Looking for last minute shopping deals?
Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping
Leonard Rosenthol
2008-03-03 12:18:41 UTC
Permalink
TWo things.

1) There is no such thing as a margin in a PDF - it's just white
space where nothing is drawn.
2) Even if you could change the margins, PDF doesn't reflow - so I am
not sure how it would help you.

Perhaps if you explained your situation more...

Leonard
Post by Raj S
Hi Friends,
I am new to iTEXT.
In my application, the requirement is: I need to take an
existing document, add some more content and change the margins, if
necessary.
(This is becoz, the PDF should be printed on a page. And, if the
document is not printed correctly, the user will be given a
facility to change the margins a bit, so that it can be printed
correctly)
There is facilty in iTEXT to set the margins using
document.setMargins() method.
But, how can we change the margins for an existing PDF
document? Or is there a way to create a new document, set margins
for it and add the content from existing document?
Please help me with some idea or code.
Thanks for any response.
Raj.
Never miss a thing. Make Yahoo your homepage.
----------------------------------------------------------------------
---
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
iText-questions mailing list
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/
Raj S
2008-03-03 12:48:59 UTC
Permalink
Hi,

Thanks for your response, Leonard
I will explain the situation more clearly.
I have a PDF document, in which there are form fields like text box,...
What I need to do is put some data in the fields using iTEXT and save it for printing.

I need to print on a paper which already contains the template, i mean like this
Name:
City:
State:

etc,
So, the problem is i need to adjust the form fields, such that data into the form fields (for ex: Leonard comes next 'Name:' and Texas comes next to 'City:' , etc) comes correctly on the printed paper.
Hope u understand the problem.

Thanks for any response,
Raj

----- Original Message ----
From: Leonard Rosenthol <***@pdfsages.com>
To: Post all your questions about iText here <itext-***@lists.sourceforge.net>
Sent: Monday, March 3, 2008 5:48:41 PM
Subject: Re: [iText-questions] Change margins for existing PDF document

TWo things.


1) There is no such thing as a margin in a PDF - it's just white space where nothing is drawn.
2) Even if you could change the margins, PDF doesn't reflow - so I am not sure how it would help you.


Perhaps if you explained your situation more...


Leonard

On Mar 3, 2008, at 7:14 AM, Raj S wrote:


Hi Friends,

I am new to iTEXT.
In my application, the requirement is: I need to take an existing document, add some more content and change the margins, if necessary.
(This is becoz, the PDF should be printed on a page. And, if the document is not printed correctly, the user will be given a facility to change the margins a bit, so that it can be printed correctly)

There is facilty in iTEXT to set the margins using document.setMargins() method.
But, how can we change the margins for an existing PDF document? Or is there a way to create a new document, set margins for it and add the content from existing document?
Please help me with some idea or code.

Thanks for any response.

Raj.






Never miss a thing. Make Yahoo your homepage.-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/_______________________________________________
iText-questions mailing list
iText-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/




-----Inline Attachment Follows-----

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/


-----Inline Attachment Follows-----

_______________________________________________
iText-questions mailing list
iText-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/







____________________________________________________________________________________
Looking for last minute shopping deals?
Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping
1T3XT info
2008-03-03 13:09:06 UTC
Permalink
So, the problem is i need to adjust the form fields, such that
data into the form fields (for ex: Leonard comes next 'Name:' and Texas
comes next to 'City:' , etc) comes correctly on the printed paper.
Hope u understand the problem.
2) Even if you could change the margins, PDF doesn't reflow
Do you know what is meant by 'reflow'?
r***@yahoo.com
2008-03-03 13:21:16 UTC
Permalink
Hi,

Sorry, if i may be sending this mail again.
In my application, the requirement is: I need to take an existing document, add some more content and change the margins, if necessary.
(This is becoz, the PDF should be printed on a page. And, if the document is not printed correctly, the user will be given a facility to change the margins a bit, so that it can be printed correctly)

There is facilty in iTEXT to set the margins using document.setMargins() method.
But, how can we change the margins for an existing PDF document? Or is there a way to create a new document, set margins for it and add the content from existing document?
Please help me with some idea or code.

Thanks for any response,
Raj
1T3XT info
2008-03-03 13:47:59 UTC
Permalink
Post by r***@yahoo.com
Hi,
Sorry, if i may be sending this mail again.
What makes you think the negative answer will be different
if you post the question twice?
Post by r***@yahoo.com
In my application, the requirement is: I need to take an existing document,
OK.
Post by r***@yahoo.com
add some more content and change the margins, if necessary.
You can add some more content at absolute positions,
you can change the media box, crop box and other page boundaries,
but that may not be sufficient for your needs.
Post by r***@yahoo.com
(This is becoz, the PDF should be printed on a page.
If you change page boundaries, you're changing the page size.
Is that acceptable when printing???
Post by r***@yahoo.com
And, if the document is not printed correctly, the user will
be given a facility to change the margins a bit, so that it
can be printed correctly)
As Leonard already explained (and he's Adobe's PDF Technical
Standards Evangelist, so he knows), the concept of margins
doesn't exist in PDF.
Post by r***@yahoo.com
There is facilty in iTEXT to set the margins using document.setMargins() method.
Forget about that, it's irrelevant for you.
setMargins is for newly created documents,
not for existing ones.
Post by r***@yahoo.com
But, how can we change the margins for an existing PDF document?
By changing the MediaBox, CropBox,...
Post by r***@yahoo.com
Or is there a way to create a new document, set margins for it
and add the content from existing document?
Yes and no. You can import pages from existing documents,
but you do know that PDF is not a format for editing, don't you?
Depending on your source documents, it can be something that is
very hard to impossible to achieve.
Post by r***@yahoo.com
Please help me with some idea or code.
Please try understanding the answers first.
--
This answer is provided by 1T3XT BVBA
Loading...