Print Page | Close Window

GetImageID not working?

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=2535
Printed Date: 16 Jan 26 at 4:09PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: GetImageID not working?
Posted By: Bjarke
Subject: GetImageID not working?
Date 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);
   }
}



Replies:
Posted By: Ingo
Date 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



Posted By: Bjarke
Date Posted: 20 Feb 13 at 8:23AM
FindImages returns the number of images found - how can I access the images and get their ImageID?


Posted By: Ingo
Date 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


Posted By: Bjarke
Date 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?


Posted By: Ingo
Date 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



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk