[iText-questions] Strange behavior of Textfield - DefaultText

2009-11-16 Thread Jan Meinecke
Hello!

I searched the archieve, but i can´t find anything about my problem...so i try 
this way now...
Hope someone can help me.
I am using the 2.1.7 Version of the itext Package in an Eclipse 3.2 env.
And i am writing Textfields (com.lowagie.text.pdf) to an existing PDF File.
All is working fine...till i am using the TextField.setDefaultText function.
It seems to work well...but it the result is strange.
It write´s the defined text into the DefaultText Field inside the PDF 
Textfield...but the inserted Defaulttext Value is not Displayed on the PDF like 
it does if i type something in by myself.
I tried to find a difference in the PDF Files, but i can´t...
Than i compared the files in an editor and found a different strucktur in the 
itext created Value.

itext created:
41 0 obj/P 11 0 R/Type/Annot/F 4/AP/N 2 0 
R/V()/Subtype/Widget/DV(inserted 
Text)/TU(L_F_Ausfertigung)/T(L_F_Ausfertigung)/BS/S/S/W 1/Ff 0/Rect[7.04 
351.02 29.78 535.95]/DR/Font/HeBo 80 0 R/DA(/HeBo 10 Tf 0 g )/MK/R 
90/MaxLen 255/FT/Tx

Manuel created:
41 0 obj/AP/N 94 0 R/BS/S/S/W 1/DA(/HeBo 12 Tf 0 g )/DR/Font/HeBo 
79 0 R/DV(inserted Text)/F 4/FT/Tx/Ff 0/MaxLen 255/P 10 0 R/Rect[7.04 
351.02 29.78 
535.95]/Subtype/Widget/T(L_F_Ausfertigung)/TU(L_F_Ausfertigung)/Type/Annot/V(BlaBlubb)
endobj

Is there anyone out there who have a clue?

Thx in advance
-- 
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
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] FYI: Lowagie/iText in Action, 2nd Edition - your first review has started

2009-11-16 Thread Leo
Dear Bruno,
a couple of weeks ago, I sent to you my contributions to iText (about char 
tracking) and the signed iCLA.
Do you think I should be a reviewer?
Tks

Leonardo


- Original Message - 
From: Bruno Lowagie br...@lowagie.com
To: Post all your questions about iText here 
itext-questions@lists.sourceforge.net
Sent: Saturday, November 14, 2009 9:04 AM
Subject: [iText-questions] FYI: Lowagie/iText in Action, 2nd Edition - your 
first review has started


 Manning Publications Co. wrote:
 Bruno,

 I sent your manuscript out for review, and asked the reviewers to be
 completed by Monday, November 23rd.   I included the questions and the
 reviewers that you suggested.

 If you think you should have been on the list,
 and you didn't receive a mail from Manning,
 please let me know (privately).

 Note that the number of reviewers is limited.
 If I select you as a reviewer, I'll keep your
 coordinates for the next review round.

 best regards,
 Bruno

 --
 Let Crystal Reports handle the reporting - Free Crystal Reports 2008 
 30-Day
 trial. Simplify your report design, integration and deployment - and focus 
 on
 what you do best, core application coding. Discover what's new with
 Crystal Reports now.  http://p.sf.net/sfu/bobj-july
 ___
 iText-questions mailing list
 iText-questions@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/itext-questions

 Buy the iText book: http://www.1t3xt.com/docs/book.php
 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/
 



--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
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] Right to left run direction

2009-11-16 Thread Eric Summkeller
 Yes, only ColumnText and PdfPCell (using a ColumnText object internally) 
 support R2L (Hebrew and Arabic).

Thanks! Sorry but I have a second question. For PdfPCell everything is OK. My
problem for ColumnText is, that I don't know the coordinates in the page. Each
ColumnText object should be added like a Paragraph. A PdfPCell is automatically
added at the correct position. Is there a same possibility to add a ColumnText
without using the setSimpleColumn(...) method? At the moment I put the Paragraph
into a PdfPCell without borders. Then each Paragraph is added successively at
the correct position.




--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
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/


[iText-questions] Chapter objects inside a cell table.

2009-11-16 Thread lester fajardo
Hello.

Is posible to put a chapter object inside a table cell ?, when i create a
chapter object and then put it inside a cell, the cell is left empty and
also the chapter is not shown in the bookmarks section.

iTextSharp.text.Chapter chapter1 = new Chapter(new Paragraph( Hello ,
FontFactory.GetFont(FontFactory.HELVETICA, 9, iTextSharp.text.Font.BOLD)),
1);

iTextSharp.text.Cell cx = new iTextSharp.text.Cell(chapter1);

aTable.AddCell( cx);
--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july___
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
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] Right to left run direction

2009-11-16 Thread 1T3XT info
Eric Summkeller wrote:
 Yes, only ColumnText and PdfPCell (using a ColumnText object internally) 
 support R2L (Hebrew and Arabic).
 
 Thanks! Sorry but I have a second question. For PdfPCell everything is OK. My
 problem for ColumnText is, that I don't know the coordinates in the page. Each
 ColumnText object should be added like a Paragraph. A PdfPCell is 
 automatically
 added at the correct position. Is there a same possibility to add a ColumnText
 without using the setSimpleColumn(...) method? At the moment I put the 
 Paragraph
 into a PdfPCell without borders. Then each Paragraph is added successively at
 the correct position.

A PdfPCell uses a ColumnText object to draw its content to the page,
so YES, it's possible to achieve what you want with ColumnText.
The question is: why would you do that if it works using PdfPCell?
You'll need more lines of code (and you'll risk making more errors).

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
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] Chapter objects inside a cell table.

2009-11-16 Thread 1T3XT info
lester fajardo wrote:
 Hello.
 
 Is posible to put a chapter object inside a table cell ?

No no no no no no no! Bad practice, bad idea.
There is no reason whatsoever why you'd want to do that.

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
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/


[iText-questions] HTMLWorker - Problems with Rowspan

2009-11-16 Thread fabripautasso

I have problems to print an html table. The problem is that the iText Class
HTMLWorker doesn´t recognize the rowspan atribute of the td elements. 
Can somebody help me?
-- 
View this message in context: 
http://old.nabble.com/HTMLWorker---Problems-with-Rowspan-tp26372248p26372248.html
Sent from the iText - General mailing list archive at Nabble.com.


--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
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] Chapter objects inside a cell table.

2009-11-16 Thread lester fajardo
And what could be a better idea ?

i explain, i have a table with a index of words that exists in a doc, and i
want to have a chapter/outline or whatever linked to each start of a char.

e.g.

(page 1)

cell | A - i want a chapter, outline, etc
poiting to this cell value
cell | Alabama  1,90 .
cell | Amazon 2,40 ..
cell | 

(page 3)
cell | B  - i want a chapter, outline, etc poiting
to this cell value
cell | Butterfly 4,70
cell |
cell |




On Mon, Nov 16, 2009 at 4:07 PM, 1T3XT info i...@1t3xt.info wrote:

 lester fajardo wrote:
  Hello.
 
  Is posible to put a chapter object inside a table cell ?

 No no no no no no no! Bad practice, bad idea.
 There is no reason whatsoever why you'd want to do that.


 --
 Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
 trial. Simplify your report design, integration and deployment - and focus
 on
 what you do best, core application coding. Discover what's new with
 Crystal Reports now.  http://p.sf.net/sfu/bobj-july
 ___
 iText-questions mailing list
 iText-questions@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/itext-questions

 Buy the iText book: http://www.1t3xt.com/docs/book.php
 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/

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july___
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
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] Chapter objects inside a cell table.

