Re: RE: Please help ...

2009-05-05 Thread Andreas Lehmkühler
Hi,

> The issue with regard to my Point 2 still remains, which I repeat below. We
> have a case where the name being set for one of the fields in the PDF is
> longer than the space provided and one solution is to reduce the font size
> and/or use a different font type. 
>  
> 2. When we set the value of a form field in a PDF document using the
> setValue option, can I specify the font type and size using which the value
> needs to be displayed (overriding the font type and size used while creating
> the control)?
I'm not familiar with all of the formular stuff . I believe you have to have a 
look at the sourcecode itself, I guess especially the stuff in 
org.apache.pdfbox.pdmodel.interactive.form.*
Furthermore there are some little samples (org.apache.pdfbox.examples.*) 
demonstrating several features of pdfbox, perhaps, you'll find some input 
studying them.

Sorry, that's not much, but perhaps some good points to start...

Andreas Lehmkühler

> Thanks & Regards
>  
> Venkatesh Prasad.B.K.
> 
> 
> 
> From: Venkatesh Prasad
> Sent: Mon 5/4/2009 8:51 PM
> To: pdfbox-users@incubator.apache.org; pdfbox-users@incubator.apache.org
> Subject: Please help ...
> 
> 
> Sir,
>  
> I have been successful in developing the code to set values to the
> form-fields of a PDF doument. I have a few questions listed below related to
> merging of 2 PDF documents as well as about setting fonts. Can someone
> help?
>  
> 1. I have 3 PDF documents where I have set the form-field values in each of
> them. I want to combine the 3 PDF documents to create a single PDF document.
> I have tried the addPage option as well as importPage option but the issue
> is that the form fields of second and third PDF documents are not visible
> (or not set) in the combined document.
>  
>try {
> PDDocument document = PDDocument.load("test.pdf");
> PDDocument doc = PDDocument.load("test1.pdf");
> List allPages = doc.getDocumentCatalog().getAllPages();
>  
> PDPage page = (PDPage)allPages.get(0);
> PDPage page1 = doc.importPage(page);
> document.importPage(page1);
> document.save("parent_1.pdf");
> document.close();
> doc.close();
>} catch (Exception e) {
>}
> 
> 2. When we set the value of a form field in a PDF document using the
> setValue option, can I specify the font type and size using which the value
> needs to be displayed (overriding the font type and size used while creating
> the control)?
>  
> This has been my third posting and unfortunately <|:-( there has been no
> response to the other two! Hope I am lucky with this one! <|:-)
>  
> Thanks & Regards
>  
> Venkatesh Prasad.B.K.
> 

--- original Nachricht Ende 



Re: Re: Please help !

2009-05-04 Thread Daniel Wilson
Khaled,

If Andreas says the new version should work better with fonts, I'm sure he's
right.  He's done a lot of work in that area.

If you want a recent version precompiled, I've got one at
http://www.blacklocustsoftware.com/PDFBox_Binaries.php

It won't be up to date tomorrow, but today it is :)

Daniel

2009/5/4 Andreas Lehmkühler 

