Java Mailing List Archive

http://www.junlu.com/

Google
Google
Mailing List
Home
Forum Home
JBoss - Java Application Server
Tomcat - JSP/Servlet container
Struts - A MVC web framework
iText - An open source PDF Java Library
JDOM - JDOM XML Parser
JSP - A mailing list about Java Server Pages specification and reference
J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition
J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog
Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology
Struts & Hibernate
Subjects
JSP editor plugin for eclipse ?
org apache jasper JasperException: Unable to compile class for JSP
Tomcat: Connection reset by peer: socket write error
Cannot retrieve definition for form bean null
Struts Tiles Tutorial (free Struts training)
Where do I download Tomcat 4 0 6?
Data Access Object (DAO) pattern, example DAO 's
Where to download Tomcat v 4 1 24 from?
Tomcat 5 0 16 Requested resource not available
Servlet : Session invalidate
Oracle Connection Pooling in 3 2 2
Servlet action is currently unavailable
Tomcat/Struts Unicode Encoding/Decoding problems
Running a Simple JMS Example
Tomcat and webapplication specific java library path
Mapping in workers2 properties
org apache jasper JasperException
problem with html:text bean throwing exception
Cannot find message resources under key org apache struts action
   MESSAGE
Cannot find message resources under key org apache struts action MESSAGE
invalid direct reference problem with solution
Tool for jsp debug Try Sysdeo Eclipse Plugin
Tomcat 5 Cannot load JDBC driver class 'null ' SQL state: null
weblogic ejbc
java properties file
Jboss 3 2 3 Coyote Can 't re
Tomcat 5, Apache2 and mod jk2 integration problem
JBoss example problem new to J2EE
Value attribute of <html:checkbox
url string for connecting jboss to oracle
javax servlet ServletException: BeanUtils populate
5 0 18: Windows XP Pro vs Windows 2000
HTTP Status 404 The requested resource is not available
 
-none-

-none-

2007-10-03       - By Dennis Racine

 Back
I don't have a problem taking out the setGenerateAppearances(false) but
what can i do about keeping the font sizes of the form data the same
when the form is populated and/or flattened? They are currently
increasing in size from their original setting.


