Sample to add text to a multipage file
Sample to add text to a multipage file
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
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
Re: Sample to add text to a multipage file
Anybody know how to do this? I know I must be missing something simple...
Re: Sample to add text to a multipage file
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:
Best regards,
Loïc
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)
Loïc
Re: Sample to add text to a multipage file
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
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
Re: Sample to add text to a multipage file
Hi, Any idea.. how to do that.. I want the same feature too..
Thanx
Dabi
Thanx
Dabi
Re: Sample to add text to a multipage file
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
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
Who is online
Users browsing this forum: No registered users and 1 guest