Re: [iText-questions] Paragraph object when creating PDF from XML

2007-07-12 Thread Bruno Lowagie (iText)
Sushil Vegad wrote:
 Hello,
 
 I am creating pdf form xml and I need to indent the paragraphs. How can 
 I do this?

Looking at the iText source code, it should work.
I should test this and try to reproduce the problem.
I can't tell you when I'll have the time to do this.

 Alternatively, I used a PdfPageEventHelper, but I can’t figure out how 
 to get the paragraph object in the onParagraph method.

The onParagraph method is there to retrieve information
(for instance: at which coordinate the paragraph starts).
It's not something you can use to change the indentation.
br,
Bruno

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/


Re: [iText-questions] XML Schema or DTD

2007-07-12 Thread Bruno Lowagie (iText)
Xavier Le Vourch wrote:
 FYI, the file is also there in the subversion repository but the attic
 concept doesn't exist in svn. To access the deleted files, you can
 browse the xml directory and use an older revision, 2500 for instance,
 in the sticky revision field.

Aha, I see, thanks for the clarification.
best regards,
Bruno

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/


Re: [iText-questions] How to Shrink Content and Add Margins

2007-07-12 Thread Bruno Lowagie (iText)
Ethan King wrote:
 This question has kind of been addressed in the past but not as directly 
 as some would hope.  I am looking to use iTextSharp to do 
 something similar to the Bates numbering function in Adobe Acrobat 8. 
  
 Basically I would like the shrink the contents of a PDF page to allow a 
 margin above and below the original content that I can then put 
 additional information in. 
  
 So for example I might want to put the word CONFIDENTIAL at the bottom 
 of each page in a PDF but I don't want it to appear over the top any 
 original content.  So I would like to shrink the content so that I can 
 fit the word CONFIDENTIAL below it.
  
 Any help that someone might be able to give me would be greatly appreciated.

There's more than one way to do this, but every solution has its
downside.

1. You could create a new Document and PdfWriter to produce
a PDF file with the desired page size.
Then create a PdfReader that reads the existing PDF file.
Ask the PdfReader for the number of pages and get every
page as a PdfImportedPage in a loop. Wrap the PdfImportedPage
in an Image object, scale (shrink) the image object, and add
it to the new document with the desired offset, along with
the extra content above or under the image.

Downside: PdfImportedPage works like a photocopy machine:
it copies the content (as it would appear on paper), but
it doesn't copy the interactive features (hyperlinks, form
fields,...). If you have such features in your PDF, you
will have to do a lot of extra work retrieving them from
the original document, transforming the coordinates and
adding the features to the new document.

2. How important is the actual page size to you?
If you don't mind Adobe reader to resize the document,
then you may keep the content as is, but change the
page boundaries. In this case, you'll need PdfReader
and PdfStamper. With PdfReader, you'll loop over all
the pages and change the page boundaries; then with
PdfStamper, you add the new content so that it's outside
the original boundaries, but inside the new ones.

Downside: the PDF document won't have a standard page size
anymore. I'm not sure if there's a way to work around this.

br,
Bruno

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/


Re: [iText-questions] Rowspan

2007-07-12 Thread Bruno Lowagie (iText)
Matthew Kiely wrote:
 Do you have plans to support rowspan in the future?

Not for PdfPTable, no.

  In the meantime,
 are there workarounds to achieve a good visual representation of
 rowspan?

Yes: use nested tables.

br,
Bruno

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/


Re: [iText-questions] Get Readonly-flag state

2007-07-12 Thread Bruno Lowagie (iText)
Tobias Meier wrote:
 Unfortunatly there is no getFieldProperty(...) method, is it?

No, there isn't.
But maybe there should.
I'll have a look at it.
br,
Bruno

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/


[iText-questions] Merging PDFs without starting a new page

2007-07-12 Thread Paul Jones
Hi. I tried using PDFCopy to create one file out of three. It works but each
PDF starts on a new page. 

However, each PDF is just a short paragraph. Is there a way to merge just
the text without the blank space? I want to go from 3 PDFs with a paragraph
in each to one PDF with three paragraphs.


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/


Re: [iText-questions] Merging PDFs without starting a new page

