The cb.moveTo(50,50) shouldn't be there, you are starting a path and not 
ending it before you add the text.

Paulo

----- Original Message ----- 
From: "Glen Self" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Thursday, August 10, 2006 8:35 PM
Subject: [iText-questions] Mixing text and lines


>I am doing something wrong with mixing boxes and lines with my text.
> I keep getting the error "Illegal operation inside a path." from 
> acroreader7.
> I am attempting to replicate a form that needs to be emailed to people 
> that has
> lines and check boxes intermixed with hard text and text from a database.
> The snippet below shows what I am doing.
>
> PdfWriter writer = PdfWriter.getInstance(document,new
> FileOutputStream("HelloWorld.pdf"));
>
> document.addAuthor("Glen Self");
> document.addTitle("SDNA Questionaire");
>
> document.open();
>
> HeaderFooter footer = new HeaderFooter(new Phrase("Page "),true);
> footer.setAlignment(Element.ALIGN_CENTER );
> document.setFooter(footer);
>
> PdfContentByte cb = addBarCode(iPid, document, writer);
> cb.rectangle(20,580,300,70);
> cb.stroke();
>
> s_affsubdiv_flag = rsProv.getString("affsubdiv_flag");
> s_affsubdiv_text = rsProv.getString("affsubdiv");
>
> s_affsubdiv_flag = "S";
> if(s_affsubdiv_flag.contentEquals("S")){
>        print_box(cb, 158, 520, bfTimes,"Y");
> else{
>        print_box(cb, 158, 520, bfTimes,"");                         }
> //The following line works fine here as do the previous calls
> print_box(cb, 10, 460, bfTimes,"Y");
> cb.moveTo(50,50);
> cb.beginText();
> cb.setFontAndSize (bfTimesBold, 12);
>     cb.showTextAligned(PdfContentByte.ALIGN_CENTER,"PLEASE RETURN
> BY:",450,710,0);
>     cb.showTextAligned(PdfContentByte.ALIGN_CENTER,"July 7, 
> 2006",450,700,0);
> cb.endText();
> int iMarginMailAddr = 50;
> int iMargin = 12;
> cb.beginText();
> cb.setFontAndSize (bfTimes, 10);
>
> cb.setTextMatrix(iMarginMailAddr, 620);
> cb.showText(rsProv.getString("mail_to"));
> cb.moveText(0,-10);
> cb.newlineShowText(rsProv.getString("coname"));
> cb.moveText(0,-10);
> cb.showText(rsProv.getString("address1"));
> cb.endText();
>
> addPhoneNumberstest(rsProv, bfTimesBold, bfTimes, cb, iMargin);
>
> cb.beginText();
> cb.setFontAndSize (bfTimesBold, 10);
> cb.setTextMatrix(iMargin, 520);
> cb.showText("Date Inc.: ");
> cb.setFontAndSize (bfTimes, 10);
> cb.showText(rsProv.getString("inc_year"));
> cb.setFontAndSize (bfTimesBold, 10);
> cb.moveText(80,0);
> cb.showText("Your firm is a:     Sub      Div      Affil of : ");
> cb.setFontAndSize (bfTimes, 10);
> cb.showText(s_affsubdiv_text
> cb.endText();
>
> cb.beginText();
> cb.setTextMatrix(iMargin, 500);
> cb.showText("Website:");
> cb.moveText(80,0);
> cb.showText("Employer ID:");
> cb.moveText(-80,-20);
> cb.showText("Memberships:");
> cb.moveText(0,-20);
> cb.endText();
>
> //The following line breaks when used here
> print_box(cb, 10, 460, bfTimes,"Y");
> ......??????????????
>
> //Here is the routine to print the box
> private static void print_box(PdfContentByte cb, int xpos, int ypos, 
> BaseFont
> bfTimes, String yn) {
> cb.rectangle(xpos-1,ypos-2,10,10);
> cb.stroke();
> if(yn.length() > 0){
> cb.beginText();
>         cb.setTextMatrix(xpos, ypos);
>         cb.setFontAndSize (bfTimes, 10);
> cb.showText(yn);
> cb.endText();
> }
> }
>
>
>
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job 
> easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> iText-questions mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/itext-questions 


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to