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!
![]() |
Convert image (EMF) to pdf |
Post Reply ![]() |
Author | |
waynefulcher ![]() Senior Member ![]() ![]() Joined: 23 Jun 08 Location: United States Status: Offline Points: 99 |
![]() ![]() ![]() ![]() ![]() 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
|
|
![]() |
|
waynefulcher ![]() Senior Member ![]() ![]() Joined: 23 Jun 08 Location: United States Status: Offline Points: 99 |
![]() ![]() ![]() ![]() ![]() |
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 ; |
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |
Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. About — Contact — Blog — Support — Online Store