2009-11-16 Thread 1T3XT info
lester fajardo wrote:
 And what could be a better idea ?
 
 i explain, i have a table with a index of words that exists in a doc, 
 and i want to have a chapter/outline or whatever linked to each start of 
 a char.

As I've said before: create you bookmarks using PdfOutline!

PdfOutline needs a PdfDestination (that is: coordinates). You can get 
the coordinates to create the destination through a CellEvent, or, if 
you wrap A, B, C,... in Chunks, using the page event onGenericTag().

This is explained in great detail in the book. This mailing list assumes 
that you have the book. If not: there's no such thing as a free lunch.
-- 
This answer is provided by 1T3XT BVBA
http://www.1t3xt.com/ - http://www.1t3xt.info

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
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] Strange behavior of Textfield - DefaultText

2009-11-16 Thread Mark Storer
Allow me to pick out the important bits there.
 itext created:
 41 0 obj/V()DV(inserted Text) endobj

Empty /V.  Kinda like MTV, only with more music videos.  Grrr.

(way the heck off topic:  Does anyone else remember the old MTV commercials 
where some guy was watching MTV and a woman off camera asks him to take out the 
trash?  He responds As soon as this show is over BECAUSE they didn't have 
shows... just an endless stream of Music Videos (thus the name you 
reality-tv-spewing wastes of oxygen!)

We now return you to your regularly scheduled answer.

 Manuel created:
 41 0 obj/DV(inserted Text)/V(BlaBlubb) endobj

The default value (/DV) only matters when you reset the form.  I suspect the 
value (/V) is what you're after.

--Mark Storer 
  Senior Software Engineer 
  Cardiff.com

#include disclaimer 
typedef std::DisclaimerCardiff DisCard; 



 -Original Message-
 From: Jan Meinecke [mailto:darkw...@gmx.li]
 Sent: Monday, November 16, 2009 1:11 AM
 To: itext-questions@lists.sourceforge.net
 Subject: [iText-questions] Strange behavior of Textfield - 
 DefaultText
 
 
 Hello!
 
 I searched the archieve, but i can´t find anything about my 
 problem...so i try this way now...
 Hope someone can help me.
 I am using the 2.1.7 Version of the itext Package in an 
 Eclipse 3.2 env.
 And i am writing Textfields (com.lowagie.text.pdf) to an 
 existing PDF File.
 All is working fine...till i am using the 
 TextField.setDefaultText function.
 It seems to work well...but it the result is strange.
 It write´s the defined text into the DefaultText Field 
 inside the PDF Textfield...but the inserted Defaulttext Value 
 is not Displayed on the PDF like it does if i type something 
 in by myself.
 I tried to find a difference in the PDF Files, but i can´t...
 Than i compared the files in an editor and found a different 
 strucktur in the itext created Value.
 
 itext created:
 41 0 obj/P 11 0 R/Type/Annot/F 4/AP/N 2 0 
 R/V()/Subtype/Widget/DV(inserted 
 Text)/TU(L_F_Ausfertigung)/T(L_F_Ausfertigung)/BS/S/S/W 
 1/Ff 0/Rect[7.04 351.02 29.78 535.95]/DR/Font/HeBo 80 0 
 R/DA(/HeBo 10 Tf 0 g )/MK/R 90/MaxLen 255/FT/Tx
 
 Manuel created:
 41 0 obj/AP/N 94 0 R/BS/S/S/W 1/DA(/HeBo 12 Tf 0 g 
 )/DR/Font/HeBo 79 0 R/DV(inserted Text)/F 4/FT/Tx/Ff 
 0/MaxLen 255/P 10 0 R/Rect[7.04 351.02 29.78 
 535.95]/Subtype/Widget/T(L_F_Ausfertigung)/TU(L_F_Ausfertigung
 )/Type/Annot/V(BlaBlubb)
 endobj
 
 Is there anyone out there who have a clue?
 
 Thx in advance
 -- 
 GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
 Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
 
 --
 
 Let Crystal Reports handle the reporting - Free Crystal 
 Reports 2008 30-Day 
 trial. Simplify your report design, integration and 
 deployment - and focus on 
 what you do best, core application coding. Discover what's new with
 Crystal Reports now.  http://p.sf.net/sfu/bobj-july
 ___
 iText-questions mailing list
 iText-questions@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/itext-questions
 
 Buy the iText book: http://www.1t3xt.com/docs/book.php
 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/


--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
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] HTMLWorker - Problems with Rowspan

2009-11-16 Thread 1T3XT info
fabripautasso wrote:
 I have problems to print an html table. The problem is that the iText Class
 HTMLWorker doesn´t recognize the rowspan atribute of the td elements. 
 Can somebody help me?

HTMLWorker predates rowspan support. Support for rowspan in HTMLWorker 
would involve further development. You can fund this development if 
that's what you meant with your question.
-- 
This answer is provided by 1T3XT BVBA
http://www.1t3xt.com/ - http://www.1t3xt.info

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
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] Root Object is invalid or missing after PDF is manipulated with iTextSharp

2009-11-16 Thread subrah

Hi All,

I am wondering why nobody is interested in responding to my question? I seem
to have found a fix but just wanted to confirm with experts on this forum.
So any help is greatly appreciated.

Thanks
Subrah



subrah wrote:
 
 Hi
 Sorry resending this post as i was not registered user earlier.
 
  i am using latest iTextSharp library to edit the pdf documents to put the
 water marking digitallly (hidden). So when i researched i found that i can
 add a annotation to the pdf document and then set the flags to
 annotation.Flags = PdfAnnotation.FLAGS_NOVIEW |
 PdfAnnotation.FLAGS_INVISIBLE | PdfAnnotation.FLAGS_HIDDEN; to make it
 invisible.
 
 so this is working fine as expected 90% of the time. Remaning 10 % of the
 time i get an error when i open the document after adding the annotation
 it says Root object is invalid or missing
 
 so looks like it corrupted the file trying to add the annoation. do you
 have any suggestion? i can share the code i am using to add the annotation
 if that helps. 
 
 Full code
 public static byte[] EditPdf(string sourceFile, string visibleWaterMark,
 string digitalWaterMark)
 {
 PdfReader reader = new PdfReader(sourceFile);
 using (MemoryStream memoryStream = new MemoryStream())
 {
 PdfStamper pdfStamper = new PdfStamper(reader,
 memoryStream);
 // process every page in the pdf file
 for (int i = 1; i = reader.NumberOfPages; i++)
 {
 Rectangle pageSize =
 reader.GetPageSizeWithRotation(i);
 PdfContentByte pdfPageContents =
 pdfStamper.GetUnderContent(i);
 PdfAnnotation annotation =
 PdfAnnotation.CreateText(pdfStamper.Writer, new Rectangle(200f, 400f,
 300f, 500f), digitalWaterMark,
 Street Events Digital Watermark,
 false, Key);
 //digital water marking 
 annotation.Flags = PdfAnnotation.FLAGS_NOVIEW |
 PdfAnnotation.FLAGS_INVISIBLE | PdfAnnotation.FLAGS_HIDDEN;
 pdfStamper.AddAnnotation(annotation, i);
 pdfPageContents.BeginText();
 BaseFont baseFont =
 BaseFont.CreateFont(BaseFont.HELVETICA_BOLD, Encoding.ASCII.EncodingName,
 BaseFont.NOT_EMBEDDED);
 pdfPageContents.SetFontAndSize(baseFont, 10);
 pdfPageContents.SetRGBColorFill(225, 224, 223);
 // visible water marking

 pdfPageContents.ShowTextAligned(PdfContentByte.ALIGN_RIGHT,
 visibleWaterMark,
  pageSize.Width - 50,
  pageSize.Height - 15,
  0);
 pdfPageContents.EndText();
 pdfStamper.FormFlattening = true;
 
 }
 
 pdfStamper.Close();
 return memoryStream.ToArray();
 }
 
 
 
  public static void SaveFile(string fileHandle, byte[] fileBytes)
 {
 using(FileStream fs = new FileStream(fileHandle,
 FileMode.Create))
 {
 fs.Write(fileBytes, 0, fileBytes.Length);
 fs.Flush();
 fs.Close();
 }

 }
 
 //call
  FileInfo pdfFileInfo = new FileInfo(newFilePath);
 byte[] fileBytes = PdfWaterMarker.EditPdf(pdfFileInfo,
 string.Format(Client Id: {0}, clientSite.ClientId));
 PdfWaterMarker.SaveFile(newFilePath, fileBytes);
 
 please let me know
 Thanks
 Subrah 
 
 

-- 
View this message in context: 
http://old.nabble.com/Root-Object-is-invalid-or-missing-after-PDF-is-manipulated-with-iTextSharp-tp26305073p26375297.html
Sent from the iText - General mailing list archive at Nabble.com.


--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
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] Detecting a blank page in a pdf created using FOP 0.95

