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 > I need help - I can help
  New Posts New Posts RSS Feed - GetImageID not working?
  FAQ FAQ  Forum Search   Register Register  Login Login

GetImageID not working?

 Post Reply Post Reply
Author
Message
Bjarke View Drop Down
Beginner
Beginner


Joined: 18 Feb 13
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote Bjarke Quote  Post ReplyReply Direct Link To This Post 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);
   }
}
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3530
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
Bjarke View Drop Down
Beginner
Beginner


Joined: 18 Feb 13
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote Bjarke Quote  Post ReplyReply Direct Link To This Post Posted: 20 Feb 13 at 8:23AM
FindImages returns the number of images found - how can I access the images and get their ImageID?
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3530
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Bjarke View Drop Down
Beginner
Beginner


Joined: 18 Feb 13
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote Bjarke Quote  Post ReplyReply Direct Link To This Post 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?
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3530
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post 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
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