2007-07-12 Thread Bruno Lowagie (iText)
Paul Jones wrote:
 Hi. I tried using PDFCopy to create one file out of three. It works but each
 PDF starts on a new page. 
 
 However, each PDF is just a short paragraph. Is there a way to merge just
 the text without the blank space? I want to go from 3 PDFs with a paragraph
 in each to one PDF with three paragraphs.

PDF is a Page Description Language.
It describes pages, not paragraphs.
It's not a Word processing format
that keeps track of the text structure.

In other words: your question is unanswerable.

It's like saying: how can I look through a
mirror and see what's behind? The answer to
that question is: a mirror is not a window;
normally you can't look through a mirror.

'Normally' means there might be a workaround:
if you know how much space each paragraph takes,
you could import the pages, clip the imported
pages and combine them on one page. However,
this is not something I would advice unless
the paragraphs all have more or less the same
size and never exceed the clipped region.
You can't ask the PDF how much space each
paragraph is using.

best regards,
Bruno

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/


[iText-questions] Word breaks and Tagged PDF content

2007-07-12 Thread dayvidpow

I am creating a tagged PDF document using the iText 2.0 tagging features.
First I begin a marked-content-sequence then loop thru a list of words and
add each word to the PdfContentByte at a fixed coordinate position. I am
adding all the words within a paragraph tag container P. The problem is
all the words are added within the tag P as one continuos string without
any spacing (word breaks) between words, even though the coordinates of the
words provide for such spacing. How do i include word breaks (as mentioned
in the PDF specs sect 10.7) in such scenario ? Am I even approaching this
issue the correct way ? 

Please see my code sample below:

writer.setTagged();
PdfContentByte cb = writer.getDirectContent();
PdfStructureTreeRoot root = writer.getStructureTreeRoot();
PdfStructureElement para = new PdfStructureElement(root, PdfName.P);

cb.beginMarkedContentSequence(para);

for(Word word : listOfWords){
   cb.beginText();
   cb.setColorFill(Color.RED);  
   cb.setFontAndSize(baseFont, word.getFontSize());
   cb.setTextMatrix(word.getLeft(),word.getBottom());
   cb.showText(word.getText());
   cb.endText(); 
}
cb.endMarkedContentSequence();



-- 
View this message in context: 
http://www.nabble.com/Word-breaks-and-Tagged-PDF-content-tf4067653.html#a11558483
Sent from the iText - General mailing list archive at Nabble.com.


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/


[iText-questions] Page numbers disturbed by creating coverpage

2007-07-12 Thread Sushil Vegad
Hi,
When I insert a cover page, my page numbers are getting disturbed. If I
don't create a cover-page, the numbering is fine

I first create a cover page and then get the PDF data by parsing an xml.
document.open();
writer.setPageEmpty(false);
createCoverPage();

//get the data from an xml file:
document.newPage();
SAXParser parser = SAXParserFactory.newInstance().newSAXParser();
parser.parse();

If the PDF were to have 2 pages (1st=cover-page, 2nd=data), my page numbers
are Page 1 of 3 on cover-page and Page 3 of 3 on data page. 
It should be 1 of 2 and 2 of 2. I think this is happening because of the
newPage() call. If I omit the call then my data gets displayed on the first
page instead of cover-page.

Please let me know how I can solve this. 

Thanks,
Sushil Vegad



-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/


[iText-questions] No linebreak in front of a Chapter!

2007-07-12 Thread Eric Summkeller
Is there any possibility to create a Chapter without a linebreak in front of 
it?


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/


Re: [iText-questions] Page numbers disturbed by creating coverpage

2007-07-12 Thread Sushil Vegad
Hello,
The document.setPageCount() did it.

Thanks again,
Sushil
 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Sushil
Vegad
Sent: Thursday, July 12, 2007 9:06 AM
To: 'Post all your questions about iText here'
Subject: [iText-questions] Page numbers disturbed by creating coverpage

Hi,
When I insert a cover page, my page numbers are getting disturbed. If I
don't create a cover-page, the numbering is fine

I first create a cover page and then get the PDF data by parsing an xml.
document.open();
writer.setPageEmpty(false);
createCoverPage();

//get the data from an xml file:
document.newPage();
SAXParser parser = SAXParserFactory.newInstance().newSAXParser();
parser.parse();