2009-11-16 Thread Mark Storer
What is in the buffer with 0.95?  I suspect its a nearly static string.  
Something like paint the page white, set the stroke and fill color to our 
internal defaults... that sort of thing.  The paint the page white section 
will vary based on the size of the page in question, but some RegEx-fu would 
clear that right up.

If you want to get fancy and be Technically Correct (and burn an extra 5-10 
hours climbing a learning curve), you could use 
com.lowagie.text.pdf.PdfContentParser (or a derivative of 
*.pdf.parser.PdfContentProcessor) to look for commands that Actually Draw 
Something... there are quite a few.  Even then, you might still incorrectly 
identify a blank page.  For example, if there's a clipping region, and 
everything is drawn outside it:
A: Bad PDF producer.  Bad!  No biscuit!
B: This technique would miss it.


--Mark Storer 
  Senior Software Engineer 
  Cardiff.com

#include disclaimer 
typedef std::DisclaimerCardiff DisCard; 



 -Original Message-
 From: mcgm [mailto:mcgm200...@yahoo.es]
 Sent: Sunday, November 15, 2009 10:27 PM
 To: itext-questions@lists.sourceforge.net
 Subject: [iText-questions] Detecting a blank page in a pdf 
 created using
 FOP 0.95
 
 
 
 Hello!!
 
 We use FOP-0.95 to generate pdf and then treat them with 
 itext to place a
 watermark. We have some blank pages which should not carry 
 watermarks and
 need to know how to distinguish the blank pages of those 
 which have real
 content.
 
 We tested a solution that was proposed at the forum, checking 
 the internal
 buffer size. It worked with older versions of FOP but not with 0.95.
 
 Thanks in advance!!!
 -- 
 View this message in context: 
 http://old.nabble.com/Detecting-a-blank-page-in-a-pdf-created-
using-FOP-0.95-tp26333484p26333484.html
Sent from the iText - General mailing list archive at Nabble.com.


--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
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/


--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
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] Root Object is invalid or missing after PDF is manipulated with iTextSharp

2009-11-16 Thread Mark Storer
A: Most of the folks on the list lean toward Java.
B: If no one knows the answer, no one answers.

Perhaps you could post one of your corrupted PDFs?

--Mark Storer 
  Senior Software Engineer 
  Cardiff.com

#include disclaimer 
typedef std::DisclaimerCardiff DisCard; 



 -Original Message-
 From: subrah [mailto:subnibh...@gmail.com]
 Sent: Monday, November 16, 2009 8:50 AM
 To: itext-questions@lists.sourceforge.net
 Subject: Re: [iText-questions] Root Object is invalid or missing after
 PDF is manipulated with iTextSharp
 
 
 
 Hi All,
 
 I am wondering why nobody is interested in responding to my 
 question? I seem
 to have found a fix but just wanted to confirm with experts 
 on this forum.
 So any help is greatly appreciated.
 
 Thanks
 Subrah
 
 
 
 subrah wrote:
  
  Hi
  Sorry resending this post as i was not registered user earlier.
  
   i am using latest iTextSharp library to edit the pdf 
 documents to put the
  water marking digitallly (hidden). So when i researched i 
 found that i can
  add a annotation to the pdf document and then set the flags to
  annotation.Flags = PdfAnnotation.FLAGS_NOVIEW |
  PdfAnnotation.FLAGS_INVISIBLE | PdfAnnotation.FLAGS_HIDDEN; 
 to make it
  invisible.
  
  so this is working fine as expected 90% of the time. 
 Remaning 10 % of the
  time i get an error when i open the document after adding 
 the annotation
  it says Root object is invalid or missing
  
  so looks like it corrupted the file trying to add the 
 annoation. do you
  have any suggestion? i can share the code i am using to add 
 the annotation
  if that helps. 
  
  Full code
  public static byte[] EditPdf(string sourceFile, string 
 visibleWaterMark,
  string digitalWaterMark)
  {
  PdfReader reader = new PdfReader(sourceFile);
  using (MemoryStream memoryStream = new MemoryStream())
  {
  PdfStamper pdfStamper = new PdfStamper(reader,
  memoryStream);
  // process every page in the pdf file
  for (int i = 1; i = reader.NumberOfPages; i++)
  {
  Rectangle pageSize =
  reader.GetPageSizeWithRotation(i);
  PdfContentByte pdfPageContents =
  pdfStamper.GetUnderContent(i);
  PdfAnnotation annotation =
  PdfAnnotation.CreateText(pdfStamper.Writer, new 
 Rectangle(200f, 400f,
  300f, 500f), digitalWaterMark,
  Street Events 
 Digital Watermark,
  false, Key);
  //digital water marking 
  annotation.Flags = PdfAnnotation.FLAGS_NOVIEW |
  PdfAnnotation.FLAGS_INVISIBLE | PdfAnnotation.FLAGS_HIDDEN;
  pdfStamper.AddAnnotation(annotation, i);
  pdfPageContents.BeginText();
  BaseFont baseFont =
  BaseFont.CreateFont(BaseFont.HELVETICA_BOLD, 
 Encoding.ASCII.EncodingName,
  BaseFont.NOT_EMBEDDED);
  pdfPageContents.SetFontAndSize(baseFont, 10);
  pdfPageContents.SetRGBColorFill(225, 224, 223);
  // visible water marking
 
  pdfPageContents.ShowTextAligned(PdfContentByte.ALIGN_RIGHT,
  visibleWaterMark,
   
 pageSize.Width - 50,
   
 pageSize.Height - 15,
   0);
  pdfPageContents.EndText();
  pdfStamper.FormFlattening = true;
  
  }
  
  pdfStamper.Close();
  return memoryStream.ToArray();
  }
  
  
  
   public static void SaveFile(string fileHandle, byte[] fileBytes)
  {
  using(FileStream fs = new FileStream(fileHandle,
  FileMode.Create))
  {
  fs.Write(fileBytes, 0, fileBytes.Length);
  fs.Flush();
  fs.Close();
  }
 
  }
  
  //call
   FileInfo pdfFileInfo = new FileInfo(newFilePath);
  byte[] fileBytes = PdfWaterMarker.EditPdf(pdfFileInfo,
  string.Format(Client Id: {0}, clientSite.ClientId));
  PdfWaterMarker.SaveFile(newFilePath, fileBytes);
  
  please let me know
  Thanks
  Subrah 
  
  
 
 -- 
 View this message in context: 
 http://old.nabble.com/Root-Object-is-invalid-or-missing-after-
PDF-is-manipulated-with-iTextSharp-tp26305073p26375297.html
Sent from the iText - General mailing list archive at Nabble.com.


--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
iText-questions mailing list

Re: [iText-questions] Root Object is invalid or missing after PDF is manipulated with iTextSharp

2009-11-16 Thread 1T3XT info
Mark Storer wrote:
 A: Most of the folks on the list lean toward Java.
 B: If no one knows the answer, no one answers.

C: I've created thousands of PDFs using iText,
and I've never had an invalid or missing root object.
I also couldn't reproduce the problem in Java,
and it's not my problem if I can't reproduce a problem.
-- 
This answer is provided by 1T3XT BVBA
http://www.1t3xt.com/ - http://www.1t3xt.info

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
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/


[iText-questions] GetPdfLayers method for Stamper yields Error message on outputted PDF

2009-11-16 Thread Jty

hello all - again,

i have a small number of PDFs (see attached) that dont play well with
iTextSharp.  when i open my outputted file get the error message: There was
an error processing a page.  There was a problem reading this document
(18).

if i comment out the stampers GetPdfLayers method, OR the stampers SetField
method contained in my loop everything works fine.  but when used in unison
i get the error above.

thanks for the help,  here is my code

Jason

http://old.nabble.com/file/p26376799/Error18.pdf Error18.pdf 
http://old.nabble.com/file/p26376799/Error18.fdf Error18.fdf 

Private Sub OutputForm()
Dim iTextReader As PdfReader
Dim iTextStamper As PdfStamper
Dim iTextWriter As PdfWriter
Dim iTextDoc As Document
Dim iTextImage As Image
Dim iTextPage As PdfImportedPage
Dim iTextFDF As FdfReader
Dim memStm As New MemoryStream
Dim iPage As Integer
Dim sStream, sValue As String
Dim htFields As New Hashtable
Dim enField As IDictionaryEnumerator
Dim iTextByte As Byte()
Dim aEnc As New System.Text.ASCIIEncoding

Try
Dim sPDF As String = C:\error18.pdf

'Read PDF  FDF into memory
iTextReader = New PdfReader(sPDF)
iTextFDF = New FdfReader(sPDF.Replace(.pdf, .fdf))
iTextStamper = New PdfStamper(iTextReader, memStm)
iTextReader.Close()

'Watermark Code
If iTextStamper.GetPdfLayers.Contains(SEAS Draft Watermark)
Then
'For iPage = 1 To iTextStamper.Reader.NumberOfPages
'iTextByte =
iTextStamper.Reader.GetPageContent(iPage)
'sStream = aEnc.GetString(iTextByte)
'sStream = sStream.Replace(DRAFT COPY, )
'iTextStamper.Reader.SetPageContent(iPage,
aEnc.GetBytes(sStream))
'Next
End If

