Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!

Debenu Quick PDF Library - PDF SDK Community Forum Homepage
Forum Home Forum Home > For Users of the Library > General Discussion
  New Posts New Posts RSS Feed - Adding Images to Templates
  FAQ FAQ  Forum Search   Register Register  Login Login

Adding Images to Templates

 Post Reply Post Reply
Author
Message
jabaltie View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 Nov 05
Location: Brazil
Status: Offline
Points: 138
Post Options Post Options   Thanks (0) Thanks(0)   Quote jabaltie Quote  Post ReplyReply Direct Link To This Post Topic: Adding Images to Templates
    Posted: 16 Jan 06 at 8:07AM
This message is a bit long. Sorry...

I have PDF templates, which are simply PDF with empty form fields.

I stuff data onto these fields on-the-fly, using SetFormFieldValue.

I read the data to be filled in from a XML document that comes from a Unisys mainframe and was generated in Cobol.

So, it works like this : I generate the XML text file on the mainframe and download it. Then I read the XML document. There inside this XML I have the name of the PDF template that I must use to fill in. I also have an array of form field name/form field value inside this XML. So, I loop across this entity of the XML and do the form filling on the PDF. After all, I save (or print) the resulting PDF.

Should you want to have a look on a XML, get a sample from here :

http://www.DES.online.unimep.br/au/pdffields.xml

So far, so good. It's working perfectly.

But now I also want to sophisticate it some more, by adding dynamic images on-the-fly, which are always JPG files, as if they were form fields. I'm not talking about logotypes for instance cause these images would be there on the PDF template already. They're static. I'm talking about dynamic (variable) images.

Examples of use for that :

1) I have a form where I want to add the photo (picture) of the student (we're an University).

2) On another form, I want to add a scanned copy of the student's identification document.

3) Yet, on another form, I want to add a map of the place where the student should go to his/her first class on the University.

And so far...

So my plan is to specify another entity within that original XML that comes from the mainframe. This entity would be a list of the image paths to be added. Images are always JPG files and the XML would specify the path of the image to be added , its positioning within the PDF file and also the image size.

Then, finally, my question :

After grabbing the data related to the image from the XML file, which would be the best function to add these images onto the PDF ? Would it be FitImage ?

I guess so but, would this be function be generic enough to all of the images I want to add ?

I'm considering that all of the images :

- are always locallly resident (that is, they always will reside on my hard-disk, although I could later generalize the image path to be also an URL, so I could later fetch the image from outside. For our purposes however we should think that the image would reside locally. If it is not local it would be brought to a local path.
- are always JPG files
- some are black and white, mostly scanned documents, whereas others are colorful, such as pictures (photos)

So, the XML image token would look like :

<IMAGES>
<IMAGE>
    <ORIGIN TYPE="PATH|URL">
       C:\SOMEWHERE\DOWN\ON\MY\HARD\DISK\PHOTO.JPG
    </ORIGIN>
    <LEFT>NUMBER</LEFT>
    <TOP>NUMBER</TOP>
    <WIDTH>NUMBER</WIDTH>
    <HEIGHT>NUMBER</HEIGHT>
    <HALIGN>NUMBER</HALIGN>
    <VALIGN>NUMBER</VALIGN>
    <ROTATE>NUMBER</ROTATE>
</IMAGE>
</IMAGES>

Notice that the XML simply "mimics" the FitImage arguments. So I would translate this XML entity to a call to AddImageFromfile and then FitImage.

I also should specify a standard measurement unit for the numbers to be specified on the XML.

After all, what do you think ?

Is it a good plan ?

Will "FitImage" be generic enough to add all of the images that would come from the XML ?

Would there be some missing information on the original XML or something that would be nice to have, something that could be handy later ?

Sorry for being so long...

Thank you so much for the appreciation of the issue.

Back to Top
jabaltie View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 Nov 05
Location: Brazil
Status: Offline
Points: 138
Post Options Post Options   Thanks (0) Thanks(0)   Quote jabaltie Quote  Post ReplyReply Direct Link To This Post Posted: 16 Jan 06 at 8:14AM
Ah, I forgot to mention:

Here are some samples of the images I'd like to add :

- A student's photo :

http://www.DES.online.unimep.br/au/photo.jpg

- The student's identification document (a scanned copy of it ) :

http://www.DES.online.unimep.br/au/ident.jpg

Thanks again !
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.

Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. AboutContactBlogSupportOnline Store