If the PDF were to have 2 pages (1st=cover-page, 2nd=data), my page numbers
are Page 1 of 3 on cover-page and Page 3 of 3 on data page. 
It should be 1 of 2 and 2 of 2. I think this is happening because of the
newPage() call. If I omit the call then my data gets displayed on the first
page instead of cover-page.

Please let me know how I can solve this. 

Thanks,
Sushil Vegad



-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/




-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/


Re: [iText-questions] How to Shrink Content and Add Margins

2007-07-12 Thread Ethan King

Thanks for your response.  It seems that option 2 using PdfReader 
PdfStamper is the only way I can go.  I need to maintain the contents of a
page and not just an image of the page.  You post makes me wonder though
about the way page size is defined by PDF.

It would seem to me that rehoretically what consitutes a page should not be
defined by a physical size like a sheet of paper but instead based on a
ratio of height to width.  Would it be possible to use iText to add space
around the outside of a page, maintining the orginal ratio of height to
width and then redefine that new size as 8.5x11 or some other standard page
size?

I am assuming that this would not work but I don't know enough about the PDF
spec to say one way or the other.  I also wonder how Adobe handles this in
Acrobat 8.

Thanks,
Ethan


On 7/12/07, Bruno Lowagie (iText) [EMAIL PROTECTED] wrote:


Ethan King wrote:
 This question has kind of been addressed in the past but not as directly
 as some would hope.  I am looking to use iTextSharp to do
 something similar to the Bates numbering function in Adobe Acrobat 8.

 Basically I would like the shrink the contents of a PDF page to allow a
 margin above and below the original content that I can then put
 additional information in.

 So for example I might want to put the word CONFIDENTIAL at the bottom
 of each page in a PDF but I don't want it to appear over the top any
 original content.  So I would like to shrink the content so that I can
 fit the word CONFIDENTIAL below it.

 Any help that someone might be able to give me would be greatly
appreciated.

There's more than one way to do this, but every solution has its
downside.

1. You could create a new Document and PdfWriter to produce
a PDF file with the desired page size.
Then create a PdfReader that reads the existing PDF file.
Ask the PdfReader for the number of pages and get every
page as a PdfImportedPage in a loop. Wrap the PdfImportedPage
in an Image object, scale (shrink) the image object, and add
it to the new document with the desired offset, along with
the extra content above or under the image.

Downside: PdfImportedPage works like a photocopy machine:
it copies the content (as it would appear on paper), but
it doesn't copy the interactive features (hyperlinks, form
fields,...). If you have such features in your PDF, you
will have to do a lot of extra work retrieving them from
the original document, transforming the coordinates and
adding the features to the new document.

2. How important is the actual page size to you?
If you don't mind Adobe reader to resize the document,
then you may keep the content as is, but change the
page boundaries. In this case, you'll need PdfReader
and PdfStamper. With PdfReader, you'll loop over all
the pages and change the page boundaries; then with
PdfStamper, you add the new content so that it's outside
the original boundaries, but inside the new ones.

Downside: the PDF document won't have a standard page size
anymore. I'm not sure if there's a way to work around this.

br,
Bruno

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/___
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/


[iText-questions] [PATCH] Preserve hyperlinks in PdfImportedPage

2007-07-12 Thread Michael Schierl
On Thu, 5 Jul 2007 21:45:03 +0200, Michael Schierl wrote:

 But I don't manage to get the page number of the current target - I get a
 PRIndirectReference, but how to make a page number from it?

I now solved it by doing a linear scan over all pages and look for the 
one with the same reference number. It works, but it might get slow for 
documents with lots of pages and lots of links. Better solutions still 
appreciated.