'Field Code
htFields = iTextFDF.Fields
enField = htFields.GetEnumerator
While enField.MoveNext
sValue = iTextFDF.GetFieldValue(enField.Key.ToString)
If sValue.Length  0 Then
iTextStamper.AcroFields.SetField(enField.Key.ToString,
sValue)
End If
End While

iTextStamper.FormFlattening = True
iTextStamper.Close()

'Create/Open Writer
iTextReader = New PdfReader(memStm.ToArray)
iTextDoc = New Document(IIf(iTextReader.GetPageSize(1).Height 
iTextReader.GetPageSize(1).Width, iTextReader.GetPageSize(1).Rotate,
iTextReader.GetPageSize(1)), 0, 0, 0, 0)
iTextWriter = PdfWriter.GetInstance(iTextDoc, New
FileStream(c:\output.pdf, FileMode.Create))
iTextDoc.Open()

'Copy each page from Reader to Writer as image
For iPage = 1 To iTextReader.NumberOfPages
iTextPage = iTextWriter.GetImportedPage(iTextReader, iPage)
iTextImage = Image.GetInstance(iTextPage)
If iTextReader.GetPageSize(iPage).Height 
iTextReader.GetPageSize(iPage).Width Then
iTextImage.RotationDegrees = 90
End If
iTextDoc.Add(iTextImage)
Next
iTextDoc.Close()

Catch ex As Exception
System.Diagnostics.EventLog.WriteEntry(iText, ex.Source   
 ex.Message ex.StackTrace)
Finally
iTextReader = Nothing
iTextStamper = Nothing
iTextWriter = Nothing
iTextDoc = Nothing
iTextImage = Nothing
iTextPage = Nothing
iTextFDF = Nothing
iTextByte = Nothing
memStm.Flush()
memStm = Nothing
htFields = Nothing
aEnc = Nothing
End Try

MsgBox(Done)
End Sub
-- 
View this message in context: 
http://old.nabble.com/GetPdfLayers-method-for-Stamper-yields-Error-message-on-outputted-PDF-tp26376799p26376799.html
Sent from the iText - General mailing list archive at Nabble.com.


--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
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/


[iText-questions] iText in Action 2n Edition in MEAP (Free chapter!)

2009-11-16 Thread 1T3XT info
Hello all,

the first chapters of iText in Action - 2nd Edition are available
through Manning's Early Access Program.
Visit http://1t3xt.com/docs/book.php for more info.

You can download the draft version of Chapter 2 for free here:
http://www.manning.com/affiliate/idevaffiliate.php?id=223_212
In this chapter, you'll get an introduction to iText's basic
building blocks and learn how to create PDFs from a database.
-- 
This answer is provided by 1T3XT BVBA
http://www.1t3xt.com/ - http://www.1t3xt.info

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
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] Root Object is invalid or missing after PDF is manipulated with iTextSharp

2009-11-16 Thread subrah

Attached is the corrupt file.
 if i try to read the corrupted file using pdfreader i get the error message
saying start ref not found. But the issue is that problem is not
consistant. I am able to water mark the same original file 2nd time using
the same code. So it's like randomly some file is not fully written.

i am gussing this is because the pdfstamper is closing the memory stream
earlier than it should for some reason. However what i want to confirm is
that my understanding that the probelm is infact the memory stream is right
or not?. Because i have implmented alternative technique to compltely avoid
memory stream and pdf stamper but use pdfwriter and file stream which seem
to have fixed the issue in dev. But still need to get response from a heavy
testing team. Any light thrwon on this subject will be of great help to me.

Thanks
Subrah



