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 - Problem with Tiff compression
  FAQ FAQ  Forum Search   Register Register  Login Login

Problem with Tiff compression

 Post Reply Post Reply
Author
Message
haka View Drop Down
Beginner
Beginner
Avatar

Joined: 16 Jun 11
Status: Offline
Points: 7
Post Options Post Options   Thanks (0) Thanks(0)   Quote haka Quote  Post ReplyReply Direct Link To This Post Topic: Problem with Tiff compression
    Posted: 02 Dec 20 at 8:25AM
Hello. I have been using the following code for a long time and now I have a problem with version 18.11.
The file size is 1 MB, if text is added. Without text the compression works and the file is about 13 KB small.
procedure pdfTest(AWriteText: boolean);
var LOcrText: string;
    LPDF    : TDebenuPDFLibrary;
begin
  LPDF := TDebenuPDFLibrary.Create;
  LPDF.UnlockKey('your key');
  try
    LPDF.SetPDFAMode(2);
    LPDF.SetMeasurementUnits(1);
    LPDF.SetPageSize('A4');
    LPDF.CompressImages(1);
    LPDF.AddImageFromFile('g:\temp\test.tif', 1); // use Windows Paint, draw a line for example and save as Tiff
    LPDF.FitImage(0, LPDF.PageHeight, LPDF.PageWidth, LPDF.PageHeight, 1, 1, 0);  //or  LPDF.DrawScaledImage((...

    { if AWriteText is true or just one of the three lines is executed, the file size is > 1000 kB }
    { if AWriteText is false the file size is only ~ 13 kB  }
    if AWriteText then begin
      LOcrText := 'this is only a test test';
      LPDF.SetTextMode(3); // Invisible text
      LPDF.SetTextSize(6);
      LPDF.DrawTextBox(5, LPDF.PageHeight-5, LPDF.PageWidth-10, LPDF.PageHeight-10, LOcrText, 1);
    end;

    LPDF.SaveToFile('g:\temp\test.pdf');
  finally
    LPDF.Free;
  end;
end;


Greetings and thanks for suggestions,
Harald
Back to Top
Sopracenery View Drop Down
Team Player
Team Player
Avatar

Joined: 31 Aug 20
Location: Germany
Status: Offline
Points: 29
Post Options Post Options   Thanks (0) Thanks(0)   Quote Sopracenery Quote  Post ReplyReply Direct Link To This Post Posted: 27 Dec 20 at 8:49AM
Hi,
I can confirm this issue.

It has probably to do with the PDF-A mode.
You can bypass this by switching on PDF-A mode after TIF and text is drawn:

LPDF.FitImage(0, LPDF.PageHeight, LPDF.PageWidth, LPDF.PageHeight, 1, 1, 0);  //or  LPDF.DrawScaledImage((...
LPDF.DrawTextBox(5, LPDF.PageHeight-5, LPDF.PageWidth-10, LPDF.PageHeight-10, LOcrText, 1);
LPDF.SetPDFAMode(2);

Regards
Martin


Edited by Sopracenery - 27 Dec 20 at 9:08AM
Back to Top
haka View Drop Down
Beginner
Beginner
Avatar

Joined: 16 Jun 11
Status: Offline
Points: 7
Post Options Post Options   Thanks (0) Thanks(0)   Quote haka Quote  Post ReplyReply Direct Link To This Post Posted: 27 Dec 20 at 4:21PM
Good tip, it solves the poblem.
Thank you.
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