Re: [iText-questions] missing line space in Text field while merging multiple PDF's using PDFCopy of IText

2010-08-06 Thread shivananda22

Paulo,

 

Thanks for the reply. 

 

Due to some security reasons I am not able to attach the PDF files, but I can 
show you the screen shots of the two files.

 

Screen shot for the single PDF.

 

 

Screen shot for merged files

 

 

 

For the both scenarios I am using the same template but the line spacing is 
differing. Could you please help me out on this.

 

Regards,

Shiv

 



From: Paulo Soares-3 [via iText - General] 
[mailto:ml-node+2314995-1958418754-372...@n4.nabble.com] 
Sent: Thursday, August 05, 2010 8:41 PM
To: Sivananda Mylarapu
Subject: Re: missing line space in Text field while merging multiple PDF's 
using PDFCopy of IText

 

I never saw that happening. It would help to see the individual pdf and the 
merged one. 

Paulo 

-Original Message- 
From: shivananda22 [mailto:[hidden email]] 
Sent: Thursday, August 05, 2010 1:51 PM 
To: [hidden email] 
Subject: [iText-questions] missing line space in Text field while merging 
multiple PDF's using PDFCopy of IText 


Hi, 

I am using  IText to fill the values in Designer created PDF using IText 
AcroFields along with this I am using PDFCopy of Itext to merge the same pdf 
file for 3 times with different data. The issue is I am having text field in 
the pdf where it will accept multiple lines and I had given 8 inches as the 
line spacing between the lines. When i create a single pdf( i.e. filling 
values in the form and creating a new file) the line spacing is the same as 
what  I had given but when I try to merge the three files the line spacing 
in the Text Field is getting increased and my data is over flowing. I am 
merging the files using PDFCopy. 

My code will looks like the following 



FileOutputStream os = new FileOutputStream(template.pdf); 
Document document = new Document(); 
PdfCopy copy = new PdfCopy(document, os); 
document.open(); 

for (int i =0;i3;i++) { 
// create the reader by passing the AWB PDF template 
PdfReader reader = new PdfReader(template.pdf); 
FileOutputStream baos = new 
FileOutputStream(result.pdf); 
// create the stamper 
PdfStamper pdfStamper = new PdfStamper(reader, baos); 
pdfStamper.setFormFlattening(true); 
pdfStamper.setFreeTextFlattening(true); 
pdfStamper.setFullCompression(); 
// retrieve the form fields 
AcroFields pdfForm = pdfStamper.getAcroFields(); 
// fill the form with the appropriate values 

// This method will fill up the form values 
setFormValues(pdfForm); 

pdfStamper.setFormFlattening(true); 
pdfStamper.close(); 
reader = new PdfReader(result.pdf); 
// add the first page of the reader to the copy 
copy.addPage(copy.getImportedPage(reader, 1)); 
reader.close(); 
baos.close(); 
} 
copy.flush(); 
document.close(); 
copy.close(); 





Could any one please tell me what is the reason for increasing line space 
between the lines in Text fields 


Thanks 
Shiv 


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. 



-- 
The Palm PDK Hot Apps Program offers developers who use the 
Plug-In Development Kit to bring their C/C++ apps to Palm for a share 
of $1 Million in cash or HP Products. Visit us here for more details: 
http://p.sf.net/sfu/dev2dev-palm
___ 
iText-questions mailing list 
[hidden email] 

Re: [iText-questions] missing line space in Text field while merging multiple PDF's using PDFCopy of IText

2010-08-06 Thread shivananda22

Paulo,

 

Thanks for the reply. 

 

Due to some security reasons I am not able to attach the PDF files, but I can 
show you the screen shots of the two files.

 

Screen shot for the single PDF.

 

 

Screen shot for merged files

 

 

 

For the both scenarios I am using the same template but the line spacing is 
differing. Could you please help me out on this?

 

Regards,

Shiv

 



From: Paulo Soares-3 [via iText - General] 
[mailto:ml-node+2314995-1958418754-372...@n4.nabble.com] 
Sent: Thursday, August 05, 2010 8:41 PM
To: Sivananda Mylarapu
Subject: Re: missing line space in Text field while merging multiple PDF's 
using PDFCopy of IText

 

