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 - Incorrect PDF when JPEG has color space
  FAQ FAQ  Forum Search   Register Register  Login Login

Incorrect PDF when JPEG has color space

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


Joined: 27 Nov 12
Location: Ukraine
Status: Offline
Points: 1
Post Options Post Options   Thanks (0) Thanks(0)   Quote Darlock Quote  Post ReplyReply Direct Link To This Post Topic: Incorrect PDF when JPEG has color space
    Posted: 27 Nov 12 at 3:58PM
Hi!
  I have a JPEG image with embeded color space (color profile). When I add the image to the PDF document via Adobe Acrobat - the PDF looks OK. When I add the image using QuickPDF library (see code below) and open the resulting file via Adobe Acrobat afterwards - the image's colors have changed as if there was no color profile.

procedure TForm1.btn1Click(Sender: TObject);
var
...
const
...
begin
  FPictureStream.Clear;
  FPictureStream.LoadFromFile(vFileName);

  FPDFLib.NewPage;
  FPDFLib.DeletePages(1, 1);

  // Page Properties
  FPDFLib.SetOrigin(1);
  FPDFLib.SetMeasurementUnits(1);
  FPDFLib.SetPageDimensions(210, 270);

  // Add image
  vGrProperties.x := 10;
  vGrProperties.y := 10;
  vGrProperties.w := 60;
  vGrProperties.h := 80;

  vRes := FPDFLib.AddImageFromStream(FPictureStream, 0);
  vIXR := FPDFLib.ImageVerticalResolution;
  vIYR := FPDFLib.ImageHorizontalResolution;
  case FPDFLib.ImageResolutionUnits of
    0, 1 : begin
      vResolutionFactorX := 1;
      vResolutionFactorY := 1;
    end;
    2 :  begin
      vResolutionFactorX := 1/vIXR * 25.4;
      vResolutionFactorY := 1/vIYR * 25.4;
    end;

    3 : begin
      vResolutionFactorX := 1/vIXR * 10;
      vResolutionFactorY := 1/vIYR * 10;
    end;
  end;
  vWidth := FPDFLib.ImageWidth * vResolutionFactorX;
  vHeight := FPDFLib.ImageHeight * vResolutionFactorY;
  vRes := FPDFLib.DrawImage(vGrProperties.x, vGrProperties.y, vWidth, vHeight);
  Assert(vRes > 0, cnstPlaceGraphicErr);

   ...

  if FPDFLib.SaveToFile(vFileName) = 0 then
    raise Exception.Create(format(cnstUnableSaveFile, [vFileName]));
end;
----------------------------------------------
I have an test project on Delphi with testing image, but I don't see how to attach file here
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