I originally posted same topic but it hasn't been resolved and my trial expires soon and I need to know if this product will meet my needs (hence the new post):
I am trying to add a watermark (transparent image) to a image file. Below is some basic code to show that you can create a pdf with watermarks but using the same code it does not produce the same results when creating an image file (.SaveToFile vs .RenderDocumentToFile). The image file (.RenderDocumentToFile) only shows the overlaid image with 0 transparency.
Can anyone please help me create an image file with transparent images?
strImportFolder = "E:\FOXIT\Testing" strImportFile = "IMG_3560" strImportFileExt = "jpg" strWMFolder = "E:\FOXIT\Testing" strWMFile = "TestWM" strWMFileExt = "jpg" strExportFolder = "E:\FOXIT\Testing\" strExportFile = "Image_3560" strExportFileExt = "jpg" dblPage = 1 dblTransparency = 90 Set objPDF = CreateObject(gcstrPDFLibrary) If objPDF.UnlockKey(gcstrPDFLicense) = 1 Then Call objPDF.AddImageFromFile(strImportFolder & "\" & strImportFile & "." & strImportFileExt, 0) dblWidth = objPDF.ImageWidth() dblHeight = objPDF.ImageHeight() ret = objPDF.SetPageDimensions(dblWidth, dblHeight) ret = objPDF.DrawImage(0, dblHeight, dblWidth, dblHeight) ret = objPDF.SelectPage(dblPage) ret = objPDF.NormalizePage(0) ret = objPDF.SetOrigin(1) dblContentStream = objPDF.NewContentStream ret = objPDF.SelectContentStream(dblContentStream) ret = objPDF.SaveState dblWMImageID = objPDF.AddImageFromFile(strWMFolder & "\" & strWMFile & "." & strWMFileExt, 0) ret = objPDF.SelectImage(dblWMImageID) ret = objPDF.SetTransparency(dblTransparency) ret = objPDF.DrawImage(0, 0, objPDF.PageWidth, objPDF.PageHeight) ret = objPDF.LoadState ret = objPDF.MoveContentStream(dblContentStream, objPDF.ContentStreamCount) Call objPDF.CombineContentStreams ret = objPDF.SaveToFile(strExportFolder & "\" & strExportFile & ".pdf") ret = objPDF.RenderDocumentToFile(300, 1, 1, 1, strExportFolder & "\" & strExportFile & "." & strExportFileExt) End If Set objPDF = Nothing
|