Dennis Racine wrote:
> I'm having an issue. When I populate a form with form.setField and
> also use the 'setGenerateAppearances(false)' the form opens with the
> correct font sizes for data in my form fields.
> If I add the form.setFormFlattening(true); then most of the fields
> don't even show any data. If I take out the
> setGenerateAppearances(false) when flattening, then the data appears,
> but a size or 2 bigger than it should be.
> What am i doing wrong? Shouldn't it be the same?
>
> here is my code:
>
>
> <cfscript>
>  
> flatten = #flatRest#;                //define path and file name of
> the PDF template with form
> pdfFile="#inputPDF#";    //define the name of my output file
> newFile="#DestFile#";    //create the output file
> if (flatten is true){
> fileIO=createObject("java","java.io.FileOutputStream").init(newFile);
>                         //load the template PDF with the iText PDF reader
> } else {
> fileIO=createObject("java","java.io.ByteArrayOutputStream").init();
> }
> reader =
> createObject("java","com.lowagie.text.pdf.PdfReader").init(pdfFile);    
>             //load the template into the iText PDF stamper and specify
> the output file
> pdfStamper =
> createObject("java","com.lowagie.text.pdf.PdfStamper").init(reader,
> fileIO);    //create a form object to reference
> pdfForm = pdfStamper.getAcroFields();    
> PDFFormField =
> createObject("java","com.lowagie.text.pdf.PdfFormField");            
>         //create object to field attributes
> PDFName = createObject("java","com.lowagie.text.pdf.PdfName");
> data.set = 8;
> //set the form fields
> for (x=1; x lte arraylen(fieldnamelist); x=x+1)
> {
>     writeoutput("<BR>Processing Field: " & fieldnamelist[x]);    
>     curField = pdfForm.getFieldItem(fieldnamelist[x]);
>     if (isDefined("curField")){
>         merged = curField.merged.get(0);
>         if (PDFName.TX.equals(merged.get(PDFName.FT))){
>             n = merged.get(PdfName.FF);
>                 if (isDefined("n") AND BitAnd(n.intValue(),
> PdfFormField.FF_MULTILINE) != 0){
>                     writeOutput("<BR> Found Multiline");
>                     pdfForm.setExtraMargin(0, 5.2);
>                 }
>         }
>     }
>     pdfForm.setField(fieldnamelist[x], datalist[x]);    
>     pdfForm.setExtraMargin(0, 0);
>     //pdfForm.setFieldProperty(fieldnamelist[x], "textsize", 8);  //no
> workie: "The setFieldProperty method was not found."
>     pdfForm.setGenerateAppearances(false);
>      
>     writeOutput("<BR>the Value is: "& PdfFormfield.FF_Multiline);
> }
> //Flatten
> if (flatten is true){
> pdfStamper.setFormFlattening(true);
> writeoutput("<BR>Flattening Done...");
> }
> pdfStamper.close(); //close pdfStamper (form Filling)
>  
> if (flatten is false){
> // Prepare and display resulting pdf in browser
> context  = getPageContext();
>            context.setFlushOutput(false);
> response = context.getResponse().getResponse();
> out      = response.getOutputStream();
>            response.setContentType("application/pdf");
>            response.setContentLength(fileIO.size());
>            out.write(fileIO.toByteArray());
>            out.flush();
>            out.close();
> }
> fileIO.close(); // close fileIO
> </cfscript>
> --
> -- ---- ---- ---- ---- ---- ------
> Racine-Web Design
> Dennis Racine
>
> Tel. 530-470-8751
> Fax (408) 904-4816
>
> website: http://www.racine-web.com
> webmaster@(protected)
>
>
> Instant Messangers:
> Yahoo: dennis_racine
> MSN: dennis_rcracing@(protected) (IM Only)
> AIM: DRacine33E
> ICQ: 967354
>
>
> -- ---- ---- ---- ---- ---- ------
>  
>
> -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
> If this email is spam, report it here:
> http://www.OnlyMyEmail.com/ReportSpam
> <http://www.onlymyemail.com/view/?action=reportSpam&Id
=MzEyMjU6NDA4MDUzNjU0OmRlbm5pc0ByYWNpbmUtd2ViLmNvbQ%3D%3D>
>
> -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -----
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2005.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>
>
> --
> If this email is spam, report it here:
> http://www.onlymyemail.com/view/?action=reportSpam&Id
=MzEyMjU6NDA4MDUzNjU0OmRlbm5pc0ByYWNpbmUtd2ViLmNvbQ%3D%3D
>  
> -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
>
> __ ____ ____ ____ ____ ____ ____ ____ ____ ____
> iText-questions mailing list
> iText-questions@(protected)
> https://lists.sourceforge.net/lists/listinfo/itext-questions
> Buy the iText book: http://itext.ugent.be/itext-in-action/
>
>
>
> --
> If this email is spam, report it here:
> http://www.onlymyemail.com/view/?action=reportSpam&Id
=MzEyMjU6NDA4MDUzNjU0OmRlbm5pc0ByYWNpbmUtd2ViLmNvbQ%3D%3D
>  

--
-- ---- ---- ---- ---- ---- ------
Racine-Web Design
Dennis Racine

Tel. 530-470-8751
Fax (408) 904-4816

website: http://www.racine-web.com
webmaster@(protected)


Instant Messangers:
Yahoo: dennis_racine
MSN: dennis_rcracing@(protected) (IM Only)
AIM: DRacine33E
ICQ: 967354


-- ---- ---- ---- ---- ---- ------


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
 <meta content="text/html;charset=ISO-8859 (See http://ISO-8859.ora-code.com)-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<font size="-1">I don't have a problem taking out the </font><font
size="-1">setGenerateAppearances(false) but what can i do about
keeping the font sizes of the form data the same when the form is
populated and/or flattened? They are currently increasing in size from
their original setting.<br>
<br>
</font><br>
Dennis Racine wrote:
<blockquote cite="mid46F40B8F.6020209@(protected)" type="cite">
 <meta content="text/html;charset=ISO-8859 (See http://ISO-8859.ora-code.com)-1" http-equiv="Content-Type">
 <font size="-1">I'm having an issue. When I populate a form with
form.setField and also use the 'setGenerateAppearances(false)' the form
opens with the correct font sizes for data in my form fields.<br>
If I add the form.setFormFlattening(true); then most of the fields
don't even show any data. If I take out the
setGenerateAppearances(false) when flattening, then the data appears,
but a size or 2 bigger than it should be. <br>
What am i doing wrong? Shouldn't it be the same?<br>
 <br>
here is my code:<br>
 <br>
 <br>
