Home | About us | Overview | Softwares - Downloads | Evaluate | Order | Support | old forums | Contact | F.A.Q. | Documentations | Search | Sitemap

Adding text without overwriting image

Support for GdPicture Light Imaging Toolkit and GdPicture Pro Imaging ActiveX/SDK.

Adding text without overwriting image

Postby senior on Thu Sep 18, 2008 4:45 pm

Hi,

Is it possible to add text (or a barcode) to the top of an image without overwriting anything contained in the image?

For example, you've scanned in a document and within your code you have a button to "Add Stamp" (so to speak). When the user clicks "Add Stamp" the text "APPROVED" (or whatever) is added to the top of the scanned image without overwriting anything in the scanned image. It seems the scanned image would need to be cropped, or dropped down, enough to fit the text or barcode. I haven't figured out how to do that.

I've figured out how to add text and/or barcodes but not without overwriting, or writing on top of, the current image.

Edit: this is in regards to PDF images.

Thanks.
senior
 
Posts: 20
Joined: Thu Aug 07, 2008 10:00 pm

Re: Adding text without overwriting image

Postby Tom Moran on Fri Sep 19, 2008 11:05 am

Hi Senior:

I had a need to do something very similar, recently. The method I used was a three step process.

1. Create a new blank image: Here you use the CreateNewImage method. The size properties would be the same as the original image plus the height and width needed to display your new text or barcode.

2. Draw the original image on to the new image: Here you use the DrawImage method. If you wanted the new text and barcode to appear at the top of the new image you would set the draw properties so the top would be set to display the blank space at the top and the image would start drawing beneath the space. For example, if the space required for the barcode or text was 50 pixels, the DestinationTop position of DrawImage would be 50.

Ex: Call 0Imaging.DrawImage (oldimage.GetNativeImage 0, 50, X2, Y2)

3. Add your barcode or text to the top of the new image.

Then, of course, you would need to save the new image in whatever format you want.

Hope that helps.

Tom
Tom Moran
 
Posts: 49
Joined: Thu May 24, 2007 10:41 am
Location: Phoenix, Arizona

Re: Adding text without overwriting image

Postby senior on Fri Sep 19, 2008 5:31 pm

Thanks Tom for the reply.
I'll look into those 3 steps.
senior
 
Posts: 20
Joined: Thu Aug 07, 2008 10:00 pm

Re: Adding text without overwriting image

Postby senior on Fri Sep 19, 2008 8:38 pm

Tom,
That works well. Your suggestions were a huge help!
I changed it a little, but I got it working.

Now, what if my scanned image is multiple pages? I am only getting the first page stamped. The other pages get deleted. Any suggestions on doing this when there are multiple scanned pages?

Thanks a ton!
senior
 
Posts: 20
Joined: Thu Aug 07, 2008 10:00 pm

Re: Adding text without overwriting image

Postby Tom Moran on Sat Sep 20, 2008 1:03 am

Hey Senior:

Glad that helped.

My suggestion would be to first scan the entire document as a TIFF file. Then open the multipage TIFF for editing and loop through each page stamping each page in the loop.

When the loop is finished then save the modified TIFF as a PDF file.

Tom
Tom Moran
 
Posts: 49
Joined: Thu May 24, 2007 10:41 am
Location: Phoenix, Arizona

Re: Adding text without overwriting image

Postby senior on Mon Sep 22, 2008 6:44 pm

Thanks Tom.

But the problem is this document has already been scanned and saved as a PDF.
It later has this text header added to it.

Any other suggestions?

Thanks!
senior
 
Posts: 20
Joined: Thu Aug 07, 2008 10:00 pm

Re: Adding text without overwriting image

Postby Tom Moran on Tue Sep 23, 2008 2:57 am

Hey Senior:

Should not be a problem. You could convert the PDF to TIFF:

For nPage = 1 To oGdViewer.PageCount
oGdViewer.DisplayFrame (nPage)

If nPage = 1 Then
oImaging.SetNativeImage (oImaging.CreateClonedImage(oGdViewer.GetNativeImage))
Call oImaging.SetHorizontalResolution(PDFDPI)
Call oImaging.SetVerticalResolution(PDFDPI)
Call oImaging.TiffSaveAsNativeMultiPage(TiffName)
Else
Call oImaging.SetHorizontalResolution(PDFDPI)
Call oImaging.SetVerticalResolution(PDFDPI)
Call oImaging.TiffAddToNativeMultiPage(oGdViewer.GetNativeImage)
End If

Next nPage

Then convert TIFF back to PDF. BTW, be sure to set the DPI (horiz and vert resolutions) to your PDFRendering DPI or your editing calculations for the TIFF may be off.

Tom
Tom Moran
 
Posts: 49
Joined: Thu May 24, 2007 10:41 am
Location: Phoenix, Arizona

Re: Adding text without overwriting image

Postby senior on Tue Sep 23, 2008 4:06 pm

Thanks again Tom!
I'll look into these steps/suggestions.
senior
 
Posts: 20
Joined: Thu Aug 07, 2008 10:00 pm


Return to GdPicture [Pro] ActiveX

Who is online

Users browsing this forum: No registered users and 0 guests

cron