Print Page | Close Window

Problem using AddImageFromStream

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=3287
Printed Date: 16 Dec 25 at 11:23AM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Problem using AddImageFromStream
Posted By: Brummos
Subject: Problem using AddImageFromStream
Date Posted: 22 Mar 16 at 10:36AM
Hi,

I need some help using AddImageFromStream.

At the moment i have the following.

 PDFLibrary.InsertPages(1, 1);
 PDFLibrary.SetPageSize('A4');
 imageid := PDFLibrary.AddImageFromStream(IMGStream, 0);
 PDFLibrary.SelectImage(imageidd);
 horz := PDFLibrary.ImageWidth;
 vert:= PDFLibrary.ImageHeight;
 PDFLibrary.SetOrigin(1);
 PDFLibrary.DrawImage(0, 0, horz, vert);
 PDFLibrary.ReleaseImage(imageid);

the problem is with "imageid := PDFLibrary.AddImageFromStream(IMGStream, 0);". It keeps returning 0, so something goes wrong with adding the image. And the result is a blanco pdf file.

If i save the stream i get a perfect image, so i assume its correctly inserted into the stream i'm using.

Can anyone help me with this?

Thanks in advance




Replies:
Posted By: Ingo
Date Posted: 22 Mar 16 at 11:18AM
Hi Brummos,

so the image data isn't valid.
It would be more helpful posting the code snippet which builds the stream.
Perhaps then it's possible to find the error.
BTW: It's not necessary to insert a first blank page for creation because for first creation a blank page is as default already inside ;-)

Cheers and welcome here,
Ingo



-------------
Cheers,
Ingo



Posted By: Ingo
Date Posted: 22 Mar 16 at 11:22AM
perhaps it's only the stream-position.
It have to be set to 0 before.

Cheers, Ingo


-------------
Cheers,
Ingo



Posted By: Brummos
Date Posted: 22 Mar 16 at 11:23AM
Hi,

thanks for your help! you answer already helped me since it made me figure out why the stream was wrong.

the stream was fflled with a pdf and not an image like tiff. as soon as i stored the stream with tiff it started working.

thanks!



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