Just wondering if anyone had any suggestions as to my problem. Need help bad.
I will try to explain what my goal is on this project. I am sending values
from text fields from flash to itext processing page to create a pdf. From
flash I know what the X Y coordinates of the text is and I want to place
that text at the same coordinates on the pdf. I am trying to use the code
that I have posted but i keep getting an error when using
Line1.setFontAndSize(newfont, javacast("int", 26));
It says that the method doesnt exist but i know it does. Desperate help is
needed. THANK IN ADVANCE!
NetDvlpr wrote:
>
> Well, I am using the javaloader with still no luck. I still get the same
> error. I even tried dropping it into the lib folder and it still didnt
> work. I will drop in my whole code for you to look at. By the way you said
> you use cfdocument for 80-90% of your pdf rendering. I was trying to use
> that but the post card i am using is 4x6 and cfdoc will not let me size my
> page to that. Yes, i am using pagetype=custom and pagewidth=6 and
> pageheight=4. Any ideas on that one? Again thanks for your time.
>
> <cfscript>
>
> // create a Document object
> rectangle = CreateObject("java", "com.lowagie.text.Rectangle");
> pageSize = Rectangle.init(1740, 1166);
> Element = CreateObject("java", "com.lowagie.text.Element");
> cb = CreateObject("java", "com.lowagie.text.pdf.PdfContentByte");
> document = CreateObject("java",
> "com.lowagie.text.Document").init(pageSize, 0, 0, 0, 0);
> Image = CreateObject("java", "com.lowagie.text.Image");
> paragraph = CreateObject("java", "com.lowagie.text.Paragraph");
> Phrase = CreateObject("java", "com.lowagie.text.Phrase");
> Chunk = CreateObject("java", "com.lowagie.text.Chunk");
>
> // the fonts
> BaseFont = createObject("java", "com.lowagie.text.pdf.BaseFont");
> FontFactory = createObject("java", "com.lowagie.text.FontFactory");
> Font = createObject("java", "com.lowagie.text.Font");
> numfonts = FontFactory.registerDirectories();
> sysfonts = FontFactory.getRegisteredFonts();
> newfont = FontFactory.getFont(FontFactory.HELVETICA, javacast("int", 26),
> javacast("int",0));
>
>
> // call pdf writer
> fileIO = CreateObject("java", "java.io.FileOutputStream");
> fileIO.init("#expandpath("pdf\pc1.pdf")#");
> writer = CreateObject("java", "com.lowagie.text.pdf.PdfWriter");
> writer.getInstance(document, fileIO);
>
> document.open();
>
> //add the image
> jpg = Image.getInstance("#expandpath("img1.jpg")#");
> jpg.setAbsolutePosition(0, 0);
> jpg.scaleToFit(1800, 1166);
> jpg.setDpi(300,300);
> jpg.setAlignment(Image.UNDERLYING);
> document.add(jpg);
>
>
> //create phrase
> p1 = Phrase.init(30, "#form.TB1#", newfont);
> p2 = Phrase.init(30, "this is test 2.", newfont);
> //c1 = Chunk.init("this is test 3", newfont);
>
> document.add(p1);
> document.add(Chunk.NEWLINE);
> document.add(p2);
>
> Line1 = cb.init(writer);
> Line1.beginText();
> Line1.setFontAndSize(newfont, javacast("int", 26));
> text = "Show this text on the pdf.";
> Line1.showTextAligned(1, text, 250, 700, 0);
>
> Line1.endText();
>
>
>
>
> //create a paragraph
> /*p1 = paragraph.init("#form.TB1#", newfont);
> p1.setAlignment(Element.ALIGN_LEFT);
> p1.setIndentationLeft(800);
> p1.setSpacingAfter(5);
>
> document.add(p1);*/
>
>
>
> document.newPage();
>
> //add the image
> jpg = Image.getInstance("#expandpath("img2.jpg")#");
> jpg.setAbsolutePosition(0, 0);
> jpg.scaleToFit(1800, 1166);
> jpg.setDpi(300,300);
> jpg.setAlignment(Image.UNDERLYING);
> document.add(jpg);
>
> document.close();
> </cfscript>
>
>
>
> Paul Hastings wrote:
>>
>> NetDvlpr wrote:
>>> I have MX7 and I downloaded the newest jar file from itext site. I then
>>> placed that jar file in my lib/ dir. I do know that the newest itext jar
>>
>> the old iText jar that cfdocument uses will always get loaded before your
>> versions. if you try replacing that jar with the latest iText version it
>> breaks
>> cfdocument (which frankly works well for about 80-90% of our PDf needs).
>> so you
>> have two choices:
>>
>> either use a refactored iText jar (i have one for 1.4.6 at
>> http://www.sustainableGIS.com/projects/iText/itextNew.jar where the iText
>> classes are renamed to iTextNew) & place it in cf's classpath
>> (stop/re-start the
>> cf service).
>>
>> or better yet use the latest version of mark mandel's javaLoader CFC
>> (make sure
>> it's 0.3) & place your iText jar anywhere you want. i've tested iText
>> w/the
>> latest version of that CFC. you can find the CFC at
>> http://www.compoundtheory.com/?action=javaloader.index
>>
>>
>> -------------------------------------------------------------------------
>> Take Surveys. Earn Cash. Influence the Future of IT
>> Join SourceForge.net's Techsay panel and you'll get the chance to share
>> your
>> opinions on IT & business topics through brief surveys - and earn cash
>> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>> _______________________________________________
>> iText-questions mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/itext-questions
>> Buy the iText book: http://itext.ugent.be/itext-in-action/
>>
>>
>
>
--
View this message in context:
http://www.nabble.com/iText-and-coldfusion-tf2934941.html#a8218503
Sent from the iText - General mailing list archive at Nabble.com.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/