I never saw that happening. It would help to see the individual pdf and the 
merged one. 

Paulo 

-Original Message- 
From: shivananda22 [mailto:[hidden email]] 
Sent: Thursday, August 05, 2010 1:51 PM 
To: [hidden email] 
Subject: [iText-questions] missing line space in Text field while merging 
multiple PDF's using PDFCopy of IText 


Hi, 

I am using  IText to fill the values in Designer created PDF using IText 
AcroFields along with this I am using PDFCopy of Itext to merge the same pdf 
file for 3 times with different data. The issue is I am having text field in 
the pdf where it will accept multiple lines and I had given 8 inches as the 
line spacing between the lines. When i create a single pdf( i.e. filling 
values in the form and creating a new file) the line spacing is the same as 
what  I had given but when I try to merge the three files the line spacing 
in the Text Field is getting increased and my data is over flowing. I am 
merging the files using PDFCopy. 

My code will looks like the following 



FileOutputStream os = new FileOutputStream(template.pdf); 
Document document = new Document(); 
PdfCopy copy = new PdfCopy(document, os); 
document.open(); 

for (int i =0;i3;i++) { 
// create the reader by passing the AWB PDF template 
PdfReader reader = new PdfReader(template.pdf); 
FileOutputStream baos = new 
FileOutputStream(result.pdf); 
// create the stamper 
PdfStamper pdfStamper = new PdfStamper(reader, baos); 
pdfStamper.setFormFlattening(true); 
pdfStamper.setFreeTextFlattening(true); 
pdfStamper.setFullCompression(); 
// retrieve the form fields 
AcroFields pdfForm = pdfStamper.getAcroFields(); 
// fill the form with the appropriate values 

// This method will fill up the form values 
setFormValues(pdfForm); 

pdfStamper.setFormFlattening(true); 
pdfStamper.close(); 
reader = new PdfReader(result.pdf); 
// add the first page of the reader to the copy 
copy.addPage(copy.getImportedPage(reader, 1)); 
reader.close(); 
baos.close(); 
} 
copy.flush(); 
document.close(); 
copy.close(); 





Could any one please tell me what is the reason for increasing line space 
between the lines in Text fields 


Thanks 
Shiv 


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. 



-- 
The Palm PDK Hot Apps Program offers developers who use the 
Plug-In Development Kit to bring their C/C++ apps to Palm for a share 
of $1 Million in cash or HP Products. Visit us here for more details: 
http://p.sf.net/sfu/dev2dev-palm
___ 
iText-questions mailing list 
[hidden email] 

Re: [iText-questions] Null pointer exception in PdfWriter

2010-08-06 Thread Gylfi Ingvason

Here's a corrected (or at least improved) patch - this resolves the indirect
reference to the correct object and does not create an unused entry in the
Xref:

protected internal virtual int GetNewObjectNumber(PdfReader reader, int
number, int generation) {

  if (currentPdfReaderInstance == null) {
currentPdfReaderInstance = GetPdfReaderInstance(reader);
  }
  return currentPdfReaderInstance.GetNewObjectNumber(number, generation);
}

Gylfi

-Original Message-
From: Gylfi Ingvason [mailto:gylfi.ingva...@solimarsystems.com] 
Sent: Thursday, August 05, 2010 3:59 PM
To: 'Post all your questions about iText here'
Subject: RE: [iText-questions] Null pointer exception in PdfWriter

Thanks Paulo.

I downloaded and built the SVN tip and was able to reproduce the problem.
The gist of it is that if you use PdfWriter to import a page and re-create
link annotations, and those annotations contain indirect references (such as
a Parent, i.e. /P 8 0 R), you get the exception. Enclosed is a PDF file
that I clobbered together with such a link, along with a few line demo
program that will crash when you copy the page out to a new file and
re-create links. It will succeed when the patch I suggested is applied.

Note that I stripped everything down to the bare bones - this code is not
useful for any particular purpose other than to demonstrate the bug. My
guess is that most folks use PdfCopy or PdfSmartCopy for operations like
this, so perhaps that's why nobody has run into this before. It is not clear
to me whether the problem is purely Annotation related - I suspect that this
could happen during other operations as well.