Mark Storer-2 wrote:
 
 A: Most of the folks on the list lean toward Java.
 B: If no one knows the answer, no one answers.
 
 Perhaps you could post one of your corrupted PDFs?
 
 --Mark Storer 
   Senior Software Engineer 
   Cardiff.com
 
 #include disclaimer 
 typedef std::DisclaimerCardiff DisCard; 
 
 
 
 -Original Message-
 From: subrah [mailto:subnibh...@gmail.com]
 Sent: Monday, November 16, 2009 8:50 AM
 To: itext-questions@lists.sourceforge.net
 Subject: Re: [iText-questions] Root Object is invalid or missing after
 PDF is manipulated with iTextSharp
 
 
 
 Hi All,
 
 I am wondering why nobody is interested in responding to my 
 question? I seem
 to have found a fix but just wanted to confirm with experts 
 on this forum.
 So any help is greatly appreciated.
 
 Thanks
 Subrah
 
 
 
 subrah wrote:
  
  Hi
  Sorry resending this post as i was not registered user earlier.
  
   i am using latest iTextSharp library to edit the pdf 
 documents to put the
  water marking digitallly (hidden). So when i researched i 
 found that i can
  add a annotation to the pdf document and then set the flags to
  annotation.Flags = PdfAnnotation.FLAGS_NOVIEW |
  PdfAnnotation.FLAGS_INVISIBLE | PdfAnnotation.FLAGS_HIDDEN; 
 to make it
  invisible.
  
  so this is working fine as expected 90% of the time. 
 Remaning 10 % of the
  time i get an error when i open the document after adding 
 the annotation
  it says Root object is invalid or missing
  
  so looks like it corrupted the file trying to add the 
 annoation. do you
  have any suggestion? i can share the code i am using to add 
 the annotation
  if that helps. 
  
  Full code
  public static byte[] EditPdf(string sourceFile, string 
 visibleWaterMark,
  string digitalWaterMark)
  {
  PdfReader reader = new PdfReader(sourceFile);
  using (MemoryStream memoryStream = new MemoryStream())
  {
  PdfStamper pdfStamper = new PdfStamper(reader,
  memoryStream);
  // process every page in the pdf file
  for (int i = 1; i = reader.NumberOfPages; i++)
  {
  Rectangle pageSize =
  reader.GetPageSizeWithRotation(i);
  PdfContentByte pdfPageContents =
  pdfStamper.GetUnderContent(i);
  PdfAnnotation annotation =
  PdfAnnotation.CreateText(pdfStamper.Writer, new 
 Rectangle(200f, 400f,
  300f, 500f), digitalWaterMark,
  Street Events 
 Digital Watermark,
  false, Key);
  //digital water marking 
  annotation.Flags = PdfAnnotation.FLAGS_NOVIEW |
  PdfAnnotation.FLAGS_INVISIBLE | PdfAnnotation.FLAGS_HIDDEN;
  pdfStamper.AddAnnotation(annotation, i);
  pdfPageContents.BeginText();
  BaseFont baseFont =
  BaseFont.CreateFont(BaseFont.HELVETICA_BOLD, 
 Encoding.ASCII.EncodingName,
  BaseFont.NOT_EMBEDDED);
  pdfPageContents.SetFontAndSize(baseFont, 10);
  pdfPageContents.SetRGBColorFill(225, 224, 223);
  // visible water marking
 
  pdfPageContents.ShowTextAligned(PdfContentByte.ALIGN_RIGHT,
  visibleWaterMark,
   
 pageSize.Width - 50,
   
 pageSize.Height - 15,
   0);
  pdfPageContents.EndText();
  pdfStamper.FormFlattening = true;
  
  }
  
  pdfStamper.Close();
  return memoryStream.ToArray();
  }
  
  
  
   public static void SaveFile(string fileHandle, byte[] fileBytes)
  {
  using(FileStream fs = new FileStream(fileHandle,
  FileMode.Create))
  {
  fs.Write(fileBytes, 0, fileBytes.Length);
  fs.Flush();
  fs.Close();
  }
 
  }
  
  //call
   FileInfo pdfFileInfo = new 

Re: [iText-questions] Problem in nesting of lists in RTF?

2009-11-16 Thread mister bean

iText is about to move the RTF functionality to an incubator and deprecate
this functionality. Unless someone can provide the answer on this list (and
even if they do), you might want to consider other options for RTF
generation.

Best wishes,

---mr. bean

 re 



Chris von See wrote:
 
 I think I've found a problem with nesting of lists in RTF.  Running  
 the program below with PDF output produces nested lists three levels  
 deep with all sub-lists nested properly.  However, if you run the same  
 code with RTF output the third level of lists does not show as being  
 indented, although the numbering seems correct.  Is there something  
 that needs to be done differently for RTF?
 
 Thanks,
 Chris
 
 Test program:
 
 import java.io.FileOutputStream;
 import java.io.IOException;
 
 import com.lowagie.text.Chunk;
 import com.lowagie.text.Document;
 import com.lowagie.text.DocumentException;
 import com.lowagie.text.List;
 import com.lowagie.text.ListItem;
 import com.lowagie.text.pdf.PdfWriter;
 import com.lowagie.text.rtf.RtfWriter2;
 
 
 public class TestList {
 
  public static void main(String[] args) throws IOException,  
 DocumentException {
  Document document = new Document();
  RtfWriter2.getInstance(document, new  
 FileOutputStream(testlist.rtf));
 //PdfWriter.getInstance(document, new  
 FileOutputStream(testlist.pdf));
  document.open();
  List list1 = new List(List.ALPHABETICAL, 20);
  list1.add(new ListItem(new Chunk(Level 1 - Item 1)));
  list1.add(new ListItem(new Chunk(Level 1 - Item 2)));
  list1.add(new ListItem(new Chunk(Level 1 - Item 3)));
 
  List list2 = new List(List.ORDERED, 20);
  list2.add(new ListItem(new Chunk(Level 2 - Item 1)));
  list2.add(new ListItem(new Chunk(Level 2 - Item 2)));
 
  List list3 = new List(List.ORDERED, 20);
  list3.add(new ListItem(new Chunk(Level 3 - Item 1)));
  list3.add(new ListItem(new Chunk(Level 3 - Item 2)));
  list3.add(new ListItem(new Chunk(Level 3 - Item 3)));
  list3.add(new ListItem(new Chunk(Level 3 - Item 4)));
  list2.add(list3);
 
  //list2.add(new ListItem(new Chunk(Level 2 - Item 3)));
  list1.add(list2);
 
  list1.add(new ListItem(new Chunk(Level 1 - Item 4)));
 
  document.add(list1);
  document.close();
  }
 }
 
 PDF output:
 
 
 
 RTF output:
 
 
 
 
 
 --
 Let Crystal Reports handle the reporting - Free Crystal Reports 2008
 30-Day 
 trial. Simplify your report design, integration and deployment - and focus
 on 
 what you do best, core application coding. Discover what's new with
 Crystal Reports now.  http://p.sf.net/sfu/bobj-july
 ___
 iText-questions mailing list
 iText-questions@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/itext-questions
 
 Buy the iText book: http://www.1t3xt.com/docs/book.php
 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/
 

-- 
View this message in context: 
http://old.nabble.com/Problem-in-nesting-of-lists-in-RTF--tp26379399p26379918.html
Sent from the iText - General mailing list archive at Nabble.com.


--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
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] Problem in nesting of lists in RTF?

2009-11-16 Thread Chris von See
Well, that wasn't quite the answer I had hoped for :/

Will iText RTF support emerge from the incubator at some point in the  
future? or is this a death by incubation scenario?

Chris


