Discussion:
[itextsharp-questions] Setting left and right page margins
Kent Matthew
2008-03-06 22:49:22 UTC
Permalink
I'm using the .NET version of iText in a VB.NET program and I'm trying to set the margins of my PDF using the following code

Dim doc As Document = New Document(PageSize.LETTER, 36, 36, 36, 36)

The only problem is that it doesn't work. The top margin is set correctly, but the left and right margins remain unaffected regardless of what point sizes I use. Is this a feature that only works in Java and not in .NET or am I doing something wrong?

Thanks,
- Kent
Paulo Soares
2008-03-07 11:36:02 UTC
Permalink
Yes, it works.

Paulo
-----Original Message-----
On Behalf Of Kent Matthew
Sent: Thursday, March 06, 2008 10:49 PM
Subject: [itextsharp-questions] Setting left and right page margins
I'm using the .NET version of iText in a VB.NET program and
I'm trying to set the margins of my PDF using the following code
Dim doc As Document = New Document(PageSize.LETTER, 36, 36, 36, 36)
The only problem is that it doesn't work. The top margin is
set correctly, but the left and right margins remain
unaffected regardless of what point sizes I use. Is this a
feature that only works in Java and not in .NET or am I doing
something wrong?
Thanks,
- Kent
Aviso Legal:
Esta mensagem � destinada exclusivamente ao destinat�rio. Pode conter informa��o confidencial ou legalmente protegida. A incorrecta transmiss�o desta mensagem n�o significa a perca de confidencialidade. Se esta mensagem for recebida por engano, por favor envie-a de volta para o remetente e apague-a do seu sistema de imediato. � proibido a qualquer pessoa que n�o o destinat�rio de usar, revelar ou distribuir qualquer parte desta mensagem.

Disclaimer:
This message is destined exclusively to the intended receiver. It may contain confidential or legally protected information. The incorrect transmission of this message does not mean the loss of its confidentiality. If this message is received by mistake, please send it back to the sender and delete it from your system immediately. It is forbidden to any person who is not the intended receiver to use, distribute or copy any part of this message.
Ross Presser
2008-03-07 17:03:48 UTC
Permalink
Post by Kent Matthew
I'm using the .NET version of iText in a VB.NET program and I'm trying to
set the margins of my PDF using the following code
Dim
doc As Document = New Document(PageSize.LETTER, 36, 36, 36, 36)
The only problem is that it doesn't work. The top margin is set
correctly, but the left and right margins remain unaffected regardless of
what point sizes I use. Is this a feature that only works in Java and not
in .NET or am I doing something wrong?
We'd have to see the rest of your code to know if something was wrong. The
code you've shown so far is correct, and identical code works for me on a
daily basis.

What do you add to the document after this?
Kent Matthew
2008-03-07 18:13:16 UTC
Permalink
Hi Paulo,

That's good news! Could you tell me what I'm doing wrong? I've attached an example of the PDF I'm able to generate with margins that are too big, a PDF which has the smaller (half-inch) margins I'm looking for (not generated by iTextSharp), and the code I'm using to generate the PDF. Even though I'm using the line

Dim doc As Document = New Document(PageSize.LETTER, 36, 36, 36, 36)

maybe I'm screwing it up elsewhere in the code. I figure if you can see all the code in context, you'll be able to pinpoint my error.

Thank you for your help!
- Kent

----------------------------------------

Yes, it works.

Paulo
-----Original Message-----
On Behalf Of Kent Matthew
Sent: Thursday, March 06, 2008 10:49 PM
Subject: [itextsharp-questions] Setting left and right page margins
I'm using the .NET version of iText in a VB.NET program and
I'm trying to set the margins of my PDF using the following code
Dim doc As Document = New Document(PageSize.LETTER, 36, 36, 36, 36)
The only problem is that it doesn't work. The top margin is
set correctly, but the left and right margins remain
unaffected regardless of what point sizes I use. Is this a
feature that only works in Java and not in .NET or am I doing
something wrong?
Thanks,
- Kent
Aviso Legal:
Esta mensagem ? destinada exclusivamente ao destinat?rio. Pode conter informa??o confidencial ou legalmente protegida. A incorrecta transmiss?o desta mensagem n?o significa a perca de confidencialidade. Se esta mensagem for recebida por engano, por favor envie-a de volta para o remetente e apague-a do seu sistema de imediato. ? proibido a qualquer pessoa que n?o o destinat?rio de usar, revelar ou distribuir qualquer parte desta mensagem.

