Chilkat
HOME
Android™
ASP
Visual Basic
VB.NET
C#
iOS (IPhone)
Objective-C
C++
C
MFC
Delphi
FoxPro
Java
Perl
PHP Extension
PHP ActiveX
Python
PowerShell
Ruby
SQL Server
VBScript
|
Extract XMP MetaData as XMLDemonstrates how to open a JPG or TIF image file and extract the XMP metadata as XML. CREATE PROCEDURE ChilkatSample AS BEGIN DECLARE @hr int DECLARE @iTmp0 int DECLARE @sTmp0 nvarchar(4000) DECLARE @xmp int EXEC @hr = sp_OACreate 'Chilkat.Xmp', @xmp OUT IF @hr <> 0 BEGIN PRINT 'Failed to create ActiveX component' RETURN END DECLARE @success int EXEC sp_OAMethod @xmp, 'UnlockComponent', @success OUT, 'Anything for 30-day trial.' IF @success <> 1 BEGIN EXEC sp_OAGetProperty @xmp, 'LastErrorText', @sTmp0 OUT PRINT @sTmp0 RETURN END -- Load a JPG or TIF image file. -- Sample JPG's with XMP metadata may be found at: -- http://www.chilkatsoft.com/testData/xmp/sample1.jpg -- http://www.chilkatsoft.com/testData/xmp/sample2.jpg -- http://www.chilkatsoft.com/testData/xmp/sample3.jpg EXEC sp_OAMethod @xmp, 'LoadAppFile', @success OUT, 'sample1.jpg' IF @success <> 1 BEGIN EXEC sp_OAGetProperty @xmp, 'LastErrorText', @sTmp0 OUT PRINT @sTmp0 RETURN END EXEC sp_OAGetProperty @xmp, 'NumEmbedded', @iTmp0 OUT PRINT 'Num embedded XMP docs: ' + @iTmp0 -- Assuming there is at least one, get the 1st. -- (There is typically never more than one, but theoretically it's possible.) DECLARE @xml int EXEC sp_OAMethod @xmp, 'GetEmbedded', @xml OUT, 0 IF Not (@xml Is NULL ) BEGIN EXEC sp_OAMethod @xml, 'SaveXml', @success OUT, 'xmpMetaData.xml' IF @success <> 1 BEGIN EXEC sp_OAGetProperty @xml, 'LastErrorText', @sTmp0 OUT PRINT @sTmp0 END PRINT 'Success.' END ELSE BEGIN EXEC sp_OAGetProperty @xmp, 'LastErrorText', @sTmp0 OUT PRINT @sTmp0 END END GO |
© 2000-2010 Chilkat Software, Inc. All Rights Reserved.