On Nov 16, 2009, at 2:37 PM, mister bean wrote:


 iText is about to move the RTF functionality to an incubator and  
 deprecate
 this functionality. Unless someone can provide the answer on this  
 list (and
 even if they do), you might want to consider other options for RTF
 generation.

 Best wishes,

 ---mr. bean

 re 



 Chris von See wrote:

 I think I've found a problem with nesting of lists in RTF.  Running
 the program below with PDF output produces nested lists three levels
 deep with all sub-lists nested properly.  However, if you run the  
 same
 code with RTF output the third level of lists does not show as being
 indented, although the numbering seems correct.  Is there something
 that needs to be done differently for RTF?

 Thanks,
 Chris

 Test program:

 import java.io.FileOutputStream;
 import java.io.IOException;

 import com.lowagie.text.Chunk;
 import com.lowagie.text.Document;
 import com.lowagie.text.DocumentException;
 import com.lowagie.text.List;
 import com.lowagie.text.ListItem;
 import com.lowagie.text.pdf.PdfWriter;
 import com.lowagie.text.rtf.RtfWriter2;


 public class TestList {

 public static void main(String[] args) throws IOException,
 DocumentException {
 Document document = new Document();
 RtfWriter2.getInstance(document, new
 FileOutputStream(testlist.rtf));
 //PdfWriter.getInstance(document, new
 FileOutputStream(testlist.pdf));
 document.open();
 List list1 = new List(List.ALPHABETICAL, 20);
 list1.add(new ListItem(new Chunk(Level 1 - Item 1)));
 list1.add(new ListItem(new Chunk(Level 1 - Item 2)));
 list1.add(new ListItem(new Chunk(Level 1 - Item 3)));

 List list2 = new List(List.ORDERED, 20);
 list2.add(new ListItem(new Chunk(Level 2 - Item 1)));
 list2.add(new ListItem(new Chunk(Level 2 - Item 2)));

 List list3 = new List(List.ORDERED, 20);
 list3.add(new ListItem(new Chunk(Level 3 - Item 1)));
 list3.add(new ListItem(new Chunk(Level 3 - Item 2)));
 list3.add(new ListItem(new Chunk(Level 3 - Item 3)));
 list3.add(new ListItem(new Chunk(Level 3 - Item 4)));
 list2.add(list3);

 //list2.add(new ListItem(new Chunk(Level 2 - Item 3)));
 list1.add(list2);

 list1.add(new ListItem(new Chunk(Level 1 - Item 4)));

 document.add(list1);
 document.close();
 }
 }

 PDF output:



 RTF output:





 --
 Let Crystal Reports handle the reporting - Free Crystal Reports 2008
 30-Day
 trial. Simplify your report design, integration and deployment -  
 and focus
 on
 what you do best, core application coding. Discover what's new with
 Crystal Reports now.  http://p.sf.net/sfu/bobj-july
 ___
 iText-questions mailing list
 iText-questions@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/itext-questions

 Buy the iText book: http://www.1t3xt.com/docs/book.php
 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/


 -- 
 View this message in context: 
 http://old.nabble.com/Problem-in-nesting-of-lists-in-RTF--tp26379399p26379918.html
 Sent from the iText - General mailing list archive at Nabble.com.


 --
 Let Crystal Reports handle the reporting - Free Crystal Reports 2008  
 30-Day
 trial. Simplify your report design, integration and deployment - and  
 focus on
 what you do best, core application coding. Discover what's new with
 Crystal Reports now.  http://p.sf.net/sfu/bobj-july
 ___
 iText-questions mailing list
 iText-questions@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/itext-questions

 Buy the iText book: http://www.1t3xt.com/docs/book.php
 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/


--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: 

Re: [iText-questions] Root Object is invalid or missing after PDF is manipulated with iTextSharp

2009-11-16 Thread Mark Storer
That file is horrifically mangled all right.  The cross reference (xref) table 
at the end doesn't list all the objects in the file, not by a long shot.

The root object, 69, is among those AWOL from the xref... leading to the error 
you're getting.

WHY is it missing?  I'm not sure.  The xref looks like one you'd find as a 
result of a stamper in append mode, tacked onto the original PDF, but the 
rest of the file looks like it should have a single xref.  The trailer makes no 
mention of a previous xref or xref stream.