> > The development version (0.8.0) has far better font support.  I believe
> you
> > will need to download the source code & compile it, but I think it will
> do
> > what you want.
> I'd suggest the same.
>
> > If one of the other developers knows where a build is available, please
> > correct me!
> There is no newer precompiled version of pdfbox available yet, but we are
> working on it...
>
> Andreas Lehmkühler
>
> > Daniel Wilson
> >
> > On Mon, May 4, 2009 at 7:29 AM, Khaled Daifallah
> > wrote:
> >
> > > Dear Sir,
> > >
> > > I'm using Apache PDFBox0.7.3 library in order to fill out text-fields
> of
> > a
> > > PDF form .
> > > Some of the filled values are in Arabic, so the problem that when i
> open
> > > the
> > > PDF form after filling by Adobe Reader 9 or Adobe Acrobat 9 pro, i get
> > > question marks (???) instead of the Arabic letters.
> > >
> > > now i'll go into details.
> > > 1- I created the PDF form using Adobe LifeCycle Designer.
> > > 2- The problem only appears with Arabic letters (no problem with
> English
> > > letters).
> > > 3- the font which is used for the fields is Arial so i tried to embed
> > both
> > > Arial and Arial Blod as:
> > >
> > >PDDocument doc = PDDocument.load(formPath);
> > >PDTrueTypeFont.loadTTF( doc,new File(path_of_the_ttf_file) );
> > >PDDocumentCatalog docCatalog =  doc.getDocumentCatalog();
> > >PDAcroForm acroForm =  docCatalog.getAcroForm();
> > >... *Filling the fields with the values here ..*
> > >acroForm.setXFA( null );
> > >doc.save(destPath);
> > >doc.close();
> > >
> > >But this didn't work (i still get question marks for the Arabic
> > > letters).
> > >
> > >
> > > 4- When i fill the text-fields of the PDF form manually (by Adobe
> Acrobat
> > 9
> > > pro) i get no problem.
> > >
> > > 5- i tried to edit the file "PDFBox_External_Fonts.properties" as well,
> > and
> > > i copied the fonts to the path "Resources/ttf". but i still get
> question
> > > marks.
> > >
> > > i've working on this problem for more than 10 days, and i'm stucked
> now.
> > > and you are my final salvation. PLEASE HELP ME IF YOU CAN.
> > >
> > >
> > > Thanks for your concern
> > > KHALED DAIFALLAH.
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > --
> > > The Captin 121
> > >   KHALED
> > >
> >
>
> --- original Nachricht Ende 
>
>


RE: Please help ...

2009-05-04 Thread Venkatesh Prasad
I have found the PDFMergerUtility using which I was able to merge the documents 
without losing the form-field values in the combined PDF. 
 
PDFMergerUtility mergePDFs = new PDFMergerUtility();
mergePDFs.addSource("test.pdf");
mergePDFs.addSource("test1.pdf");
mergePDFs.addSource("test2.pdf");
mergePDFs.addSource("test3.pdf");
mergePDFs.setDestinationFileName("test_all.pdf");
mergePDFs.mergeDocuments();
 
The issue with regard to my Point 2 still remains, which I repeat below. We 
have a case where the name being set for one of the fields in the PDF is longer 
than the space provided and one solution is to reduce the font size and/or use 
a different font type. 
 
2. When we set the value of a form field in a PDF document using the setValue 
option, can I specify the font type and size using which the value needs to be 
displayed (overriding the font type and size used while creating the control)?
 
Thanks & Regards
 
Venkatesh Prasad.B.K.



From: Venkatesh Prasad
Sent: Mon 5/4/2009 8:51 PM
To: pdfbox-users@incubator.apache.org; pdfbox-users@incubator.apache.org
Subject: Please help ...


Sir,
 
I have been successful in developing the code to set values to the form-fields 
of a PDF doument. I have a few questions listed below related to merging of 2 
PDF documents as well as about setting fonts. Can someone help?
 
1. I have 3 PDF documents where I have set the form-field values in each of 
them. I want to combine the 3 PDF documents to create a single PDF document. I 
have tried the addPage option as well as importPage option but the issue is 
that the form fields of second and third PDF documents are not visible (or not 
set) in the combined document.
 
   try {
PDDocument document = PDDocument.load("test.pdf");
PDDocument doc = PDDocument.load("test1.pdf");
List allPages = doc.getDocumentCatalog().getAllPages();
 
PDPage page = (PDPage)allPages.get(0);
PDPage page1 = doc.importPage(page);
document.importPage(page1);
document.save("parent_1.pdf");
document.close();
doc.close();
   } catch (Exception e) {
   }

2. When we set the value of a form field in a PDF document using the setValue 
option, can I specify the font type and size using which the value needs to be 
displayed (overriding the font type and size used while creating the control)?
 
This has been my third posting and unfortunately <|:-( there has been no 
response to the other two! Hope I am lucky with this one! <|:-)
 
Thanks & Regards
 
Venkatesh Prasad.B.K.


Re: Re: Please help !

2009-05-04 Thread Andreas Lehmkühler
> The development version (0.8.0) has far better font support.  I believe you
> will need to download the source code & compile it, but I think it will do
> what you want.
I'd suggest the same.

> If one of the other developers knows where a build is available, please
> correct me!
There is no newer precompiled version of pdfbox available yet, but we are 
working on it...

Andreas Lehmkühler

> Daniel Wilson
> 
> On Mon, May 4, 2009 at 7:29 AM, Khaled Daifallah
> wrote:
> 
> > Dear Sir,
> >
> > I'm using Apache PDFBox0.7.3 library in order to fill out text-fields of
> a
> > PDF form .
> > Some of the filled values are in Arabic, so the problem that when i open
> > the
> > PDF form after filling by Adobe Reader 9 or Adobe Acrobat 9 pro, i get
> > question marks (???) instead of the Arabic letters.
> >
> > now i'll go into details.
> > 1- I created the PDF form using Adobe LifeCycle Designer.
> > 2- The problem only appears with Arabic letters (no problem with English
> > letters).
> > 3- the font which is used for the fields is Arial so i tried to embed
> both
> > Arial and Arial Blod as:
> >
> >PDDocument doc = PDDocument.load(formPath);
> >PDTrueTypeFont.loadTTF( doc,new File(path_of_the_ttf_file) );
> >PDDocumentCatalog docCatalog =  doc.getDocumentCatalog();
> >PDAcroForm acroForm =  docCatalog.getAcroForm();
> >... *Filling the fields with the values here ..*
> >acroForm.setXFA( null );
> >doc.save(destPath);
> >doc.close();
> >
> >But this didn't work (i still get question marks for the Arabic
> > letters).
> >
> >
> > 4- When i fill the text-fields of the PDF form manually (by Adobe Acrobat
> 9
> > pro) i get no problem.
> >
> > 5- i tried to edit the file "PDFBox_External_Fonts.properties" as well,
> and
> > i copied the fonts to the path "Resources/ttf". but i still get question
> > marks.
> >
> > i've working on this problem for more than 10 days, and i'm stucked now.
> > and you are my final salvation. PLEASE HELP ME IF YOU CAN.
> >
> >
> > Thanks for your concern
> > KHALED DAIFALLAH.
> >
> >
> >
> >
> >
> >
> >
> > --
> > The Captin 121
> >   KHALED
> >
> 

--- original Nachricht Ende 



Re: Please help !

2009-05-04 Thread Daniel Wilson
The development version (0.8.0) has far better font support.  I believe you
will need to download the source code & compile it, but I think it will do
what you want.

If one of the other developers knows where a build is available, please
correct me!

Daniel Wilson

On Mon, May 4, 2009 at 7:29 AM, Khaled Daifallah wrote:

> Dear Sir,
>
> I'm using Apache PDFBox0.7.3 library in order to fill out text-fields of a
> PDF form .
> Some of the filled values are in Arabic, so the problem that when i open
> the
> PDF form after filling by Adobe Reader 9 or Adobe Acrobat 9 pro, i get
> question marks (???) instead of the Arabic letters.
>
> now i'll go into details.
> 1- I created the PDF form using Adobe LifeCycle Designer.
> 2- The problem only appears with Arabic letters (no problem with English
> letters).
> 3- the font which is used for the fields is Arial so i tried to embed both
> Arial and Arial Blod as:
>
>PDDocument doc = PDDocument.load(formPath);
>PDTrueTypeFont.loadTTF( doc,new File(path_of_the_ttf_file) );
>PDDocumentCatalog docCatalog =  doc.getDocumentCatalog();
>PDAcroForm acroForm =  docCatalog.getAcroForm();
>... *Filling the fields with the values here ..*
>acroForm.setXFA( null );
>doc.save(destPath);
>doc.close();
>
>But this didn't work (i still get question marks for the Arabic
> letters).
>
>
> 4- When i fill the text-fields of the PDF form manually (by Adobe Acrobat 9
> pro) i get no problem.
>
> 5- i tried to edit the file "PDFBox_External_Fonts.properties" as well, and
> i copied the fonts to the path "Resources/ttf". but i still get question
> marks.
>
> i've working on this problem for more than 10 days, and i'm stucked now.
> and you are my final salvation. PLEASE HELP ME IF YOU CAN.
>
>
> Thanks for your concern
> KHALED DAIFALLAH.
>
>
>
>
>
>
>
> --
> The Captin 121
>   KHALED
>