Upon further testing, I noticed is that the patch I suggested creates a
reference to a non-existent object, but Acrobat doesn't care as the parent
reference is redundant, but it may cause problems for other tools/parsers.
This makes me believe that there is a better way to fix the problem although
we are getting by at the moment.

Any feedback would be greatly appreciated.

Thanks - Gylfi

-Original Message-
From: Paulo Soares [mailto:psoa...@glintt.com]
Sent: Wednesday, August 04, 2010 12:36 PM
To: Post all your questions about iText here
Subject: Re: [iText-questions] Null pointer exception in PdfWriter

This area was extensively changed in 5.0.3 (when it's out this weekend but
you can get it from the SVN), it would be worth to see if the problem is
already fixed.

Paulo 

-Original Message-
From: Gylfi Ingvason [mailto:gylfi.ingva...@solimarsystems.com]
Sent: Wednesday, August 04, 2010 4:52 PM
To: itext-questions@lists.sourceforge.net
Subject: [iText-questions] Null pointer exception in PdfWriter

Gents,

I'm using an older version of iTextSharp (4.1.6 equivalent), and recently
ran into a null pointer exception in PdfWriter while splitting a PDF file.
Never seen this before despite running all kinds of data for years. The
error happens on the PdfDocument Close() call, that leads to a
RotateAnnotations call, that calls writer.AddToBody, and eventually
GetNewObjectNumber in the PdfWriter is called and that method looks like
this:

protected internal virtual int GetNewObjectNumber(PdfReader reader, int
number, int generation) {
return currentPdfReaderInstance.GetNewObjectNumber(number, generation);
}

At the time the call is made, the currentPdfReaderInstance is null causing
the exception. I looked at the code in the repository for the latest, and
this method has not changed. I patched the code to check for null as such:

protected internal virtual int GetNewObjectNumber(PdfReader reader, int
number, int generation) {

if (currentPdfReaderInstance == null) {
currentPdfReaderInstance = reader.GetPdfReaderInstance(this);
}

return currentPdfReaderInstance.GetNewObjectNumber(number, generation);
}

This creates proper output. My question is, is this an acceptable patch or
should this be handled differently? Furthermore, it worries me that this has
not come up before - is it normal that the currentPdfReaderInstance is null
under these circumstances? I have not tried this under 5.0.2 but I suspect
that the same thing will happen - would it make sense to patch the latest?

Any feedback would be appreciated.

Thanks - Gylfi


Aviso Legal:

Esta mensagem i destinada exclusivamente ao destinatario. Pode conter
informagco confidencial ou legalmente protegida. A incorrecta transmissco
desta mensagem nco 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. I proibido a qualquer pessoa que nco o
destinatario 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 

Re: [iText-questions] Null pointer exception in PdfWriter

2010-08-06 Thread Paulo Soares
Thank you.

Paulo 

-Original Message-
From: Gylfi Ingvason [mailto:gylfi.ingva...@solimarsystems.com] 
Sent: Friday, August 06, 2010 4:26 PM
To: itext-questions@lists.sourceforge.net
Subject: Re: [iText-questions] Null pointer exception in PdfWriter


Here's a corrected (or at least improved) patch - this resolves the indirect
reference to the correct object and does not create an unused entry in the
Xref:

protected internal virtual int GetNewObjectNumber(PdfReader reader, int
number, int generation) {

  if (currentPdfReaderInstance == null) {
currentPdfReaderInstance = GetPdfReaderInstance(reader);
  }
  return currentPdfReaderInstance.GetNewObjectNumber(number, generation);
}

Gylfi

-Original Message-
From: Gylfi Ingvason [mailto:gylfi.ingva...@solimarsystems.com] 
Sent: Thursday, August 05, 2010 3:59 PM
To: 'Post all your questions about iText here'
Subject: RE: [iText-questions] Null pointer exception in PdfWriter

Thanks Paulo.

I downloaded and built the SVN tip and was able to reproduce the problem.
The gist of it is that if you use PdfWriter to import a page and re-create
link annotations, and those annotations contain indirect references (such as
a Parent, i.e. /P 8 0 R), you get the exception. Enclosed is a PDF file
that I clobbered together with such a link, along with a few line demo
program that will crash when you copy the page out to a new file and
re-create links. It will succeed when the patch I suggested is applied.