&lt;cfscript&gt;
 <br>
&nbsp;<br>
flatten = #flatRest#;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; //define path and file name of the
PDF template with form
 <br>
pdfFile="#inputPDF#";&nbsp;&nbsp;&nbsp; //define the name of my output file
 <br>
newFile="#DestFile#";&nbsp;&nbsp;&nbsp; //create the output file
 <br>
if (flatten is true){
 <br>
fileIO=createObject("java","java.io.FileOutputStream").init(newFile);
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; //load the template PDF with the iText PDF
reader
 <br>
} else {
 <br>
fileIO=createObject("java","java.io.ByteArrayOutputStream").init();&nbsp;
 <br>
}
 <br>
reader =
createObject("java","com.lowagie.text.pdf.PdfReader").init(pdfFile);&nbsp;&nbsp
;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; //load the template
into the iText PDF stamper and specify
the output file
 <br>
pdfStamper =
createObject("java","com.lowagie.text.pdf.PdfStamper").init(reader,
fileIO);&nbsp;&nbsp;&nbsp; //create a form object to reference
 <br>
pdfForm = pdfStamper.getAcroFields();&nbsp;&nbsp;&nbsp; &nbsp;<br>
PDFFormField =
createObject("java","com.lowagie.text.pdf.PdfFormField");&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; //create object to field attributes
 <br>
PDFName = createObject("java","com.lowagie.text.pdf.PdfName");
 <br>
data.set = 8;
 <br>
//set the form fields
 <br>
for (x=1; x lte arraylen(fieldnamelist); x=x+1)
 <br>
{
 <br>
&nbsp;&nbsp;&nbsp; writeoutput("&lt;BR&gt;Processing Field: " &amp;
fieldnamelist[x]);&nbsp;&nbsp;&nbsp; &nbsp;<br>
&nbsp;&nbsp;&nbsp; curField = pdfForm.getFieldItem(fieldnamelist[x]);
 <br>
&nbsp;&nbsp;&nbsp; if (isDefined("curField")){
 <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; merged = curField.merged.get(0);
 <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (PDFName.TX.equals(merged.get(PDFName
.FT))){
 <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; n = merged.get(PdfName
.FF);
 <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if
(isDefined("n") AND BitAnd(n.intValue(),
PdfFormField.FF_MULTILINE) != 0){
 <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; writeOutput("&lt;BR&gt; Found Multiline");
 <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; pdfForm.setExtraMargin(0, 5.2);
 <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }
 <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }
 <br>
&nbsp;&nbsp;&nbsp; }
 <br>
&nbsp;&nbsp;&nbsp; pdfForm.setField(fieldnamelist[x], datalist[x]);&nbsp;&nbsp;
&nbsp; &nbsp;<br>
&nbsp;&nbsp;&nbsp; pdfForm.setExtraMargin(0, 0);
 <br>
&nbsp;&nbsp;&nbsp; //pdfForm.setFieldProperty(fieldnamelist[x], "textsize", 8);
&nbsp; //no
workie: "The setFieldProperty method was not found."
 <br>
&nbsp;&nbsp;&nbsp; pdfForm.setGenerateAppearances(false);
 <br>
&nbsp;&nbsp;&nbsp; &nbsp;<br>
&nbsp;&nbsp;&nbsp; writeOutput("&lt;BR&gt;the Value is: "&amp;
PdfFormfield.FF_Multiline);
 <br>
}
 <br>
//Flatten
 <br>
if (flatten is true){
 <br>
pdfStamper.setFormFlattening(true);
 <br>
writeoutput("&lt;BR&gt;Flattening Done...");
 <br>
}
 <br>
pdfStamper.close(); //close pdfStamper (form Filling)
 <br>
&nbsp;<br>
if (flatten is false){
 <br>
// Prepare and display resulting pdf in browser
 <br>
context&nbsp; = getPageContext();
 <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; context
.setFlushOutput(false);
 <br>
response = context.getResponse().getResponse();
 <br>
out&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = response.getOutputStream();
 <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; response
.setContentType("application/pdf");
 <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; response
.setContentLength(fileIO.size());
 <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; out.write(fileIO
.toByteArray());
 <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; out.flush();
 <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; out.close();
 <br>
}
 <br>
fileIO.close(); // close fileIO
 <br>
&lt;/cfscript&gt;<br>
 </font>
 <pre class="moz-signature" cols="72">--
-- ---- ---- ---- ---- ---- ------
Racine-Web Design
Dennis Racine

Tel. 530-470-8751
Fax (408) 904-4816

website: <a class="moz-txt-link-freetext"
href="http://www.racine-web.com">http://www.racine-web.com</a>
<a class="moz-txt-link-abbreviated"
href="mailto:webmaster@(protected)">webmaster@(protected)</a>


Instant Messangers:
Yahoo: dennis_racine
MSN: <a class="moz-txt-link-abbreviated"
href="mailto:dennis_rcracing@(protected)">dennis_rcracing@(protected)</a> (IM
Only)
AIM: DRacine33E
ICQ: 967354


-- ---- ---- ---- ---- ---- ------
 </pre>
<!-- OnlyMyEmailReportSpamLink -->
 <br>
 <hr>
 <font
style="font-size: 11px; font-family: Verdana,Arial,Helvetica,sans-serif; color
: rgb(0, 0, 0);">If
this email is spam, report it here:<br>
 <a
href="http://www.onlymyemail.com/view/?action=reportSpam&amp;Id
=MzEyMjU6NDA4MDUzNjU0OmRlbm5pc0ByYWNpbmUtd2ViLmNvbQ%3D%3D"
style="color: rgb(51, 102, 153);">http://www.OnlyMyEmail.com/ReportSpam</a>
 </font><!-- OnlyMyEmailReportSpamLink -->
 <pre wrap="">-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------
-- ------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
<a class="moz-txt-link-freetext" href="http://clk.atdmt.com/MRT/go
/vse0120000070mrt/direct/01/">http://clk.atdmt.com/MRT/go/vse0120000070mrt
/direct/01/</a>


--
If this email is spam, report it here:
<a class="moz-txt-link-freetext" href="http://www.onlymyemail.com/view/?action
=reportSpam&Id=MzEyMjU6NDA4MDUzNjU0OmRlbm5pc0ByYWNpbmUtd2ViLmNvbQ%3D%3D">http:/
/www.onlymyemail.com/view/?action=reportSpam&amp;Id
=MzEyMjU6NDA4MDUzNjU0OmRlbm5pc0ByYWNpbmUtd2ViLmNvbQ%3D%3D</a>
 </pre>
 <pre wrap="">
<hr size="4" width="90%">
__ ____ ____ ____ ____ ____ ____ ____ ____ ____
iText-questions mailing list
<a class="moz-txt-link-abbreviated" href="mailto:iText-questions@(protected)
.sourceforge.net">iText-questions@(protected)</a>
<a class="moz-txt-link-freetext" href="https://lists.sourceforge.net/lists
/listinfo/itext-questions">https://lists.sourceforge.net/lists/listinfo/itext
-questions</a>
Buy the iText book: <a class="moz-txt-link-freetext" href="http://itext.ugent
.be/itext-in-action/">http://itext.ugent.be/itext-in-action/</a>



--
If this email is spam, report it here:
<a class="moz-txt-link-freetext" href="http://www.onlymyemail.com/view/?action
=reportSpam&Id=MzEyMjU6NDA4MDUzNjU0OmRlbm5pc0ByYWNpbmUtd2ViLmNvbQ%3D%3D">http:/
/www.onlymyemail.com/view/?action=reportSpam&amp;Id
=MzEyMjU6NDA4MDUzNjU0OmRlbm5pc0ByYWNpbmUtd2ViLmNvbQ%3D%3D</a>
 </pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
-- ---- ---- ---- ---- ---- ------
Racine-Web Design
Dennis Racine

Tel. 530-470-8751
Fax (408) 904-4816

website: <a class="moz-txt-link-freetext" href="http://www.racine-web.com">http
://www.racine-web.com</a>
<a class="moz-txt-link-abbreviated" href="mailto:webmaster@(protected)"
>webmaster@(protected)</a>


Instant Messangers:
Yahoo: dennis_racine
MSN: <a class="moz-txt-link-abbreviated" href="mailto:dennis_rcracing@(protected)
.com">dennis_rcracing@(protected)</a> (IM Only)
AIM: DRacine33E
ICQ: 967354


-- ---- ---- ---- ---- ---- ------
</pre>
</body>
</html>

-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -----
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
__ ____ ____ ____ ____ ____ ____ ____ ____ ____
iText-questions mailing list
iText-questions@(protected)
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

©2008 junlu.com - Jax Systems, LLC, U.S.A.