Print Page | Close Window

transparent jpeg images

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=1270
Printed Date: 22 Nov 24 at 1:31PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: transparent jpeg images
Posted By: divo
Subject: transparent jpeg images
Date Posted: 11 Nov 09 at 3:56PM
Hi there,

I have a problem with grayscale jpeg images. If I add a grayscale jpeg and set an image mask for transparency no error is thrown, but if your view the pdf via Acroread 9.2 it informs you about an error on the page.

Below is a small program that reproduces the behaviour. (I'm using Delphi2009) At the end of this post is a base64 encoded 1x1-px jpeg that one can use.

Is this a bug in the library or am I doing something wrong here?


program error;

{$APPTYPE CONSOLE}

uses
  SysUtils,
  QuickPDF0717;

var
  QP: TQuickPDF0717;
  retval: Integer;

begin
  try
    QP:= TQuickPDF0717.Create;
    if QP.UnlockKey(YOUR KEY HERE) = 0 then raise Exception.Create('UnlockKey');
    if QP.NewDocument = 0 then raise Exception.Create('NewDocument');
    if QP.AddImageFromFile('error.jpg', 0) = 0 then raise Exception.Create('AddImageFromFile');
    if QP.SetImageMask(0.9, 0.9, 0.9, 1, 1, 1) = 0 then raise Exception.Create('SetImageMask');
    if QP.DrawScaledImage(0, QP.ImageHeight, 0.5) = 0 then raise Exception.Create('DrawImage');
    if QP.SaveToFile('dummy.pdf') = 0 then raise Exception.Create('SaveToFile');

  except
    on E:Exception do begin
      Writeln(E.Classname, ': ', E.Message);
      Readln;
    end;
  end;
end.



/9j/4AAQSkZJRgABAQEASABIAAD/2wBDAAUDBAQEAwUEBAQFBQUGBwwIBwcHBw8LCwkMEQ8SEhEP
ERETFhwXExQaFRERGCEYGh0dHx8fExciJCIeJBweHx7/wAALCAABAAEBAREA/8QAFAABAAAAAAAA
AAAAAAAAAAAACP/EABQQAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQEAAD8AZb//2Q==




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