Note that I stripped everything down to the bare bones - this code is not
useful for any particular purpose other than to demonstrate the bug. My
guess is that most folks use PdfCopy or PdfSmartCopy for operations like
this, so perhaps that's why nobody has run into this before. It is not clear
to me whether the problem is purely Annotation related - I suspect that this
could happen during other operations as well.

Upon further testing, I noticed is that the patch I suggested creates a
reference to a non-existent object, but Acrobat doesn't care as the parent
reference is redundant, but it may cause problems for other tools/parsers.
This makes me believe that there is a better way to fix the problem although
we are getting by at the moment.

Any feedback would be greatly appreciated.

Thanks - Gylfi

-Original Message-
From: Paulo Soares [mailto:psoa...@glintt.com]
Sent: Wednesday, August 04, 2010 12:36 PM
To: Post all your questions about iText here
Subject: Re: [iText-questions] Null pointer exception in PdfWriter

This area was extensively changed in 5.0.3 (when it's out this weekend but
you can get it from the SVN), it would be worth to see if the problem is
already fixed.

Paulo 

-Original Message-
From: Gylfi Ingvason [mailto:gylfi.ingva...@solimarsystems.com]
Sent: Wednesday, August 04, 2010 4:52 PM
To: itext-questions@lists.sourceforge.net
Subject: [iText-questions] Null pointer exception in PdfWriter

Gents,

I'm using an older version of iTextSharp (4.1.6 equivalent), and recently
ran into a null pointer exception in PdfWriter while splitting a PDF file.
Never seen this before despite running all kinds of data for years. The
error happens on the PdfDocument Close() call, that leads to a
RotateAnnotations call, that calls writer.AddToBody, and eventually
GetNewObjectNumber in the PdfWriter is called and that method looks like
this:

protected internal virtual int GetNewObjectNumber(PdfReader reader, int
number, int generation) {
return currentPdfReaderInstance.GetNewObjectNumber(number, generation);
}

At the time the call is made, the currentPdfReaderInstance is null causing
the exception. I looked at the code in the repository for the latest, and
this method has not changed. I patched the code to check for null as such:

protected internal virtual int GetNewObjectNumber(PdfReader reader, int
number, int generation) {

if (currentPdfReaderInstance == null) {
currentPdfReaderInstance = reader.GetPdfReaderInstance(this);
}

return currentPdfReaderInstance.GetNewObjectNumber(number, generation);
}

This creates proper output. My question is, is this an acceptable patch or
should this be handled differently? Furthermore, it worries me that this has
not come up before - is it normal that the currentPdfReaderInstance is null
under these circumstances? I have not tried this under 5.0.2 but I suspect
that the same thing will happen - would it make sense to patch the latest?

Any feedback would be appreciated.

Thanks - Gylfi


Aviso Legal:

Esta mensagem i destinada exclusivamente ao destinatario. Pode conter
informagco confidencial ou legalmente protegida. A incorrecta transmissco
desta mensagem nco 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. I proibido a qualquer pessoa que nco o
destinatario de usar, revelar ou distribuir qualquer parte desta mensagem. 



Disclaimer:

This message is 

Re: [iText-questions] missing line space in Text field while merging multiple PDF's using PDFCopy of IText

2010-08-06 Thread Paulo Soares
No pictures are present but in any case I have to look at the pdfs.

Paulo


From: shivananda22 [mailto:sivananda.mylar...@mphasis.com]
Sent: Friday, August 06, 2010 7:51 AM
To: itext-questions@lists.sourceforge.net
Subject: Re: [iText-questions] missing line space in Text field while merging 
multiple PDF's using PDFCopy of IText

Paulo,
Thanks for the reply.
Due to some security reasons I am not able to attach the PDF files, but I can 
show you the screen shots of the two files.
Screen shot for the single PDF.

Screen shot for merged files

For the both scenarios I am using the same template but the line spacing is 
differing. Could you please help me out on this?
Regards,
Shiv

