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 - Convert image (EMF) to pdf
  FAQ FAQ  Forum Search   Register Register  Login Login

Convert image (EMF) to pdf

 Post Reply Post Reply
Author
Message
waynefulcher View Drop Down
Senior Member
Senior Member
Avatar

Joined: 23 Jun 08
Location: United States
Status: Offline
Points: 99
Post Options Post Options   Thanks (0) Thanks(0)   Quote waynefulcher Quote  Post ReplyReply Direct Link To This Post Topic: Convert image (EMF) to pdf
    Posted: 24 Jun 08 at 12:18PM
I am trying to convert an EMF to a pdf. I have tried several different draw methods but none seem to work. No matter what I do I end up with a pdf file that has one blank page on it. I stripped out all the error checking code to make it easier to read but I was getting no errors. Can someone look at this code and tell me what I am doing wrong. I am using Delphi 7, iSED version 5.21.
 
 
procedure EMFToPDF(EMFFileName: String) ;
var
  PDFObj: TiSEDQuickPDF;
  ImageID: Integer ;
begin
  PDFObj := TiSEDQuickPDF.Create;
  try
    PDFObj.UnlockKey(PDF_Unlock_Key);
    PDFObj.NewDocument ;
    ImageID := PDFObj.AddImageFromFile(EMFFileName, 0) ;
    PDFObj.SelectPage(1) ;
    PDFObj.SelectImage(ImageID) ;
 
//   My test emf reports that
//   PDFObj.ImageWidth = 5105
//   PDFObj.ImageHeight = 6598
//    PDFObj.DrawImage(1, 1, PDFObj.ImageWidth, PDFObj.ImageHeight) ;

    PDFObj.DrawScaledImage(1, 1, 0.25) ;
    PDFObj.SaveToFile(ChangeFileExt(EMFFileName, '.pdf')) ;
  finally
    PDFObj.Free ;
  end ;
end ;
 
Thanks in advance
wayne
Back to Top
waynefulcher View Drop Down
Senior Member
Senior Member
Avatar

Joined: 23 Jun 08
Location: United States
Status: Offline
Points: 99
Post Options Post Options   Thanks (0) Thanks(0)   Quote waynefulcher Quote  Post ReplyReply Direct Link To This Post Posted: 30 Jun 08 at 10:37AM
OK I changed the routine up slightly and made it work for all image types but EMF ( I have not tried TIFFs ). I am wondering now there seems to be only three possible problems:
1. My EMF image file ( I can view in windows just fine )
2. My code ( which works for all other image types )
3. QuickPDF does not work with EMF images.
Can anyone else or has anyone else get/got this to wotk with an EMF?
 
procedure ImageToPDF(ImageFileName: String) ;
var
  PDFObj  : TiSEDQuickPDF;
  DocID   : Integer ;
  ImageID : Integer ;
  W, H    : Double ;
begin
  PDFObj := TiSEDQuickPDF.Create;
  try
    PDFObj.UnlockKey(PDF_Unlock_Key);
    DocID := PDFObj.NewDocument ;
    PDFObj.SelectDocument(DocID) ;
    PDFObj.SelectPage(1) ;
    ImageID := PDFObj.AddImageFromFile(ImageFileName, 0) ;
    PDFObj.SelectImage(ImageID) ;
    if (PDFObj.ImageWidth > PDFObj.PageWidth) or
       (PDFObj.ImageHeight > PDFObj.PageHeight) then begin
     W := PDFObj.PageWidth ;
     H := PDFObj.PageHeight ;
   end
   else begin
     W := PDFObj.ImageWidth ;
     H := PDFObj.ImageHeight ;
   end ;
    PDFObj.FitImage(1, PDFObj.PageHeight-80, W, H, 1, 1, 0) ;
    PDFObj.SaveToFile(ChangeFileExt(ImageFileName, '.pdf')) ;
  finally
    PDFObj.Free ;
  end ;
end ;
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