Print Page | Close Window

Problem with Adding Image To Page - invisible

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=2452
Printed Date: 04 Apr 26 at 11:05PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Problem with Adding Image To Page - invisible
Posted By: andyhill
Subject: Problem with Adding Image To Page - invisible
Date Posted: 14 Nov 12 at 8:27PM
I seem to be missing something ? Please advise - Thanks in advance.

          PDFLibrary.InsertPages(PageNo, 1);
          Inc(PageNo);
          ms.SetSize(0);
          ImageEn1.IO.SaveToStreamJpeg(ms);
          ImageID:= PDFLibrary.AddImageFromStream(ms, 0);
          lWidth:= PDFLibrary.ImageWidth;
          lHeight:= PDFLibrary.ImageHeight;
          PDFLibrary.DrawImage(0, 0, lWidth, lHeight);
          PDFLibrary.ReleaseImage(ImageID);





Replies:
Posted By: andyhill
Date Posted: 14 Nov 12 at 8:51PM
Resolved

      PDFLibrary.InsertPages(PageNo, 1);
      PDFLibrary.SetPageDimensions(992, 1402); // A4
      Inc(PageNo);
      ms.SetSize(0);
      ImageEn1.IO.SaveToStreamJpeg(ms);
      ImageID:= PDFLibrary.AddImageFromStream(ms, 0);
      PDFLibrary.SelectImage(ImageID);
      lWidth:= PDFLibrary.ImageWidth;
      lHeight:= PDFLibrary.ImageHeight;
      PDFLibrary.SetOrigin(1);
      PDFLibrary.DrawImage(0, 0, lWidth, lHeight);
      PDFLibrary.ReleaseImage(ImageID);



Posted By: AndrewC
Date Posted: 15 Nov 12 at 10:23AM

Andy,

Note : ImageWidth and ImageHeight return the image size in pixels and the DrawImage function requires measurements in points.

You can refer to this post for a method of importing an image based on the DPI of the image -  

http://www.quickpdf.org/forum/creating-a-multi-page-pdf-from-a-multipage-tiff_topic2125.html

Also 72points = 1 inch.  So  PDFLibrary.SetPageDimensions(842, 595);  will set the page to A4 or PDFLibrary.SetPageSize('A4');  will also work.

Andrew.



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