From: Paulo Soares-3 [via iText - General] [mailto:[hidden 
email]/user/SendEmail.jtp?type=nodenode=2315963i=0]
Sent: Thursday, August 05, 2010 8:41 PM
To: Sivananda Mylarapu
Subject: Re: missing line space in Text field while merging multiple PDF's 
using PDFCopy of IText
I never saw that happening. It would help to see the individual pdf and the 
merged one.

Paulo

-Original Message-
From: shivananda22 [mailto:[hidden 
email]/user/SendEmail.jtp?type=nodenode=2314995i=0by-user=t]
Sent: Thursday, August 05, 2010 1:51 PM
To: [hidden email]/user/SendEmail.jtp?type=nodenode=2314995i=1by-user=t
Subject: [iText-questions] missing line space in Text field while merging 
multiple PDF's using PDFCopy of IText


Hi,

I am using  IText to fill the values in Designer created PDF using IText
AcroFields along with this I am using PDFCopy of Itext to merge the same pdf
file for 3 times with different data. The issue is I am having text field in
the pdf where it will accept multiple lines and I had given 8 inches as the
line spacing between the lines. When i create a single pdf( i.e. filling
values in the form and creating a new file) the line spacing is the same as
what  I had given but when I try to merge the three files the line spacing
in the Text Field is getting increased and my data is over flowing. I am
merging the files using PDFCopy.

My code will looks like the following



FileOutputStream os = new FileOutputStream(template.pdf);
Document document = new Document();
PdfCopy copy = new PdfCopy(document, os);
document.open();

for (int i =0;i3;i++) {
// create the reader by passing the AWB PDF template
PdfReader reader = new PdfReader(template.pdf);
FileOutputStream baos = new 
FileOutputStream(result.pdf);
// create the stamper
PdfStamper pdfStamper = new PdfStamper(reader, baos);
pdfStamper.setFormFlattening(true);
pdfStamper.setFreeTextFlattening(true);
pdfStamper.setFullCompression();
// retrieve the form fields
AcroFields pdfForm = pdfStamper.getAcroFields();
// fill the form with the appropriate values

// This method will fill up the form values
setFormValues(pdfForm);

pdfStamper.setFormFlattening(true);
pdfStamper.close();
reader = new PdfReader(result.pdf);
// add the first page of the reader to the copy
copy.addPage(copy.getImportedPage(reader, 1));
reader.close();
baos.close();
}
copy.flush();
document.close();
copy.close();





Could any one please tell me what is the reason for increasing line space
between the lines in Text fields


Thanks
Shiv


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.



--
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring 

[iText-questions] How to get the layout right - text / images / text / images - tables vs. paragraphs

2010-08-06 Thread Rune Hellem
Hi

I've just started using iText for my own personal project where I am
exporting my blog to PDF. Each blog post have some text and one or more
images in no particular order, it might alternate. I have tried to modify
some of the examples I have found and now managed to create a pdf with text
and images using a Paragraph for each post.

My problem is that I'm not able to get the text and pictures out in the
exact order, if the picture is about to be printed at the end of a page and
there is no space for it, sometimes the next text is written instead and
then on the next page I get two pictures in a row. Not what I wanted.

I do not post any code along with this, since my intention now is just to
get a hint of what would be considered best practice when working with text
and pictures like this. I do not want the text to float around the pictures
since I have no ways to know which part of the text in the blog post is
belonging to which picture. I have not yet found any examples on how to
guarantee the order printed to the pdf, but my quess is that I maybe should
use a table to get more control over the flow of text and pictures across
pages?

In advance

Rune

-- 

Bored? Check out http://hellem.org/blog

--
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev ___
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.itextpdf.com/book/
Check the site with examples before you ask questions: 
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/

Re: [iText-questions] Removing date changing language in digital signature

2010-08-06 Thread Bradock

Perfect ... this library works much better than AbcPDF, at least in digital
signature...
Thanks!


-- 
View this message in context: 
http://itext-general.2136553.n4.nabble.com/Removing-date-changing-language-in-digital-signature-tp2168865p2316259.html
Sent from the iText - General mailing list archive at Nabble.com.

--
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
___
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.itextpdf.com/book/
Check the site with examples before you ask questions: 
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/