Disclaimer:
This message is destined exclusively to the intended receiver. It may contain confidential or legally protected information. The incorrect transmission of this message does not mean the loss of its confidentiality. If this message is received by mistake, please send it back to the sender and delete it from your system immediately. It is forbidden to any person who is not the intended receiver to use, distribute or copy any part of this message.

-------------------------------------------------------------------------
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/
_______________________________________________
itextsharp-questions mailing list
itextsharp-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itextsharp-questions
Paulo Soares
2008-03-07 19:11:39 UTC
Permalink
Tables are created by default at 70% width relative to the page margins. You
need:

PdfPTable.WidthPercentage = 100

Paulo

----- Original Message -----
From: "Kent Matthew" <***@kentmatthew.com>
To: <itextsharp-***@lists.sourceforge.net>
Sent: Friday, March 07, 2008 6:13 PM
Subject: Re: [itextsharp-questions] Setting left and right page margins


Hi Paulo,

That's good news! Could you tell me what I'm doing wrong? I've attached an
example of the PDF I'm able to generate with margins that are too big, a PDF
which has the smaller (half-inch) margins I'm looking for (not generated by
iTextSharp), and the code I'm using to generate the PDF. Even though I'm
using the line

Dim doc As Document = New Document(PageSize.LETTER, 36, 36, 36, 36)

maybe I'm screwing it up elsewhere in the code. I figure if you can see all
the code in context, you'll be able to pinpoint my error.

Thank you for your help!
- Kent

----------------------------------------

Yes, it works.

Paulo
-----Original Message-----
On Behalf Of Kent Matthew
Sent: Thursday, March 06, 2008 10:49 PM
Subject: [itextsharp-questions] Setting left and right page margins
I'm using the .NET version of iText in a VB.NET program and
I'm trying to set the margins of my PDF using the following code
Dim doc As Document = New Document(PageSize.LETTER, 36, 36, 36, 36)
The only problem is that it doesn't work. The top margin is
set correctly, but the left and right margins remain
unaffected regardless of what point sizes I use. Is this a
feature that only works in Java and not in .NET or am I doing
something wrong?
Thanks,
- Kent
Kent Matthew
2008-03-07 19:48:36 UTC
Permalink
Genius again!

Thanks for your help, Paulo. I've got everything I need now.
- Kent

----------------------------------------

Tables are created by default at 70% width relative to the page margins. You
need:

PdfPTable.WidthPercentage = 100

Paulo

----- Original Message -----
From: "Kent Matthew"
To:
Sent: Friday, March 07, 2008 6:13 PM
Subject: Re: [itextsharp-questions] Setting left and right page margins

Hi Paulo,

That's good news! Could you tell me what I'm doing wrong? I've attached an
example of the PDF I'm able to generate with margins that are too big, a PDF
which has the smaller (half-inch) margins I'm looking for (not generated by
iTextSharp), and the code I'm using to generate the PDF. Even though I'm
using the line

Dim doc As Document = New Document(PageSize.LETTER, 36, 36, 36, 36)

maybe I'm screwing it up elsewhere in the code. I figure if you can see all
the code in context, you'll be able to pinpoint my error.

Thank you for your help!
- Kent

----------------------------------------

Yes, it works.

Paulo
-----Original Message-----
On Behalf Of Kent Matthew
Sent: Thursday, March 06, 2008 10:49 PM
Subject: [itextsharp-questions] Setting left and right page margins
I'm using the .NET version of iText in a VB.NET program and
I'm trying to set the margins of my PDF using the following code
Dim doc As Document = New Document(PageSize.LETTER, 36, 36, 36, 36)
The only problem is that it doesn't work. The top margin is
set correctly, but the left and right margins remain
unaffected regardless of what point sizes I use. Is this a
feature that only works in Java and not in .NET or am I doing
something wrong?
Thanks,
- Kent
-------------------------------------------------------------------------
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/
_______________________________________________
itextsharp-questions mailing list
itextsharp-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itextsharp-questions
Continue reading on narkive:
Loading...