My Patch is attached. I tested it on a bunch of PDF files, no problems so 
far. Test program is the same as posted last week.

 The new function PdfReader#getLinks() will return an array of
 PdfAnnotation.PdfImportedLink. This link knows if it is internal to the pdf
 (#isInternal), and you can transform the bounding rectangle and the
 destination point by a 2x3 matrix (the same matrix you used for tranforming
 the pages with PdfContentByte#addTemplate(template,a,b,c,d,e,f)). These
 PdfImportedLinks can later be converted to PdfAnnotation objects and added
 to the PdfWriter (or discarded if the destination page is not in the new
 PDF).

Michael

keep-hyperlinks.patch
Description: Attached file: keep-hyperlinks.patch
-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/___
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/


[iText-questions] tables text and margin

2007-07-12 Thread Corwin noname


I need to insert text into a table so top and bottom of the
text touches the cells borders.

At the moment I have managed the text touch the bottom
border but I have failed to do this with the top of the text.

 

Any ideas how it can be done?

 

Thanks

Dmitri
_
Explore the seven wonders of the world
http://search.msn.com/results.aspx?q=7+wonders+worldmkt=en-USform=QBRE-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/___
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/


Re: [iText-questions] How to Shrink Content and Add Margins

2007-07-12 Thread Leonard Rosenthol
PDF page size is defined by a rectangle called the MediaBox that is  
referenced on each page.  That enables each page to be a different  
size, if you're so inclined.  Changing the page size is trivial - you  
just change the value o the MediaBox.


However, your content is still anchored at the origin of the page  
(0,0) - so it stays in the lower left regardless of how big (or  
small) you make that rect.  Therefore, you need to  
shift (transform) the contents.


The easiest way to do that, if you knew PDF internals, would be to  
prepend the content stream with the appropriate 'cm' operation  
(probably a combination of scale and translate).  If you aren't that  
fluent in PDF, then the method described by Bruno works fine.


Leonard


On Jul 12, 2007, at 5:02 PM, Ethan King wrote:

Thanks for your response.  It seems that option 2 using PdfReader   
PdfStamper is the only way I can go.  I need to maintain the  
contents of a page and not just an image of the page.  You post  
makes me wonder though about the way page size is defined by PDF.


It would seem to me that rehoretically what consitutes a page  
should not be defined by a physical size like a sheet of paper but  
instead based on a ratio of height to width.  Would it be possible  
to use iText to add space around the outside of a page, maintining  
the orginal ratio of height to width and then redefine that new  
size as 8.5x11 or some other standard page size?


I am assuming that this would not work but I don't know enough  
about the PDF spec to say one way or the other.  I also wonder how  
Adobe handles this in Acrobat 8.


Thanks,
Ethan


On 7/12/07, Bruno Lowagie (iText) [EMAIL PROTECTED] wrote:
Ethan King wrote:
 This question has kind of been addressed in the past but not as  
directly

 as some would hope.  I am looking to use iTextSharp to do
 something similar to the Bates numbering function in Adobe  
Acrobat 8.


 Basically I would like the shrink the contents of a PDF page to  
allow a

 margin above and below the original content that I can then put
 additional information in.

 So for example I might want to put the word CONFIDENTIAL at the  
bottom

 of each page in a PDF but I don't want it to appear over the top any
 original content.  So I would like to shrink the content so  
that I can

 fit the word CONFIDENTIAL below it.

 Any help that someone might be able to give me would be greatly  
appreciated.


There's more than one way to do this, but every solution has its
downside.

1. You could create a new Document and PdfWriter to produce
a PDF file with the desired page size.
Then create a PdfReader that reads the existing PDF file.
Ask the PdfReader for the number of pages and get every
page as a PdfImportedPage in a loop. Wrap the PdfImportedPage
in an Image object, scale (shrink) the image object, and add
it to the new document with the desired offset, along with
the extra content above or under the image.

Downside: PdfImportedPage works like a photocopy machine:
it copies the content (as it would appear on paper), but
it doesn't copy the interactive features (hyperlinks, form
fields,...). If you have such features in your PDF, you
will have to do a lot of extra work retrieving them from
the original document, transforming the coordinates and
adding the features to the new document.

2. How important is the actual page size to you?
If you don't mind Adobe reader to resize the document,
then you may keep the content as is, but change the
page boundaries. In this case, you'll need PdfReader
and PdfStamper. With PdfReader, you'll loop over all
the pages and change the page boundaries; then with
PdfStamper, you add the new content so that it's outside
the original boundaries, but inside the new ones.

Downside: the PDF document won't have a standard page size
anymore. I'm not sure if there's a way to work around this.

br,
Bruno

-- 
---

This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

-- 
---

This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/ 
___

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