You're not explicitly setting the stamper to use append mode, so it will only 
go into that mode, IIRC, if forced by a signature.  (And I don't see anything 
in the source that backs that up either, so now I'm Really Confused)

Is this a single threaded environment?  (he asked, grasping at straws)

--Mark Storer 
  Senior Software Engineer 
  Cardiff.com

#include disclaimer 
typedef std::DisclaimerCardiff DisCard; 



 -Original Message-
 From: subrah [mailto:subnibh...@gmail.com]
 Sent: Monday, November 16, 2009 12:12 PM
 To: itext-questions@lists.sourceforge.net
 Subject: Re: [iText-questions] Root Object is invalid or missing after
 PDF is manipulated with iTextSharp
 
 
 
 Attached is the corrupt file.
  if i try to read the corrupted file using pdfreader i get 
 the error message
 saying start ref not found. But the issue is that problem is not
 consistant. I am able to water mark the same original file 
 2nd time using
 the same code. So it's like randomly some file is not fully written.
 
 i am gussing this is because the pdfstamper is closing the 
 memory stream
 earlier than it should for some reason. However what i want 
 to confirm is
 that my understanding that the probelm is infact the memory 
 stream is right
 or not?. Because i have implmented alternative technique to 
 compltely avoid
 memory stream and pdf stamper but use pdfwriter and file 
 stream which seem
 to have fixed the issue in dev. But still need to get 
 response from a heavy
 testing team. Any light thrwon on this subject will be of 
 great help to me.
 
 Thanks
 Subrah
 
 
 
 Mark Storer-2 wrote:
  
  A: Most of the folks on the list lean toward Java.
  B: If no one knows the answer, no one answers.
  
  Perhaps you could post one of your corrupted PDFs?
  
  --Mark Storer 
Senior Software Engineer 
Cardiff.com
  
  #include disclaimer 
  typedef std::DisclaimerCardiff DisCard; 
  
  
  
  -Original Message-
  From: subrah [mailto:subnibh...@gmail.com]
  Sent: Monday, November 16, 2009 8:50 AM
  To: itext-questions@lists.sourceforge.net
  Subject: Re: [iText-questions] Root Object is invalid or 
 missing after
  PDF is manipulated with iTextSharp
  
  
  
  Hi All,
  
  I am wondering why nobody is interested in responding to my 
  question? I seem
  to have found a fix but just wanted to confirm with experts 
  on this forum.
  So any help is greatly appreciated.
  
  Thanks
  Subrah
  
  
  
  subrah wrote:
   
   Hi
   Sorry resending this post as i was not registered user earlier.
   
i am using latest iTextSharp library to edit the pdf 
  documents to put the
   water marking digitallly (hidden). So when i researched i 
  found that i can
   add a annotation to the pdf document and then set the flags to
   annotation.Flags = PdfAnnotation.FLAGS_NOVIEW |
   PdfAnnotation.FLAGS_INVISIBLE | PdfAnnotation.FLAGS_HIDDEN; 
  to make it
   invisible.
   
   so this is working fine as expected 90% of the time. 
  Remaning 10 % of the
   time i get an error when i open the document after adding 
  the annotation
   it says Root object is invalid or missing
   
   so looks like it corrupted the file trying to add the 
  annoation. do you
   have any suggestion? i can share the code i am using to add 
  the annotation
   if that helps. 
   
   Full code
   public static byte[] EditPdf(string sourceFile, string 
  visibleWaterMark,
   string digitalWaterMark)
   {
   PdfReader reader = new PdfReader(sourceFile);
   using (MemoryStream memoryStream = new 
 MemoryStream())
   {
   PdfStamper pdfStamper = new PdfStamper(reader,
   memoryStream);
   // process every page in the pdf file
   for (int i = 1; i = reader.NumberOfPages; i++)
   {
   Rectangle pageSize =
   reader.GetPageSizeWithRotation(i);
   PdfContentByte pdfPageContents =
   pdfStamper.GetUnderContent(i);
   PdfAnnotation annotation =
   PdfAnnotation.CreateText(pdfStamper.Writer, new 
  Rectangle(200f, 400f,
   300f, 500f), digitalWaterMark,
   Street Events 
  Digital Watermark,
   false, Key);
   //digital water marking 
   annotation.Flags = 
 PdfAnnotation.FLAGS_NOVIEW |
   PdfAnnotation.FLAGS_INVISIBLE | PdfAnnotation.FLAGS_HIDDEN;
   

Re: [iText-questions] Root Object is invalid or missing after PDF is manipulated with iTextSharp

2009-11-16 Thread Paulo Soares
Try the code in the SVN, it fixes a problem in heavy multithreading.

Paulo

- Original Message - 
From: subrah subnibh...@gmail.com
To: itext-questions@lists.sourceforge.net
Sent: Monday, November 16, 2009 8:12 PM
Subject: Re: [iText-questions] Root Object is invalid or missing after PDF 
is manipulated with iTextSharp



Attached is the corrupt file.
 if i try to read the corrupted file using pdfreader i get the error message
saying start ref not found. But the issue is that problem is not
consistant. I am able to water mark the same original file 2nd time using
the same code. So it's like randomly some file is not fully written.

i am gussing this is because the pdfstamper is closing the memory stream
earlier than it should for some reason. However what i want to confirm is
that my understanding that the probelm is infact the memory stream is right
or not?. Because i have implmented alternative technique to compltely avoid
memory stream and pdf stamper but use pdfwriter and file stream which seem
to have fixed the issue in dev. But still need to get response from a heavy
testing team. Any light thrwon on this subject will be of great help to me.

Thanks
Subrah



Mark Storer-2 wrote:

 A: Most of the folks on the list lean toward Java.
 B: If no one knows the answer, no one answers.

 Perhaps you could post one of your corrupted PDFs?

 --Mark Storer
   Senior Software Engineer
   Cardiff.com

 #include disclaimer
 typedef std::DisclaimerCardiff DisCard;



 -Original Message-
 From: subrah [mailto:subnibh...@gmail.com]
 Sent: Monday, November 16, 2009 8:50 AM
 To: itext-questions@lists.sourceforge.net
 Subject: Re: [iText-questions] Root Object is invalid or missing after
 PDF is manipulated with iTextSharp



 Hi All,

 I am wondering why nobody is interested in responding to my
 question? I seem
 to have found a fix but just wanted to confirm with experts
 on this forum.
 So any help is greatly appreciated.

 Thanks
 Subrah



 subrah wrote:
 
  Hi
  Sorry resending this post as i was not registered user earlier.
 
   i am using latest iTextSharp library to edit the pdf
 documents to put the
  water marking digitallly (hidden). So when i researched i
 found that i can
  add a annotation to the pdf document and then set the flags to
  annotation.Flags = PdfAnnotation.FLAGS_NOVIEW |
  PdfAnnotation.FLAGS_INVISIBLE | PdfAnnotation.FLAGS_HIDDEN;
 to make it
  invisible.
 
  so this is working fine as expected 90% of the time.
 Remaning 10 % of the
  time i get an error when i open the document after adding
 the annotation
  it says Root object is invalid or missing
 
  so looks like it corrupted the file trying to add the
 annoation. do you
  have any suggestion? i can share the code i am using to add
 the annotation
  if that helps.
 
  Full code
  public static byte[] EditPdf(string sourceFile, string
 visibleWaterMark,
  string digitalWaterMark)
  {
  PdfReader reader = new PdfReader(sourceFile);
  using (MemoryStream memoryStream = new MemoryStream())
  {
  PdfStamper pdfStamper = new PdfStamper(reader,
  memoryStream);
  // process every page in the pdf file
  for (int i = 1; i = reader.NumberOfPages; i++)
  {
  Rectangle pageSize =
  reader.GetPageSizeWithRotation(i);
  PdfContentByte pdfPageContents =
  pdfStamper.GetUnderContent(i);
  PdfAnnotation annotation =
  PdfAnnotation.CreateText(pdfStamper.Writer, new
 Rectangle(200f, 400f,
  300f, 500f), digitalWaterMark,
  Street Events
 Digital Watermark,
  false, Key);
  //digital water marking
  annotation.Flags = PdfAnnotation.FLAGS_NOVIEW |
  PdfAnnotation.FLAGS_INVISIBLE | PdfAnnotation.FLAGS_HIDDEN;
  pdfStamper.AddAnnotation(annotation, i);
  pdfPageContents.BeginText();
  BaseFont baseFont =
  BaseFont.CreateFont(BaseFont.HELVETICA_BOLD,
 Encoding.ASCII.EncodingName,
  BaseFont.NOT_EMBEDDED);
  pdfPageContents.SetFontAndSize(baseFont, 10);
  pdfPageContents.SetRGBColorFill(225, 224, 223);
  // visible water marking
 
  pdfPageContents.ShowTextAligned(PdfContentByte.ALIGN_RIGHT,
  visibleWaterMark,
 
 pageSize.Width - 50,
 
 pageSize.Height - 15,
   0);
  pdfPageContents.EndText();
  pdfStamper.FormFlattening = true;
 
  }
 
  pdfStamper.Close();
  return memoryStream.ToArray();
  }
 
 
 
   public static void SaveFile(string fileHandle, byte[] fileBytes)
  {
  using(FileStream fs = new FileStream(fileHandle,
  FileMode.Create))
  {
  fs.Write(fileBytes, 0, 

Re: [iText-questions] Problem in nesting of lists in RTF?

2009-11-16 Thread mister bean

Per Bruno's earlier post to this list, iText is moving to PDF-only for
output. The incubator is for related projects that developers might want to
use in conjunction with iText. Whether that means they're dead or alive will
depend, I am sure, on the authors of the various packages. 

If Howard Shenk is reading the list, he might be able to tell you/us
directly what involvement he anticipates regarding maintenance and
development of the RTF package.

Regards,

---mr. bean



Chris von See wrote:
 
 Well, that wasn't quite the answer I had hoped for :/
 
 Will iText RTF support emerge from the incubator at some point in the  
 future? or is this a death by incubation scenario?
 
 Chris
 
 
 On Nov 16, 2009, at 2:37 PM, mister bean wrote:
 

 iText is about to move the RTF functionality to an incubator and  
 deprecate
 this functionality. Unless someone can provide the answer on this  
 list (and
 even if they do), you might want to consider other options for RTF
 generation.

 Best wishes,

 ---mr. bean

 re 



 Chris von See wrote:

 I think I've found a problem with nesting of lists in RTF.  Running
 the program below with PDF output produces nested lists three levels
 deep with all sub-lists nested properly.  However, if you run the  
 same
 code with RTF output the third level of lists does not show as being
 indented, although the numbering seems correct.  Is there something
 that needs to be done differently for RTF?

 Thanks,
 Chris

 Test program:

 import java.io.FileOutputStream;
 import java.io.IOException;

 import com.lowagie.text.Chunk;
 import com.lowagie.text.Document;
 import com.lowagie.text.DocumentException;
 import com.lowagie.text.List;
 import com.lowagie.text.ListItem;
 import com.lowagie.text.pdf.PdfWriter;
 import com.lowagie.text.rtf.RtfWriter2;


 public class TestList {

 public static void main(String[] args) throws IOException,
 DocumentException {
 Document document = new Document();
 RtfWriter2.getInstance(document, new
 FileOutputStream(testlist.rtf));
 //PdfWriter.getInstance(document, new
 FileOutputStream(testlist.pdf));
 document.open();
 List list1 = new List(List.ALPHABETICAL, 20);
 list1.add(new ListItem(new Chunk(Level 1 - Item 1)));
 list1.add(new ListItem(new Chunk(Level 1 - Item 2)));
 list1.add(new ListItem(new Chunk(Level 1 - Item 3)));

 List list2 = new List(List.ORDERED, 20);
 list2.add(new ListItem(new Chunk(Level 2 - Item 1)));
 list2.add(new ListItem(new Chunk(Level 2 - Item 2)));

 List list3 = new List(List.ORDERED, 20);
 list3.add(new ListItem(new Chunk(Level 3 - Item 1)));
 list3.add(new ListItem(new Chunk(Level 3 - Item 2)));
 list3.add(new ListItem(new Chunk(Level 3 - Item 3)));
 list3.add(new ListItem(new Chunk(Level 3 - Item 4)));
 list2.add(list3);

 //list2.add(new ListItem(new Chunk(Level 2 - Item 3)));
 list1.add(list2);

 list1.add(new ListItem(new Chunk(Level 1 - Item 4)));

 document.add(list1);
 document.close();
 }
 }

 PDF output:



 RTF output:





 --
 Let Crystal Reports handle the reporting - Free Crystal Reports 2008
 30-Day
 trial. Simplify your report design, integration and deployment -  
 and focus
 on
 what you do best, core application coding. Discover what's new with
 Crystal Reports now.  http://p.sf.net/sfu/bobj-july
 ___
 iText-questions mailing list
 iText-questions@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/itext-questions

 Buy the iText book: http://www.1t3xt.com/docs/book.php
 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/


 -- 
 View this message in context:
 http://old.nabble.com/Problem-in-nesting-of-lists-in-RTF--tp26379399p26379918.html
 Sent from the iText - General mailing list archive at Nabble.com.


 --
 Let Crystal Reports handle the reporting - Free Crystal Reports 2008  
 30-Day
 trial. Simplify your report design, integration and deployment - and  
 focus on
 what you do best, core application coding. Discover what's new with
 Crystal Reports now.  http://p.sf.net/sfu/bobj-july
 ___
 iText-questions mailing list
 iText-questions@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/itext-questions

 Buy the iText book: http://www.1t3xt.com/docs/book.php
 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] Problem in nesting of lists in RTF?

2009-11-16 Thread Chris von See
Thanks for the information.  I'm a newbie to the list and hadn't seen  
Bruno's earlier post.

Chris von See
Senior Geek
TechAdapt, Inc.
http://www.techadapt.com
ch...@techadapt.com

Save trees.  Print only when necessary.





On Nov 16, 2009, at 6:42 PM, mister bean wrote:


 Per Bruno's earlier post to this list, iText is moving to PDF-only for
 output. The incubator is for related projects that developers might  
 want to
 use in conjunction with iText. Whether that means they're dead or  
 alive will
 depend, I am sure, on the authors of the various packages.

 If Howard Shenk is reading the list, he might be able to tell you/us
 directly what involvement he anticipates regarding maintenance and
 development of the RTF package.

 Regards,

 ---mr. bean



 Chris von See wrote:

 Well, that wasn't quite the answer I had hoped for :/

 Will iText RTF support emerge from the incubator at some point in the
 future? or is this a death by incubation scenario?

 Chris


 On Nov 16, 2009, at 2:37 PM, mister bean wrote:


 iText is about to move the RTF functionality to an incubator and
 deprecate
 this functionality. Unless someone can provide the answer on this
 list (and
 even if they do), you might want to consider other options for RTF
 generation.

 Best wishes,

 ---mr. bean

 re 



 Chris von See wrote:

 I think I've found a problem with nesting of lists in RTF.  Running
 the program below with PDF output produces nested lists three  
 levels
 deep with all sub-lists nested properly.  However, if you run the
 same
 code with RTF output the third level of lists does not show as  
 being
 indented, although the numbering seems correct.  Is there something
 that needs to be done differently for RTF?

 Thanks,
 Chris

 Test program:

 import java.io.FileOutputStream;
 import java.io.IOException;

 import com.lowagie.text.Chunk;
 import com.lowagie.text.Document;
 import com.lowagie.text.DocumentException;
 import com.lowagie.text.List;
 import com.lowagie.text.ListItem;
 import com.lowagie.text.pdf.PdfWriter;
 import com.lowagie.text.rtf.RtfWriter2;


 public class TestList {

public static void main(String[] args) throws IOException,
 DocumentException {
Document document = new Document();
RtfWriter2.getInstance(document, new
 FileOutputStream(testlist.rtf));
 //PdfWriter.getInstance(document, new
 FileOutputStream(testlist.pdf));
document.open();
List list1 = new List(List.ALPHABETICAL, 20);
list1.add(new ListItem(new Chunk(Level 1 - Item 1)));
list1.add(new ListItem(new Chunk(Level 1 - Item 2)));
list1.add(new ListItem(new Chunk(Level 1 - Item 3)));

List list2 = new List(List.ORDERED, 20);
list2.add(new ListItem(new Chunk(Level 2 - Item 1)));
list2.add(new ListItem(new Chunk(Level 2 - Item 2)));

List list3 = new List(List.ORDERED, 20);
list3.add(new ListItem(new Chunk(Level 3 - Item 1)));
list3.add(new ListItem(new Chunk(Level 3 - Item 2)));
list3.add(new ListItem(new Chunk(Level 3 - Item 3)));
list3.add(new ListItem(new Chunk(Level 3 - Item 4)));
list2.add(list3);

//list2.add(new ListItem(new Chunk(Level 2 - Item 3)));
list1.add(list2);

list1.add(new ListItem(new Chunk(Level 1 - Item 4)));

document.add(list1);
document.close();
}
 }

 PDF output:



 RTF output:





 --
 Let Crystal Reports handle the reporting - Free Crystal Reports  
 2008
 30-Day
 trial. Simplify your report design, integration and deployment -
 and focus
 on
 what you do best, core application coding. Discover what's new with
 Crystal Reports now.  http://p.sf.net/sfu/bobj-july
 ___
 iText-questions mailing list
 iText-questions@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/itext-questions

 Buy the iText book: http://www.1t3xt.com/docs/book.php
 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/


 -- 
 View this message in context:
 http://old.nabble.com/Problem-in-nesting-of-lists-in-RTF--tp26379399p26379918.html
 Sent from the iText - General mailing list archive at Nabble.com.


 --
 Let Crystal Reports handle the reporting - Free Crystal Reports 2008
 30-Day
 trial. Simplify your report design, integration and deployment - and
 focus on
 what you do best, core application coding. Discover what's new with
 Crystal Reports now.  http://p.sf.net/sfu/bobj-july
 ___
 iText-questions mailing list
 iText-questions@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/itext-questions

 Buy the iText book: