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

2007-07-14 Thread Bruno Lowagie

Ethan King wrote:
I don't mean to beat a dead horse.  But this is an important part of a 
project that I am coordinating.


On any other mailing list, you would get the response:
too bad for you if you didn't understand the advice.

The fact that they have 
been shrunk is important, had these examples contained text I would 
still need to be able to select and copy the text as in the orginal.


I almost replied with the same too bad for you.
You completely misunderstood what I meant when I said
you would loose all the interactive features when using
method 1. It's not because you wrap an imported page inside
an Image object, that vector information (text position at
specific positions) is converted to a raster image (on the
contrary)! With method 1 you could still select text, but
all other interactive features: annotations, form fields,...
would not be 'shrunk' and it's not impossible, but it's
generally a hell of a job to solve this.

Unfortunately, I am not yet well versed enough in the PDF internals to 
make it out myself.  Any help or guidance you can provide would be 
greatly appreciated.


*sigh*
In attachment you find an example explaining both methods.
I've spend half an hour writing it, so that's about $50.
Let's say we're even if you buy the iText book.
You WILL NEED THE BOOK ANYWAY if you're coordinating a project
that involves PDF. It will save you and us from a lot of
frustrations if you read it ;-)

br,
Bruno
package test;

import java.awt.Color;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;

import com.lowagie.text.Document;
import com.lowagie.text.DocumentException;
import com.lowagie.text.Element;
import com.lowagie.text.Image;
import com.lowagie.text.PageSize;
import com.lowagie.text.Paragraph;
import com.lowagie.text.Rectangle;
import com.lowagie.text.pdf.BaseFont;
import com.lowagie.text.pdf.PdfArray;
import com.lowagie.text.pdf.PdfContentByte;
import com.lowagie.text.pdf.PdfDictionary;
import com.lowagie.text.pdf.PdfImportedPage;
import com.lowagie.text.pdf.PdfName;
import com.lowagie.text.pdf.PdfNumber;
import com.lowagie.text.pdf.PdfReader;
import com.lowagie.text.pdf.PdfStamper;
import com.lowagie.text.pdf.PdfWriter;

public class ShrinkPages {

public static void main(String[] args) {
try {
createSamplePdf();
solution1();
solution2();
} catch (IOException e) {
e.printStackTrace();
} catch (DocumentException e) {
e.printStackTrace();
}

}

public static void createSamplePdf() throws IOException, 
DocumentException {
Rectangle rect = new Rectangle(PageSize.A4);
rect.setBackgroundColor(Color.YELLOW);
Document document = new Document(rect);
PdfWriter.getInstance(document, new 
FileOutputStream(sample.pdf));
document.open();
document.add(new Paragraph(Hello World!));
rect.setBackgroundColor(Color.ORANGE);
document.setPageSize(rect);
document.newPage();
document.add(new Paragraph(Hello World!));
rect.setBackgroundColor(Color.GRAY);
document.setPageSize(rect);
document.newPage();
document.add(new Paragraph(Hello World!));
document.close();
}

public static void solution1() throws IOException, DocumentException {
PdfReader reader = new PdfReader(sample.pdf);
int n = reader.getNumberOfPages();
Document document = new Document(PageSize.A4);
PdfWriter writer = PdfWriter.getInstance(document, new 
FileOutputStream(solution1.pdf));
document.open();
PdfContentByte directcontent = writer.getDirectContent();
BaseFont font = BaseFont.createFont(BaseFont.HELVETICA, 
BaseFont.WINANSI, BaseFont.NOT_EMBEDDED);
PdfImportedPage page;
Image image;
for (int i = 1; i = n; i++) {
page = writer.getImportedPage(reader, i);
image = Image.getInstance(page);
image.scaleAbsolute(PageSize.A4.getWidth() - 72, 
PageSize.A4.getHeight() - 72);
image.setAbsolutePosition(36, 36);
directcontent.addImage(image);
directcontent.beginText();
directcontent.setFontAndSize(font, 12);
directcontent.showTextAligned(Element.ALIGN_LEFT, 
TEST, 36, 18, 0);
directcontent.endText();
document.newPage();
}
document.close();
}

public static void solution2() 

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

2007-07-14 Thread Bruno Lowagie
Tobias Meier wrote:
 But isn't there a easier way?

When I answered this question, I overlooked the method
decodeGenericDictionary(PdfDictionary, BaseField).
It helps you decode a 'merged' dictionary into a BaseField object
that has the getters you need.
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] Hard mask from image file

2007-07-14 Thread Bruno Lowagie
M.-Leander Reimer wrote:
 But the byte array I would require must be 
 bigger than 8x8 and would need to differ from image to image, so a 
 statically defined byte array is unsuitable.

You are referring to the example in Chapter 5, but you probably
overlooked this paragraph on page 157: In real life, you'll want
something that looks much better than figure 5.10, but this example
serves mainly to introduce the theory of hard and soft masks in images.
A hard mask has only one bit per component; 1 covers the image and
0 is transparent. A soft mask contains a gradient from 0 to 1.
We'll deal with this concept in more depth later on in chapter 11;
this is just a simple example that serves as an introduction.

 So the questions is: Can I make a hard mask directly from images loaded 
 from a file, and if so, what formats are supported here?

Skip to chapter 11, section 11.3 Clipping content (p341-344).
http://itext.ugent.be/itext-in-action/
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] How to Enable Save Attachment Dialog in Adobe

2007-07-14 Thread Harakiri
I've installed the adobe prof. 8 trial and created a
blank pdf with an attachment. When opening this pdf in
either 7 or 8.0 the Save button is enabled. Creating
a similar PDF in itext and the Save button is not
enabled - only the Open button.

So either this leaves two options :

a) either i have to set additional security
preferences (allow) using itext - but i thought i
allowed everything
b) this is a special feature by adobe prof. and itext
does not support the Save button yet...

Any ideas ?


--- Harakiri [EMAIL PROTECTED] wrote:

 Hello,
 
 i know that Adobe in their infinite wisdom
 restricted
 attached files to a PDF since version 7.0. I do
 understand that these restrictions are necessary for
 *opening* attachments within the reader - i do not
 understand why you would hinder a user to save an
 attachment to disk.
 
 In the attachment view pane - the Save button is
 *always* greyed out for any attachment type - even
 trusted once like PDF or TXT. However - when i click
 on the annotation hotspot in my PDF with rightclick
 mouse i get the option Save embedded File to
 Disk..
 - this actually does work but only for those files
 which are not untrusted by default.
 
 Why is the Save button greyed out in the attachment
 list and works when right clicking ?
 
 Is it a permission issue ?
 
 Anybody been able to produce a PDF for Reader 7 or 8
 where the Save button is enabled for at least a
 trusted attachment ?
 
 Thanks
 
 
  


 TV dinner still cooling? 
 Check out Tonight's Picks on Yahoo! TV.
 http://tv.yahoo.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/
 



   

Sick sense of humor? Visit Yahoo! TV's 
Comedy with an Edge to see what's on, when. 
http://tv.yahoo.com/collections/222

-
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 Enable Save Attachment Dialog in Adobe

2007-07-14 Thread Bruno Lowagie
Harakiri wrote:
 I've installed the adobe prof. 8 trial and created a
 blank pdf with an attachment. When opening this pdf in
 either 7 or 8.0 the Save button is enabled. Creating
 a similar PDF in itext and the Save button is not
 enabled - only the Open button.
 
 So either this leaves two options :
 
 a) either i have to set additional security
 preferences (allow) using itext - but i thought i
 allowed everything
 b) this is a special feature by adobe prof. and itext
 does not support the Save button yet...
 
 Any ideas ?

I think this is a question for somebody at Adobe.
I've seen similar things I found odd while making
portable collections.
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] How to Enable Save Attachment Dialog in Adobe

2007-07-14 Thread Harakiri
Thanks Bruno for your answer.

Do you happend to know how/who contact at adobe
([EMAIL PROTECTED] obviously will not work for this
specific question).

I will attach a sample pdf created by adobe prof 8.1 -
maybe you can see through a hexeditor if they have a
special attribute ?


--- Bruno Lowagie [EMAIL PROTECTED] wrote:

 Harakiri wrote:
  I've installed the adobe prof. 8 trial and created
 a
  blank pdf with an attachment. When opening this
 pdf in
  either 7 or 8.0 the Save button is enabled.
 Creating
  a similar PDF in itext and the Save button is
 not
  enabled - only the Open button.
  
  So either this leaves two options :
  
  a) either i have to set additional security
  preferences (allow) using itext - but i thought i
  allowed everything
  b) this is a special feature by adobe prof. and
 itext
  does not support the Save button yet...
  
  Any ideas ?
 
 I think this is a question for somebody at Adobe.
 I've seen similar things I found odd while making
 portable collections.
 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/
 



 

No need to miss a message. Get email on-the-go 
with Yahoo! Mail for Mobile. Get started.
http://mobile.yahoo.com/mail 

Test-Attachment.pdf
Description: 3999691460-Test-Attachment.pdf
-
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] tables text and margin

2007-07-14 Thread Bruno Lowagie
Corwin noname wrote:
 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.

Suppose that you are an architect, and I ask you to build
a house so that my feet touch the floor and my hands touch
the ceiling in every room. The same should be true for my
wife and kids. What would be the first thing you'd ask me?

Make the analogy with your question, and provide the answer
the architect needs to meet the requirement.

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] How to Enable Save Attachment Dialog in Adobe

2007-07-14 Thread Harakiri
I just noticed something odd - if i create a blank pdf
using Adobe Prof 8.1 and then use itext PdfStamper to
add an attachment, then the Save Attachment Dialog is
enabled !

What that means is that there seem to specific data
related to the pdf itself - it has nothing todo with
annotations - if itext would simply copy the structure
of a blank document created by acrobat then it should
work with new documents too i guess.



--- Harakiri [EMAIL PROTECTED] wrote:

 Thanks Bruno for your answer.
 
 Do you happend to know how/who contact at adobe
 ([EMAIL PROTECTED] obviously will not work for this
 specific question).
 
 I will attach a sample pdf created by adobe prof 8.1
 -
 maybe you can see through a hexeditor if they have a
 special attribute ?
 
 
 --- Bruno Lowagie [EMAIL PROTECTED] wrote:
 
  Harakiri wrote:
   I've installed the adobe prof. 8 trial and
 created
  a
   blank pdf with an attachment. When opening this
  pdf in
   either 7 or 8.0 the Save button is enabled.
  Creating
   a similar PDF in itext and the Save button is
  not
   enabled - only the Open button.
   
   So either this leaves two options :
   
   a) either i have to set additional security
   preferences (allow) using itext - but i thought
 i
   allowed everything
   b) this is a special feature by adobe prof. and
  itext
   does not support the Save button yet...
   
   Any ideas ?
  
  I think this is a question for somebody at Adobe.
  I've seen similar things I found odd while making
  portable collections.
  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/
  
 
 
 
  


 No need to miss a message. Get email on-the-go 
 with Yahoo! Mail for Mobile. Get started.
 http://mobile.yahoo.com/mail 
-
 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/
 



 

We won't tell. Get more on shows you hate to love 
(and love to hate): Yahoo! TV's Guilty Pleasures list.
http://tv.yahoo.com/collections/265 

-
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] SOLVED How to Enable Save Attachment Dialog in Adobe

2007-07-14 Thread Harakiri
Ok i figured out the root of the problem.

For Adobe there is a difference between 

a) An attachment somewhere on a specific page
 
writer.addAnnotation(PdfAnnotation.createFileAttachment(writer,
new Rectangle(100f, 650f, 150f, 700f), This is some
text, some text.getBytes(), null, some2.txt));

b) An attachment attached to the PDF

  writer.addFileAttachment(This is some text, some
text.getBytes(), null, some.txt);


Method b) will enable the Save Dialog in the
Attachment Pane, whereas a) will not. The only way to
issue a save is rightclick on the annotation hotspot.

I did not find an option to actually reproduce a
hotspot with attachment link like a) in adobe acrobat
to see if the pdf performs the same...

Whats the difference between the two ? I want a
reference in my pdf and the save button should work in
the attachment pane...



--- Harakiri [EMAIL PROTECTED] wrote:

 I just noticed something odd - if i create a blank
 pdf
 using Adobe Prof 8.1 and then use itext PdfStamper
 to
 add an attachment, then the Save Attachment Dialog
 is
 enabled !
 
 What that means is that there seem to specific data
 related to the pdf itself - it has nothing todo with
 annotations - if itext would simply copy the
 structure
 of a blank document created by acrobat then it
 should
 work with new documents too i guess.
 
 
 
 --- Harakiri [EMAIL PROTECTED] wrote:
 
  Thanks Bruno for your answer.
  
  Do you happend to know how/who contact at adobe
  ([EMAIL PROTECTED] obviously will not work for
 this
  specific question).
  
  I will attach a sample pdf created by adobe prof
 8.1
  -
  maybe you can see through a hexeditor if they have
 a
  special attribute ?
  
  
  --- Bruno Lowagie [EMAIL PROTECTED] wrote:
  
   Harakiri wrote:
I've installed the adobe prof. 8 trial and
  created
   a
blank pdf with an attachment. When opening
 this
   pdf in
either 7 or 8.0 the Save button is enabled.
   Creating
a similar PDF in itext and the Save button
 is
   not
enabled - only the Open button.

So either this leaves two options :

a) either i have to set additional security
preferences (allow) using itext - but i
 thought
  i
allowed everything
b) this is a special feature by adobe prof.
 and
   itext
does not support the Save button yet...

Any ideas ?
   
   I think this is a question for somebody at
 Adobe.
   I've seen similar things I found odd while
 making
   portable collections.
   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/
   
  
  
  
   
 


  No need to miss a message. Get email on-the-go 
  with Yahoo! Mail for Mobile. Get started.
  http://mobile.yahoo.com/mail 

-
  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/
  
 
 
 
  


 We won't tell. Get more on shows you hate to love 
 (and love to hate): Yahoo! TV's Guilty Pleasures
 list.
 http://tv.yahoo.com/collections/265 
 

-
 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/
 



   

Boardwalk for $500? In 2007? Ha! Play Monopoly Here and Now (it's updated for 
today's economy) at Yahoo! Games.
http://get.games.yahoo.com/proddesc?gamekey=monopolyherenow  

-
This 

Re: [iText-questions] SOLVED How to Enable Save Attachment Dialog in Adobe

2007-07-14 Thread Bruno Lowagie
Harakiri wrote:

 Whats the difference between the two ? I want a
 reference in my pdf and the save button should work in
 the attachment pane...

Have a look at:
http://lowagie.com/itextwiki/doku.php/collections:kubrick
Search for GoToE. That's an action that allows you to
create a link with an action that opens an embedded file.
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] SOLVED How to Enable Save Attachment Dialog in Adobe

2007-07-14 Thread Harakiri
Thanks Bruno,

i know about GOTOE - sadly this is not supported in
Adobe Reader below 7.0.

The whole point of showing attachments on pages with
hotspots was - that there is no viewer preferences for
the attachment pane below A.R. 7.0 - because there
isnt an attachment pane at all for 6.0 for example -
so users who are using this older client have no
knowledge where to search for attachments.

Any other ideas ? 

(Adobe does check for its versions exactly for the
problem described above with some user javascript to
tell the user where to find attachments when using
Acrobat 8.1 - it will open a javascript popup and say
there are attachments which you can find in version X
there, and in version Y there)


--- Bruno Lowagie [EMAIL PROTECTED] wrote:

 Harakiri wrote:
 
  Whats the difference between the two ? I want a
  reference in my pdf and the save button should
 work in
  the attachment pane...
 
 Have a look at:

http://lowagie.com/itextwiki/doku.php/collections:kubrick
 Search for GoToE. That's an action that allows you
 to
 create a link with an action that opens an embedded
 file.
 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/
 



   

Get the Yahoo! toolbar and be alerted to new email wherever you're surfing.
http://new.toolbar.yahoo.com/toolbar/features/mail/index.php

-
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-14 Thread Ethan King

I am sorry for taking up so much of your time and thank you for your help.
Your code is very generous and you can be rest assured that I have already
ordered a copy of the iText in Action book from Amazon.

-Ethan

On 7/14/07, Bruno Lowagie [EMAIL PROTECTED] wrote:


Ethan King wrote:
 I don't mean to beat a dead horse.  But this is an important part of a
 project that I am coordinating.

On any other mailing list, you would get the response:
too bad for you if you didn't understand the advice.

 The fact that they have
 been shrunk is important, had these examples contained text I would
 still need to be able to select and copy the text as in the orginal.

I almost replied with the same too bad for you.
You completely misunderstood what I meant when I said
you would loose all the interactive features when using
method 1. It's not because you wrap an imported page inside
an Image object, that vector information (text position at
specific positions) is converted to a raster image (on the
contrary)! With method 1 you could still select text, but
all other interactive features: annotations, form fields,...
would not be 'shrunk' and it's not impossible, but it's
generally a hell of a job to solve this.

 Unfortunately, I am not yet well versed enough in the PDF internals to
 make it out myself.  Any help or guidance you can provide would be
 greatly appreciated.

*sigh*
In attachment you find an example explaining both methods.
I've spend half an hour writing it, so that's about $50.
Let's say we're even if you buy the iText book.
You WILL NEED THE BOOK ANYWAY if you're coordinating a project
that involves PDF. It will save you and us from a lot of
frustrations if you read it ;-)

br,
Bruno

package test;

import java.awt.Color;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;

import com.lowagie.text.Document;
import com.lowagie.text.DocumentException;
import com.lowagie.text.Element;
import com.lowagie.text.Image;
import com.lowagie.text.PageSize;
import com.lowagie.text.Paragraph;
import com.lowagie.text.Rectangle;
import com.lowagie.text.pdf.BaseFont;
import com.lowagie.text.pdf.PdfArray;
import com.lowagie.text.pdf.PdfContentByte;
import com.lowagie.text.pdf.PdfDictionary;
import com.lowagie.text.pdf.PdfImportedPage;
import com.lowagie.text.pdf.PdfName;
import com.lowagie.text.pdf.PdfNumber;
import com.lowagie.text.pdf.PdfReader;
import com.lowagie.text.pdf.PdfStamper;
import com.lowagie.text.pdf.PdfWriter;

public class ShrinkPages {

public static void main(String[] args) {
try {
createSamplePdf();
solution1();
solution2();
} catch (IOException e) {
e.printStackTrace();
} catch (DocumentException e) {
e.printStackTrace();
}

}

public static void createSamplePdf() throws IOException,
DocumentException {
Rectangle rect = new Rectangle(PageSize.A4);
rect.setBackgroundColor(Color.YELLOW);
Document document = new Document(rect);
PdfWriter.getInstance(document, new FileOutputStream(
sample.pdf));
document.open();
document.add(new Paragraph(Hello World!));
rect.setBackgroundColor(Color.ORANGE);
document.setPageSize(rect);
document.newPage();
document.add(new Paragraph(Hello World!));
rect.setBackgroundColor(Color.GRAY);
document.setPageSize(rect);
document.newPage();
document.add(new Paragraph(Hello World!));
document.close();
}

public static void solution1() throws IOException,
DocumentException {
PdfReader reader = new PdfReader(sample.pdf);
int n = reader.getNumberOfPages();
Document document = new Document(PageSize.A4);
PdfWriter writer = PdfWriter.getInstance(document, new
FileOutputStream(solution1.pdf));
document.open();
PdfContentByte directcontent = writer.getDirectContent();
BaseFont font = BaseFont.createFont(BaseFont.HELVETICA,
BaseFont.WINANSI, BaseFont.NOT_EMBEDDED);
PdfImportedPage page;
Image image;
for (int i = 1; i = n; i++) {
page = writer.getImportedPage(reader, i);
image = Image.getInstance(page);
image.scaleAbsolute(PageSize.A4.getWidth() - 72,
PageSize.A4.getHeight() - 72);
image.setAbsolutePosition(36, 36);
directcontent.addImage(image);
directcontent.beginText();
directcontent.setFontAndSize(font, 12);

Re: [iText-questions] SOLVED How to Enable Save Attachment Dialog in Adobe

2007-07-14 Thread Leonard Rosenthol
On Jul 14, 2007, at 5:37 PM, Harakiri wrote:

 Ok i figured out the root of the problem.

 For Adobe there is a difference between

 a) An attachment somewhere on a specific page
   
 b) An attachment attached to the PDF

 Method b) will enable the Save Dialog in the
 Attachment Pane, whereas a) will not. The only way to
 issue a save is rightclick on the annotation hotspot.

That is 100% correct - and has been since Acrobat 5 (PDF 1.4) when  
(b) was introduced.  (a) was introduced in Acrobat 4 (PDF 1.3).


 I did not find an option to actually reproduce a
 hotspot with attachment link like a) in adobe acrobat
 to see if the pdf performs the same...

Use the File Attachment Tool - been there since Acrobat 4.

And yes, it will behave EXACTLY the same.


 Whats the difference between the two ? I want a
 reference in my pdf and the save button should work in
 the attachment pane...

Then use the attachment form instead of the annotation form.


Leonard


-
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] SOLVED How to Enable Save Attachment Dialog in Adobe

2007-07-14 Thread Harakiri
Im not sure i can follow you, if i use the attachment
form i cant have a reference in my pdf without GOTOE..

Or are you refering to something else ?

Can i actually create a hotspot to an attachment
without GOTOE ?


--- Leonard Rosenthol [EMAIL PROTECTED] wrote:


  Whats the difference between the two ? I want a
  reference in my pdf and the save button should
 work in
  the attachment pane...
 
   Then use the attachment form instead of the
 annotation form.
 
 
 Leonard
 
 

-
 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/
 



   

Boardwalk for $500? In 2007? Ha! Play Monopoly Here and Now (it's updated for 
today's economy) at Yahoo! Games.
http://get.games.yahoo.com/proddesc?gamekey=monopolyherenow  

-
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] Populate forms that do not use Acro Fields

2007-07-14 Thread scott carter

I have a collection of forms that I need to automatically populate based on
data in our database.  I have looked at the Register example on the site,
and the example works great for forms that use Acro Fileds (
PdfStamper.getAcroFileds()).  I am running into several forms that do not
return any fields using this approach that I need to find a way to
populate.  I am a beginner, so any help is greatly apprciated. One of the
forms that I need to figure out how to populate but does not have a Acro
fileds is found here -
https://www.pfizerhelpfulanswers.com/files/C2C_English.pdf .   Anyone know
how to do this?

Thanks in advance.
-
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] SOLVED How to Enable Save Attachment Dialog in Adobe

2007-07-14 Thread Leonard Rosenthol
Yes, you can use the Launch action to also open up attachments.

Leonard


On Jul 14, 2007, at 10:29 PM, Harakiri wrote:

 Im not sure i can follow you, if i use the attachment
 form i cant have a reference in my pdf without GOTOE..

 Or are you refering to something else ?

 Can i actually create a hotspot to an attachment
 without GOTOE ?


 --- Leonard Rosenthol [EMAIL PROTECTED] wrote:


 Whats the difference between the two ? I want a
 reference in my pdf and the save button should
 work in
 the attachment pane...

  Then use the attachment form instead of the
 annotation form.


 Leonard



 -- 
 ---
 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/





 __ 
 __
 Boardwalk for $500? In 2007? Ha! Play Monopoly Here and Now (it's  
 updated for today's economy) at Yahoo! Games.
 http://get.games.yahoo.com/proddesc?gamekey=monopolyherenow

 -- 
 ---
 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] Populate forms that do not use Acro Fields

2007-07-14 Thread William Alexander Segraves
- Original Message -
From: scott carter [EMAIL PROTECTED]
To: itext-questions@lists.sourceforge.net
Sent: Saturday, 14 July, 2007 3:35 PM
Subject: [iText-questions] Populate forms that do not use Acro Fields


 I have a collection of forms that I need to automatically populate based
on
 data in our database.  I have looked at the Register example on the site,
 and the example works great for forms that use Acro Fileds (
 PdfStamper.getAcroFileds()).

Yes, but the examples in the tutorial can only carry you so far. What you
really, really need to do if you wish to work with iText is purchase a copy
of the book _iText in Action_ (see the Buy the eBook link at
www.lowagie.com/iText).

 I am running into several forms that do not
 return any fields using this approach that I need to find a way to
 populate.

You should not expect to be able to populate fields that do not (yet) exist.
Burn this fact into your brain permanently. You'll be glad you did.

 I am a beginner, so any help is greatly apprciated. One of the
 forms that I need to figure out how to populate but does not have a Acro
 fileds is found here -
 https://www.pfizerhelpfulanswers.com/files/C2C_English.pdf .   Anyone know
 how to do this?


Yes. There are several examples in the book (see Chapters 2 and 15) and on
the book support site that will be helpful to you in your quest to convert
PDF forms (unfillable) into AcroForms (fillable).

 Thanks in advance.


You're very welcome! Reminders: (1) Buy the book. (2) You can't fill fields
that don't (yet) exist.

Cheers,

Bill Segraves




-
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/