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!
![]() |
GetImageID not working? |
Post Reply
|
| Author | |
Bjarke
Beginner
Joined: 18 Feb 13 Status: Offline Points: 3 |
Post Options
Thanks(0)
Quote Reply
Topic: GetImageID not working?Posted: 19 Feb 13 at 3:07PM |
|
I'm trying to resize all images in a PDF (using the dll-version from c#) and tried to use GetImageID to get the Id of the image that is being replaced. After consulting the manual I found out that GetImageID only returns IDs of images that have been added to the document. But how do you get the ID of an image already existing in the document?
for (int pageIdx = 0; pageIdx < qp.PageCount(); pageIdx++) { qp.SelectPage(pageIdx); var imageListID = qp.GetPageImageList(0); for (int imageIdx = 1; imageIdx <= qp.GetImageListCount(imageListID); imageIdx++) { var image = new Bitmap(new MemoryStream(qp.GetImageListItemDataToString(imageListID, imageIdx, 0))); image = ResizeBitmap(ref image); int oldId = qp.GetImageID(imageIdx); int newId = qp.AddImageFromString(ImageToByte(image), 0); qp.ReplaceImage(oldId, newId); qp.ClearImage(oldId); } } |
|
![]() |
|
Ingo
Moderator Group
Joined: 29 Oct 05 Status: Offline Points: 3530 |
Post Options
Thanks(0)
Quote Reply
Posted: 19 Feb 13 at 8:37PM |
|
Hi!
FindImage you'll need: http://www.debenu.com/docs/pdf_library_reference/FindImages.php Cheers and welcome here, Ingo |
|
![]() |
|
Bjarke
Beginner
Joined: 18 Feb 13 Status: Offline Points: 3 |
Post Options
Thanks(0)
Quote Reply
Posted: 20 Feb 13 at 8:23AM |
|
FindImages returns the number of images found - how can I access the images and get their ImageID?
|
|
![]() |
|
Ingo
Moderator Group
Joined: 29 Oct 05 Status: Offline Points: 3530 |
Post Options
Thanks(0)
Quote Reply
Posted: 20 Feb 13 at 9:36PM |
|
Yes... Sorry... You're right.
Resizing images in an existing pdf won't work. Getting the data of all images in a pdf is possible. Anywhere (perhaps in the samples-section or an old newsletter) should be a sample. Cheers, Ingo |
|
![]() |
|
Bjarke
Beginner
Joined: 18 Feb 13 Status: Offline Points: 3 |
Post Options
Thanks(0)
Quote Reply
Posted: 21 Feb 13 at 3:08PM |
|
So ReplaceImage(oldID, newID) only works with images that you have added to a pdf? Is there really no other way of replacing images already existing in a pdf?
|
|
![]() |
|
Ingo
Moderator Group
Joined: 29 Oct 05 Status: Offline Points: 3530 |
Post Options
Thanks(0)
Quote Reply
Posted: 21 Feb 13 at 8:57PM |
|
Changing the content of a ready made pdf is hard stuff!
There will be ways but not with QuickPDF in a comfortable way ;-) You should read the developer guid and the reference guide then you'll know more. The library has many functions for a low cost price. It's a good solution for many issues - for real pdf modifying not. Cheers, Ingo |
|
![]() |
|
Post Reply
|
|
|
Tweet
|
| Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |
Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. About — Contact — Blog — Support — Online Store