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 - Delphi 2007 - Convert multipage TIFF file to PDF
  FAQ FAQ  Forum Search   Register Register  Login Login

Delphi 2007 - Convert multipage TIFF file to PDF

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


Joined: 14 Feb 13
Status: Offline
Points: 1
Post Options Post Options   Thanks (0) Thanks(0)   Quote janigorse Quote  Post ReplyReply Direct Link To This Post Topic: Delphi 2007 - Convert multipage TIFF file to PDF
    Posted: 14 Feb 13 at 1:57PM
Code below converts my TIFF file to PDF. But when I open the PDF with Acrobat, scrolling to particular page (sometimes page 4, on the other file page 2 for example) shows an Error on page
message. Can you point me to direction where can I look for a solution?

procedure TForm1.ConvertTiffToPdf(inputImagePath: String; outputFilePath: String);
var
  page, pages, id, UnlockResult, result, dpix, dpiy, docid: Integer;
  imageWidthInPoints, imageHeightInPoints: Double;
  pdfLib: TDebenuPDFLibrary0913;
begin

  pdfLib := TDebenuPDFLibrary0913.Create;
  pdfLib.UnlockKey('jn3343ac9ko4yt4gj7ak5z34y');
    
  docid := pdfLib.NewDocument;
  pdfLib.SetPDFAMode(2);
  pages := pdfLib.GetImagePageCount(inputImagePath);

  if pages = 0 then pages := 1;

  for page := 1 to pages do
  begin

      if page <> 1 then pdfLib.NewPage;

      id := pdfLib.AddImageFromFile(inputImagePath, page);
      pdfLib.SelectImage(id);
      dpix := pdfLib.ImageHorizontalResolution;
      dpiy := pdfLib.ImageVerticalResolution;

      if dpix = 0 then dpix := 72;
      if dpiy = 0 then dpiy := 72;

      imageWidthInPoints := pdfLib.ImageWidth / dpix * 72.0;
      imageHeightInPoints := pdfLib.ImageHeight / dpiy * 72.0;

      pdfLib.SetPageDimensions(imageWidthInPoints, imageHeightInPoints);
      pdfLib.SetOrigin(1);
      pdfLib.DrawImage(0, 0, imageWidthInPoints, imageHeightInPoints);

  end;
    
  pdfLib.SaveToFile(outputFilePath);
  pdfLib.RemoveDocument(docid);
    
  pdfLib.Free;

end;
Back to Top
AndrewC View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 08 Dec 10
Location: Geelong, Aust
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote AndrewC Quote  Post ReplyReply Direct Link To This Post Posted: 18 Feb 13 at 7:04AM

Which version of QPL are you using ?

Is the TIFF file a colour LZW TIFF image ?

Andrew.
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3529
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 18 Feb 13 at 1:38PM
Hi Andrew!
 
It's 9.13 ;-)
 
Cheers, Ingo
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