/*
//
// ADOBE SYSTEMS INCORPORATED
// Copyright (C) 2000-2003 Adobe Systems Incorporated
// All rights reserved.
//
// NOTICE: Adobe permits you to use, modify, and distribute this file
// in accordance with the terms of the Adobe license agreement
// accompanying it. If you have received this file from a source other
// than Adobe, then your use, modification, or distribution of it
// requires the prior written permission of Adobe.
//
*/
#include <stdlib.h>
#include <string>
#include "MyPDFLibUtils.h"
#include "Peddler.h"
#include "PeddlerUtils.h"
int main();
int main()
{
INIT_AUTO_POOL(autoReleasePool); /* Required only on MAC platform */
// some UI, or command line parsing would be a better way to define these parameters
// we know the application is targetted at the project level directory (Peddler, not
// peddler:project
string name = "../ExampleFiles/test.pdf" ;
#ifndef MAC_PLATFORM
string uriname = "../ExampleFiles/mapFile.txt" ;
#else
//Construct a absolute path
CFBundleRef bundleRef = CFBundleGetMainBundle ();
CFURLRef bundleURL = CFBundleCopyExecutableURL ( bundleRef );
//check to see which way we were started. Double-clicking the package gives us the
// .app path, else we have the .app/Contents/MacOS path
UInt8 buffer[1000];
CFStringRef longStr = CFSTR( "../../../../ExampleFiles/mapFile.txt" );
CFStringRef shortStr = CFSTR( "../../ExampleFiles/mapFile.txt" );
CFURLRef fullPathURL;
CFURLGetFileSystemRepresentation (bundleURL, true , buffer, 1000);
int len = strlen(( char *)buffer);
if (strcmp( "app" , ( char *)&buffer[len-3]) != 0)
{
CFURLRef pathOnlyURL = CFURLCreateCopyDeletingLastPathComponent (kCFAllocatorDefault,
bundleURL);
fullPathURL = CFURLCreateCopyAppendingPathComponent (kCFAllocatorDefault, pathOnlyURL,
longStr, false );
CFRelease(pathOnlyURL);
}
else
fullPathURL = CFURLCreateCopyAppendingPathComponent (kCFAllocatorDefault, bundleURL,
shortStr, true );
CFURLGetFileSystemRepresentation (fullPathURL, true , buffer, 1000);
string uriname = ( char *)buffer;
CFRelease(bundleURL);
CFRelease(fullPathURL);
#endif
// convert this into a sys path for whatever platform we are on.
string platformName= PeddlerUtils::getSysPath(uriname);
Peddler * myPeddler = new Peddler(name, platformName);
string outputName = "../ExampleFiles/savedPDF.pdf" ;
myPeddler->MakeURIs(outputName);
delete myPeddler;
RELEASE_AUTO_POOL(autoReleasePool); /* Required only on MAC platform */
return 0;
}