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

Sample to add text to a multipage file

Example requests & Code samples for GdPicture ActiveX.

Sample to add text to a multipage file

Postby ICONN on Wed Jun 11, 2008 5:31 pm

Hi,

I've been evaluating the gdPicture Pro controls to see if it will work for my application. There's one thing left that I need to prove before purchase. I hope you can help.

If I want to open either a multipage TIFF or a multipage PDF, what are the steps to DrawText on any page, and then be able to save the whole multipage document? I have no problem using DrawText, but I lose all pages except the page I just put the text on. Can you provide a sample to open a file, allow a DrawText on page 3, and then save it?

Thanks!


Scott
ICONN
 
Posts: 5
Joined: Wed Jun 11, 2008 5:22 pm

Re: Sample to add text to a multipage file

Postby ICONN on Thu Jun 12, 2008 9:09 pm

Anybody know how to do this? I know I must be missing something simple...
ICONN
 
Posts: 5
Joined: Wed Jun 11, 2008 5:22 pm

Re: Sample to add text to a multipage file

Postby Loïc on Fri Jun 13, 2008 10:32 am

Hi,

You need to use the last GdPicture Pro edition to do that.

I give you a sample code to draw page number on a multipage tiff image and save it:


Code: Select all
Dim nCpt As Long
Dim nTiffImageID As Long
Dim nPageCount As Long

nTiffImageID = Imaging1.TiffCreateMultiPageFromFile("input.tif")
nPageCount = Imaging1.TiffGetPageCount(nTiffImageID)

For nCpt = 1 To nPageCount
    Call Imaging1.TiffSelectPage(nTiffImageID, nCpt)
    Call Imaging1.DrawText("Page " & CStr(nCpt) & " / " & CStr(nPageCount), 50, 50, 10)
Next nCpt

Call Imaging1.TiffSaveMultiPageToFile(nTiffImageID, "output.tif")
Imaging1.CloseImage (nTiffImageID)


Best regards,

Loïc
User avatar
Loïc
Site Admin
 
Posts: 1195
Joined: Tue Oct 17, 2006 11:48 pm
Location: France

Re: Sample to add text to a multipage file

Postby ICONN on Fri Jun 13, 2008 7:12 pm

Thanks Loïc, your example does help a lot. But, I have two questions:

1. I'm trying to combine what you have shown here with the TextWriter example so that the user can go to any page in a document and add a comment. Since the code shown here doesn't use the AxGdViewerCnt control, they can't see the document. You know these controls very well, so is there any way that you can provide a code snippet that will combine these two methods? What I really need is a way to type text on any page of a multipage document.

Also, if I want to allow comments to be added to a PDF file, would I have to convert the PDF to TIFF, allow the DrawText, and then convert it back to PDF?

2. I'm starting with a 5 page TIFF file that is 156Kb. After adding a simple text comment on one page and saving the document with Group IV compression, it blows up to 1521Kb. That's a huge difference. Does the DrawText really add that much, or am I doing something else wrong?

Thanks!


Scott
ICONN
 
Posts: 5
Joined: Wed Jun 11, 2008 5:22 pm

Re: Sample to add text to a multipage file

Postby Dabi123 on Thu Jul 31, 2008 12:04 am

Hi, Any idea.. how to do that.. I want the same feature too..
Thanx
Dabi
Dabi123
 
Posts: 18
Joined: Mon Apr 28, 2008 10:28 pm

Re: Sample to add text to a multipage file

Postby Loïc on Thu Jul 31, 2008 10:25 am

Hi guys,

Sorry I didn't see the last answer to this post.


You are probably drawing text on 1bpp image. To perform this feature, the toolkit convert the image to 32bpp.

After drawing text, you can convert again the image to 1bpp using the ConvertTo1bpp() method.

Best regards,

Loïc
User avatar
Loïc
Site Admin
 
Posts: 1195
Joined: Tue Oct 17, 2006 11:48 pm
Location: France


Return to Example requests & Code samples

Who is online

Users browsing this forum: No registered users and 0 guests