$PBExportHeader$eaf_n_cst_pdfproviderservice.sru forward global type eaf_n_cst_pdfproviderservice from n_cst_contentproviderservice end type end forward global type eaf_n_cst_pdfproviderservice from n_cst_contentproviderservice end type global eaf_n_cst_pdfproviderservice eaf_n_cst_pdfproviderservice type prototypes end prototypes type variables end variables forward prototypes public function long createcontentmain (ref n_cst_datasetattrib anv_datasetattrib, ref s_mimedataset astr_mimedataset) end prototypes public function long createcontentmain (ref n_cst_datasetattrib anv_datasetattrib, ref s_mimedataset astr_mimedataset);//////////////////////////////////////////////////////////////// // Description: // Main method for the PDF createContent process // Revisions // 3.0 - Initial version // Arguments: // n_cst_datasetattrib - REF // s_mimerequest - REF // Returns: // 1 - Success // -1 - Failure //////////////////////////////////////////////////////////////// // Copyright © 2000 - 2007 Youngsoft, Inc. All rights reserved. // Any distribution of the Youngsoft, Inc. Enterprise Application Framework // source code in whole or part by other than Youngsoft, Inc. is prohibited. //////////////////////////////////////////////////////////////// constant string METHOD_NAME = "createContentMain( REF n_cst_datasetattrib, REF s_mimedataset )" string ls_filename string ls_directory string ls_pdfprovider long ll_rc n_cst_objectservice lnv_object try lnv_object = create n_cst_objectservice inv_log.propagateSettings( lnv_object ) //Generate the temporary file name if generateTempFileName( ls_directory, ls_filename ) = -1 then addError( METHOD_NAME, "PDF generation failed. Could not generate temporary filename." ) return -1 end if //Determine PDF Provider if lnv_object.getVariable( inv_constants.PDF_PROVIDER_VAR_NAME, ls_pdfprovider ) = -1 then ls_pdfprovider = "ghostscript" lnv_object.setVariable( inv_constants.PDF_PROVIDER_VAR_NAME, ls_pdfprovider ) end if inv_log.debugLog( METHOD_NAME, inv_constants.MESSAGE_TYPE_EAF_DEBUG, "PDF Provider: " + ls_pdfprovider ) Choose Case lower(ls_pdfprovider) Case "ghostscript" if anv_datasetattrib.ids_working.saveAs( ls_directory + ls_filename, PDF!, false, EncodingUTF16LE! ) = -1 then addError( METHOD_NAME, "PDF generation failed. Failed to save datawindow as PDF. Check to make sure ghostscript is installed on the machine and is on the path." ) return -1 end if End Choose //Read the file contents of the PDF file and place on the dataset structure if readFile( ls_directory + ls_filename, astr_mimedataset.data.binary, true ) = -1 then addError( METHOD_NAME, "PDF generation failed. Could not read the generated file." ) return -1 end if finally if isValid( lnv_object ) then destroy lnv_object end if end try return 1 end function on eaf_n_cst_pdfproviderservice.create call super::create end on on eaf_n_cst_pdfproviderservice.destroy call super::destroy end on
File: eaf_n_cst_pdfproviderservice.sru
Size: 3170
Date: Tue, 22 Jan 2008 23:40:17 +0100
Size: 3170
Date: Tue, 22 Jan 2008 23:40:17 +0100
- n_cst_contentproviderservice eaf_n_cst_pdfproviderservice(sru)